Hi,

I have been going cross-eyed with this for days, so I am hoping someone can 
point me in the right direction.

I am trying a system that buys/sells on a stochastic cross. However when I 
examine the backtest output, I cannot reconcile the MAE% figure with the 
simulated trade data.


Here is the code:

//enter at close of bar
SetTradeDelays(0,0,0,0); 
BuyPrice = C;
SellPrice = C;
ShortPrice = C;
CoverPrice = C;


//Stochastic indicator

Userfriendly = Param("User Friendly Variable",1,1,50,1);
periods = Param( "Periods", 15, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
StoD = StochD( Userfriendly*periods , Userfriendly*Ksmooth, 
Userfriendly*DSmooth);
StoK = StochK( Userfriendly*periods , Userfriendly*Ksmooth);

//-----------------------------------------------

// buy & Sell conditions

Buy = Cover = Cross(StoK,StoD);
Sell = Short = Cross(StoD,StoK);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);


Plot(C,"C",colorBlack,styleCandle);
Plot( StoD, "StoD", colorBlue, styleLine|styleLeftAxisScale);
Plot( StoK,"StoK", colorRed,styleLine|styleLeftAxisScale);

////////////END/////////////////////////////////////


As an example, when I run the backtest on ticker SKI.AX I get a long entry @ 
$1.33 on Jan29 – 2010 with an exit @ $1.31 Feb8. Reported MAE of 1.5%.

When I check the chart I get trade open $1.33 and trade low of $1.30 (Feb8) 
giving a MAE of $0.03c or 2.25%. 

Checking other trades gives similar results. All the MFEs I have checked seem 
ok.

Does anyone have any pointers for me?


Thanks
Chris


Reply via email to