cidrolin 21 posts msg #119273 - Ignore cidrolin modified |
4/30/2014 6:05:22 AM
I’ve started with Stratasearch looking for trading rules regarding SPY and SH tickers.
Basically, I was looking for a trend following model : I study the period 2007-2014, and I choose that we were in bear market when MA(index(^spx,close),15)) > MA(index(^spx,close),200)). Bull market was then defined by MA(index(^spx,close),15)) < MA(index(^spx,close),200)). My idea was that the market has two differents « moods » : bear and bull and that it is possible to find simple yet effective trading rules in these two moods. It will have only one position at time, SPY, SH or cash.
BearSystem -- when MA(index(^spx,close),15)) < MA(index(^spx,close),200)) :
The Chaikin money flow index was a great indicator of entry and exit regarding SPY and SH. I end up with entry when CMF(14) < 0 and exit when CMF(14) > 0.
Entry Stratasearch code :
// 1) Bearish
(mov(symbol(^spx,close),15,Simple) < mov(symbol(^spx,close),200,Simple)) and
// 3) Chaikin Money Flow
(cmf(14) < 0)
Exit Stratasearch code :
// 1) Bearish
(mov(symbol(^spx,close),15,Simple) > mov(symbol(^spx,close),200,Simple)) or
// 3) Chaikin Money Flow
(cmf(14) > 0)
BullSystem -- when MA(index(^spx,close),15)) > MA(index(^spx,close),200)) :
The Avg Directional Movement was a good indicator of entry and exit regarding only SPY. Given the strong up bias in bull market, I cannot find any effective way of trading SH. Combining Avg Directional Movement of SPY with Qstick position of ^VIX was then very effective.
Entry Stratasearch code :
// 1) Bullish
(mov(symbol(^spx,close),15,Simple) > mov(symbol(^spx,close),200,Simple)) and
// 2) Avg Directional Movement
(adx(8) > pdi(8) or adx(8) > mdi(8)) and
// 3) Qstick VIX
(symbol(^VIX, qst(10)) < 0)
Exit Stratasearch code :
// // 1) Bullish 15 200
(mov(symbol(^spx,close),15,Simple) < mov(symbol(^spx,close),200,Simple)) or
// 2) Avg Directional Movement
(adx(8) < pdi(8) and adx(8) < mdi(8))
Here the result :
Values are quite robust : if you change numerical values in trading rules, you doesn't change so much the results. However, this strategy doesn't work well prior 2008.
Any comments, thoughts and criticism are welcome.
NOTE1: it appears that Stratasearch is computing ADX, PDI and MDI as integers. I'm investigating if it's a feature or a bug in SS. I then don't want / be able to post Stockfetcher filters at this time.
|
gmg733 788 posts msg #119276 - Ignore gmg733 modified |
4/30/2014 8:39:49 AM
I take it this is somewhat of a manual process? When 15MA is over 200MA you run the bull signal and vice versa? Or is this part of one strategy in SS? Market orders?
Did you try variable settings to find the optimal settings over your time of reference?
So far it looks pretty damn good to me.
Thanks for sharing.
|
cidrolin 21 posts msg #119282 - Ignore cidrolin |
4/30/2014 9:28:41 AM
This strategy switches between SPY SH and cash (no holding).
The numerical values were optimized over this time frame : as previously said, if you change numerical values in trading rules, you doesn't change so much the results.
No leverage used, and you enter and exit at the opening of the next day.
For Stratasearch, I use a multisystem with "BullSystem" over SPY + "BearSystem" over SPY and SH.
|
cidrolin 21 posts msg #119283 - Ignore cidrolin |
4/30/2014 9:29:59 AM
By the way, I am looking for a way to round to the nearest integer in stockfetcher...
|
cidrolin 21 posts msg #119284 - Ignore cidrolin modified |
4/30/2014 11:01:02 AM
I figure it out.
Here is a SF filter to enter (buy SPY) and exit (sell SPY) when market is Bull.
I think that the boolean algebra is OK, bu I have a trouble. I think it's related to ADX calculation.
SS buy SPY from 02/10 to 03/28, but as you can see SF from 02/10 to 03/25.... SF always exit a trade before SS does.
I must think about it.
|
gmg733 788 posts msg #119285 - Ignore gmg733 |
4/30/2014 11:15:00 AM
Nice work. Does the 'sell' mean long SH or short SPY?
|
cidrolin 21 posts msg #119287 - Ignore cidrolin |
4/30/2014 11:31:18 AM
When you're in "BullSystem", you only consider SPY.
So buy means "buy to open SPY" and sell means "sell to close SPY".
I edit the previous post.
|
dashover 226 posts msg #119289 - Ignore dashover |
4/30/2014 2:04:07 PM
Does the system on SS list the actual trades and dates etc?
|
gmg733 788 posts msg #119290 - Ignore gmg733 |
4/30/2014 2:39:59 PM
Making sense now. Sorry.
Looks good so far. But I haven't dug into it too much.
My assumption is you will probably create a new filter for the bear market or somehow incorporate into this one. I see you have the logic in the beginning (bull vs bear), but you are only looking for SPY only in the symlist. As you stated before, you have three possible positions, SPY, SH or cash.
Thanks.
|
cidrolin 21 posts msg #119295 - Ignore cidrolin |
5/1/2014 6:06:46 AM
The fastest way is use to use 2 filters.
BullSYSTEM :
Only active when boolean isbull is true.
You buy to open SPY at the next open following buy_to_open signal.
You sell to close SPY at the next open following sell_to_close signal.
You can have no position open (so being in cash).
BearSYSTEM :
Only active when boolean isbear is true.
You buy to open SPY or SH at the next open following buy_to_open signal.
You sell to close SPY or SH at the next open following sell_to_close signal.
You can have no position open (so being in cash).
I will think if I can combine it into a single filter
|