cidrolin 21 posts msg #119406 - Ignore cidrolin modified |
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))
or
// 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))
or
// 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).
hébergeur d image gratuit
hebergeur gratuit
Hébergeur d'images
I have tried to translate it to a stockfetcher filter
FETCHER[
symlist(SPY,SH)
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 ?
hébergeur images
Thanks in advance.
|