Sir, Please help me in coding this AFL for amibroker
BUY = Candle closes above 10 SMA ( HIGH)
SELL = Candle closes below 10 SMA (LOW)
PROFIT/TARGET = 0.75% From buy or sell rate
Thanks
Sir, Please help me in coding this AFL for amibroker
BUY = Candle closes above 10 SMA ( HIGH)
SELL = Candle closes below 10 SMA (LOW)
PROFIT/TARGET = 0.75% From buy or sell rate
Thanks
For the above given condition check this AFL code
SetChartOptions(0,chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); Buy = Cross (Close, MA( High, 10 )) ; Sell = Cross (MA( Low, 10 ), Close) ; Short = Sell; Cover = Buy; //Buy = Ref(Buy,-1); //Short = Ref(Short,-1); PlotShapes(IIf(Buy, shapeHollowUpArrow, shapeNone),colorGreen, 0,L, Offset=-30); PlotShapes(IIf(Short, shapeHollowDownArrow, shapeNone),colorRed, 0,H, Offset=-30); Plot( MA( High, 10 ),"med ema", colorRed,styleThick); Plot( EMA( Low, 10 ),"long ema", colorBlue,styleThick); _SECTION_END();
thanks for the reply, this is working but it is giving signals repeatedly, eg. when a buy signal comes after we get a candle close above 10sma(high) and the price closes below 10sma(high), and then the price closes again above 10sma(high), where as it should run as a first buy signal unless we get a close below 10sma(low)…