Hello Members
Request coding help for Buy / Sell signal based on
Buy Condition:
Close > EMA(5) and
AccDist > MA(AccDist,15)
Sell Condition:
Close < EMA(C,5) and
MA(AccDist,15) < AccDist
Note : Buy / Sell arrows to be in a single window which shows price and EMA(5) only. Also, SCAN/EXPLORE option, if possible, in the same AFL would be highly appreciated.
I tried combining 2 separate AFL's into one, which did not work - as follows :
_SECTION_BEGIN("Price");
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() );
_SECTION_END();
_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
//Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("AccDist");
//Plot( AccDist(), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
CandleBuy = Cross(Close, EMA(Close,50));
CandleSell = Cross(EMA(Close,50), Close);
AccDistSell = Cross(AccDist(), MA(AccDist(),15));
AccDistBuy = Cross(MA(AccDist(),15), AccDist());
PlotShapes(IIf((CandleSell and AccDistSell)==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);
PlotShapes(IIf((CandleBuy and AccDistBuy)==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-15);
Request coding help for Buy / Sell signal based on
Buy Condition:
Close > EMA(5) and
AccDist > MA(AccDist,15)
Sell Condition:
Close < EMA(C,5) and
MA(AccDist,15) < AccDist
Note : Buy / Sell arrows to be in a single window which shows price and EMA(5) only. Also, SCAN/EXPLORE option, if possible, in the same AFL would be highly appreciated.
I tried combining 2 separate AFL's into one, which did not work - as follows :
_SECTION_BEGIN("Price");
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() );
_SECTION_END();
_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
//Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("AccDist");
//Plot( AccDist(), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
CandleBuy = Cross(Close, EMA(Close,50));
CandleSell = Cross(EMA(Close,50), Close);
AccDistSell = Cross(AccDist(), MA(AccDist(),15));
AccDistBuy = Cross(MA(AccDist(),15), AccDist());
PlotShapes(IIf((CandleSell and AccDistSell)==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);
PlotShapes(IIf((CandleBuy and AccDistBuy)==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-15);