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

[amibroker] Simple formula help please



PureBytes Links

Trading Reference Links



I am trying to buy if the close is less than 90% of the close 2 days ago and sell 20 days later (my formula below). As the chart above shows the 1st buy arrow but no sell arrows. When I run backtest it shows the sell 20 bars later as it should. Can anyone help me as to why the sell arrow does not display? I assume that as there is not sell arrow then there are no subsequent buy.

I am sure it is a stupid mistake on my part but I cannot see it!

Thanks....Keith


// Buy on the Dips system //

Filter = 1;

SetOption("initialequity", 200000);
SetOption("maxopenpositions", 15);
SetTradeDelays(1,1,1,1);
SetChartOptions(1,Chartshowarrows);
PositionSize = 20000;

CLdown = Optimize("% Down", 0.90,0.75,1.0,0.025);

Buy = Close < CLdown * Ref(Close,-2);
Sell = 0;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

ApplyStop(stopTypeNBar, stopModeBars, 20);

Plot(Close, "Close", colorRed,styleBar);
PlotShapes(shapeUpArrow * Buy + shapeDownArrow * Sell, IIf(Buy, colorBrightGreen, colorYellow));



Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Yahoo! Groups Sponsor
ADVERTISEMENT


Yahoo! Groups Links