I am trying to have Amibroker backtest "execute" on prices that are 
something other than Open, Low, High, Close or Average (as specified 
in Backtester settings under Trade tab).  I expected the code below, 
using BuyPrice variable to force backtesting to operate on my fixed 
values of x and y below (as described in Controlling trade price of 
the 5.0 User's Guide).  Can anyone help me understand why this still 
operates on Close price (my current backtester settings).





//I am trying to get this to place buy trade at x (43.34) and sell
//trade at 43.28.  It is still trading at Close price instead.

x = 43.34;
y=43.28;


period = 5;
Plot(MA(C,period),"ma5",colorBlue,styleLine);
PlotOHLC(O,H,L,C,"OHLC",colorBlack,styleCandle);
Plot(x,"x",colorRed,styleLine);
Plot(y,"y",colorRed,styleLine);

BuyPrice = x;
SellPrice = y;
Buy = C > MA(C,period);
Sell = C < MA(C,period);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(Buy*shapeUpArrow,colorGreen);
PlotShapes(Sell*shapeDownArrow,colorRed);



Reply via email to