create simple afl

Abhi1284

Active Member
#1
please create bellow condition in afl

buy = close > 50ma and macd > 0 and stoch k > 80
sell = close < 50ma and macd < 0 and stoch k < 80

Abhishek
 

Abhi1284

Active Member
#4
_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();

a=MA(C,50);
b=MACD();
d= StochK();
Plot(a,"50ma",colorRed,styleLine);
Buy = C>a AND b>0 AND d>80;
Sell = C<a AND b<0 AND d<20;

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

PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-20);
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-30);

want to add sl previous three bar high low when signal genrated

Abhishek
 

Similar threads