[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Buyprice question



PureBytes Links

Trading Reference Links

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);





Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/