StockFetcher Forums · Filter Exchange · A set of trading rules regarding SPY and SH :<< 1 2 3 4 >>Post Follow-up
35 posts
msg #119297
Ignore frsrblch
5/1/2014 10:18:43 AM

It's always great to see simple filters presented for analysis, especially with full backtesting and analysis. I look forward to modelling it in Excel this weekend, and I'll be sure to share my results.

21 posts
msg #119406
Ignore cidrolin
5/7/2014 8:09:20 AM

I have « merged » the two previous filters. Then I’ve done a study focusing on coupounded annual return and consistency of Monte-Carlo average return when shifting numerical parameters.

I end up with this set of rules, regarding SPY and SH :

Stratasearch entry code
// is bear ?
((mov(symbol(^spx,close),10,Simple) < mov(symbol(^spx,close),200,Simple)) and
//entry SPY or SH
(cmf(14) < 0))
// is bull ?
((mov(symbol(^spx,close),10,Simple) > mov(symbol(^spx,close),200,Simple)) and
//choose SPY only
(mov(close,10,Simple) > mov(close,200,Simple)) and
//entry SPY
(adx(8) > pdi(8) or adx(8) > mdi(8)) and
(symbol(^VIX, qst(12)) < 0)))

Stratasearch exit code
// is bear ?
((mov(symbol(^spx,close),10,Simple) < mov(symbol(^spx,close),200,Simple)) and
(cmf(14) > 0))
// is bull ?
((mov(symbol(^spx,close),10,Simple) > mov(symbol(^spx,close),200,Simple)) and
(adx(8) < pdi(8) and adx(8) < mdi(8)))

Running these rules against SPY and SH from 01/01/2007 to 05/07/2014 leads to CAR of 41%, a max drawdown of 16 %, whereas the Montecarlo average annual return is 76% (and very consistent with respect to parameter shifting).

XXX equity
hébergeur d image gratuit

XXX report
hebergeur gratuit

Hébergeur d'images

I have tried to translate it to a stockfetcher filter

draw ma(10)
draw ma(200)
set{isBull, count(cma(ind(^SPX,close),10) > cma(ind(^SPX,close),200),1)}
set{isBear, count(cma(ind(^SPX,close),10) < cma(ind(^SPX,close),200),1)}
add column isBull
draw isBull
/* buy in BEAR market */
set{buy_bear0,count(cmf(14) < 0,1)}
set{buy_bear1,buy_bear0 * isBear}
set{buy_bear2,count(buy_bear1 > 0,1)}
/* buy in BULL market */
set{qstickvix, IND(^VIX,QStick(12))}
set{buy_bull0,count(qstickvix < 0,1)}
set{buy_bull1,count(round(ADX(8)) > round(PDI(8)),1)}
set{buy_bull2,count(round(ADX(8)) > round(MDI(8)),1)}
set{buy_bull3,buy_bull1 + buy_bull2}
set{buy_bull4, buy_bull3 * buy_bull0}
set{buy_bull5, buy_bull4 * isBull}
set{isSPYinBull, count(ma(10) > ma(200),1)}
set{buy_bull6, buy_bull5 * isSPYinBull}
set{buy_bull7,count(buy_bull6 > 0,1)}
/* buy ? */
set{buy_to_open0, buy_bear2 + buy_bull7}
set{buy_to_open,count(buy_to_open0 > 0,1)}
draw buy_to_open
/* sell in BEAR market */
set{sell_bear0,count(cmf(14) > 0,1)}
set{sell_bear1,sell_bear0 * isBear}
set{sell_bear2,count(sell_bear1 > 0,1)}
/* sell in BULL market */
set{sell_bull1,count(round(ADX(8)) < round(PDI(8)),1)}
set{sell_bull2,count(round(ADX(8)) < round(MDI(8)),1)}
set{sell_bull3,sell_bull1 * sell_bull2}
set{sell_bull4, sell_bull3 * isBull}
set{sell_bull5,count(sell_bull4 > 0,1)}
/* sell ? */
set{sell_to_close0, sell_bear2 + sell_bull5}
set{sell_to_close,count(sell_to_close0 > 0,1)}
draw sell_to_close]

However, the trades are differents from those indicated by Stratasearch. Can someone help me to check if there is an error in my SF script ?

XXX dates
hébergeur images

Thanks in advance.

21 posts
msg #119407
Ignore cidrolin
5/7/2014 8:14:37 AM

I don't know why the filter is not clickable. I used Fetcher followed by [ and ].

35 posts
msg #119429
Ignore frsrblch
5/7/2014 1:02:46 PM

Compare the results from your SF backtest with what the filter itself tells you to do, and what the SF backtest did with the results from the SF filter. I don't trust the SF backtest results as well as I trust the SS or my own coding in Excel.

894 posts
msg #119438
Ignore mahkoh
5/7/2014 3:08:53 PM

Your filter probably has too many nested if statements for me to be able to run it with my basic subscription.

334 posts
msg #119683
Ignore jackmack
5/13/2014 1:49:19 PM

frsrblch - how did your spreadsheet work out?

35 posts
msg #119704
Ignore frsrblch
5/14/2014 9:43:52 AM

I haven't had as much time as I would have liked for this one, so it's a little crude. I executed trades using SSO and 1/SSO because I wanted leverage but didn't take the time to add in data from SDS. It won't load properly in your browser; you'll have to download it and open in Excel.

334 posts
msg #119705
Ignore jackmack
5/14/2014 9:48:18 AM

Can anyone explain why prior to 2008 the results are not as good?
I am not a scientist (as some of you are here) and cannot figure the difference in one
time period vs. another - post 2008 vs. pre 2008 (say 2000 - 2005).
Thank you and I am VERY MUCH looking forward to your findings.

21 posts
msg #119870
Ignore cidrolin
5/15/2014 4:05:41 PM


It' seems that your coding in excel is confirming my study in SS, though with your 2x leverage results are more dramatic.

My feeling is that the bearish part of my system is well rendered by SF (cmf(14)), whereas the bullish part (adx) is not correct in SF.

@ jackmack

I really don't know why the system is not well performing before 2008. To be honest, I have no access to SH in stratasearch before 2008, so I have not done the test in bear market. I can try.

623 posts
msg #119872
Ignore gmg733
5/15/2014 6:25:26 PM

I like it. I like it a lot. Simple!

What prompted you to look at the ^VIX as an entry part of your filter. Just curious.


StockFetcher Forums · Filter Exchange · A set of trading rules regarding SPY and SH :<< 1 2 3 4 >>Post Follow-up

*** Disclaimer *** does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. does not recommend particular securities., Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.

Copyright 2016 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus