Greetings: I've only had this happen a few times, but I run an optimization,
choose the best parameters, insert them as the new default values and run
another backtest. 98% of the time, with all my different strategies, I can
duplicate the optimized results, which is obviously what should happen.
However, on a few occasions, I follow those steps and get results not even
close to the optimized values.
I'm assuming there is something wrong with the simple code I use in this
strategy. Maybe something with the "Buy" or "SELL" segment and not properly
using "CROSS." Being a newbie to AmiBroker, I can't see the problem, but I'm
sure someone with good afl skills will probably immediately spot it:
EMAShortBuy=Optimize("EMAShortBuy",10,4,10,2);
EMALongBuy=Optimize("EMALongBuy",50,20,60,10);
StochRange1=Optimize("StochK1",20,10,40,10);
StochRange2=Optimize("StochK2",2,1,3,1);
Buy = Cross(EMA( Close,EMAShortBuy ),EMA( Close,EMALongBuy ));
Sell = StochK(StochRange1,StochRange2)>75;
Short = 0;
Cover = 0;
Plot( EMA ( Close,10 ),"Short EMA", colorGreen, styleThick );
Plot( EMA ( Close,50 ),"Long EMA", colorRed, styleThick );
Plot( StochK ( 25,2 ),"stochk", colorBlue, styleThick );
/* max loss stop optimization */
ApplyStop(stopTypeLoss,
stopModePercent,
Optimize( "max. loss stop level", 0, 2, 10, 2 ),
True );
ApplyStop(stopTypeTrailing,
stopModeRisk,
Optimize( "trailing loss stop level", 0, 10, 90, 10 ),
True );
Any ideas are welcomed.