simple but profitable AFL

#1
Can experts translate this simple ts,simple but profitable.
Thanks


Var = mom,media;

installstoploss(inperc,3,"stoploss");

mom=momentum(C,200,D);
media=mov(C,200,e);

if positiondir=0 AND V>V[1] then
if mom>0 AND C>media then
enterlong(nextbar,atopen);
endif;
if mom<0 AND C<media then
entershort(nextbar,atopen);
endif;
endif;

if positionlong AND mom<0 then
exitlong(nextbar,atopen);
endif;

if positionshort AND mom>0 then
exitshort(nextbar,atopen);
endif;
 

tlu

New Member
#2
Try this:

settradedelays( 1, 1, 1, 1 );
BuyPrice=SellPrice=ShortPrice=CoverPrice=O;
mom=roc(C,200);
media=ema(C,200);
Buy= v> ref(v,-1) AND mom>0 AND c>media;
Short=v> ref(v,-1) AND mom<0 AND c<media;
Sell=mom<0;
Cover=mom>0;
ApplyStop(stopTypeLoss,stopModePercent,3);
 
#3
As a relative newbie to system testing I was interested in this and it does quite well when optimized - the best period for the ROC and EMA indicators seems to be somewhere in the 50-70 day range. It returns 10-13%/yr on the SPX during a net flat stretch from August 2006 to the present Jan 2011 that starts and ends around 1300 but has a large bear swing in the middle. Results are similar when we go back further, e.g. 1990-present. Does even better on Nasdaq-100 although that index wasn't flat during 2006-2011. Used a 3% stop and $5 commissions.

Interesting that it uses an increase in volume to trigger trades - does that often improve systems?
 
#4
not worked

errors :


settradedelays( 1, 1, 1, 1 );
BuyPrice=SellPrice=ShortPrice=CoverPrice=O;
mom=roc(C,200);
media=ema(C,200);
Buy= v> ref(v,-1) AND mom>0 AND c>media;
Short=v> ref(v,-1) AND mom<0 AND c<media;
Sell=mom<0;
Cover=mom>0;
ApplyStop(stopTypeLoss,stopModePercent,3);
 

Similar threads