Need Help on Creating Simple AFL Scanner

#1
Hi Friends,

I need an AFL which give us Buy and Sell Signal when the following conditions are met.

Buy if Candle Close above 13ema and 35ema.
Sell if Candle Close below 13ema and 35ema.

Please help on this afl program.

Thanks in Advance.
Vijayan
 

pkgmtnl

Well-Known Member
#2
Hi Friends,

I need an AFL which give us Buy and Sell Signal when the following conditions are met.

Buy if Candle Close above 13ema and 35ema.
Sell if Candle Close below 13ema and 35ema.

Please help on this afl program.

Thanks in Advance.
Vijayan


_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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();


_SECTION_BEGIN("ema_crossover");
x = EMA(Close,13);
y = EMA(Close,35);
Plot(EMA(Close,13),"",colorRed,styleLine);
Plot(EMA(Close,35),"",colorDarkGreen,styleLine);

Buy=Cross(x,y);
PlotShapes(shapeUpArrow*Buy,colorGreen);
XR=(EMA(Close,13) * (2 / 6 - 1) - EMA(Close,35) * (2 / 11 - 1)) / (2 / 6 - 2 / 11);
Title = Name() + " " + Date()+" " + EncodeColor( colorBlue ) +"13/35 EMA " +EncodeColor( colorRed )
+ " O " + O + " H " + H + " L " + L + " C "+ C + "\n";

Sell=Cross(y,x);
PlotShapes(shapeDownArrow*Sell,colorRed);
XR=(EMA(Close,35) * (2 / 6 - 1) - EMA(Close,13) * (2 / 11 - 1)) / (2 / 6 - 2 / 11);
Title = Name() + " " + Date()+" " + EncodeColor( colorBlue ) +"35/13 EMA " +EncodeColor( colorRed )
+ " O " + O + " H " + H + " L " + L + " C "+ C + "\n";

_SECTION_END();
 
#3
_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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();


_SECTION_BEGIN("ema_crossover");
x = EMA(Close,13);
y = EMA(Close,35);
Plot(EMA(Close,13),"",colorRed,styleLine);
Plot(EMA(Close,35),"",colorDarkGreen,styleLine);

Buy=Cross(x,y);
PlotShapes(shapeUpArrow*Buy,colorGreen);
XR=(EMA(Close,13) * (2 / 6 - 1) - EMA(Close,35) * (2 / 11 - 1)) / (2 / 6 - 2 / 11);
Title = Name() + " " + Date()+" " + EncodeColor( colorBlue ) +"13/35 EMA " +EncodeColor( colorRed )
+ " O " + O + " H " + H + " L " + L + " C "+ C + "\n";

Sell=Cross(y,x);
PlotShapes(shapeDownArrow*Sell,colorRed);
XR=(EMA(Close,35) * (2 / 6 - 1) - EMA(Close,13) * (2 / 11 - 1)) / (2 / 6 - 2 / 11);
Title = Name() + " " + Date()+" " + EncodeColor( colorBlue ) +"35/13 EMA " +EncodeColor( colorRed )
+ " O " + O + " H " + H + " L " + L + " C "+ C + "\n";

_SECTION_END();
WOW.. Thanks lot for the quick response... One more request... If you dont mind, can you change the code for the below condition.

Instead of 13EMA and 35 EMA, I need 9EMA,50EMA, with heikin Ashi Candle Close Basis.

Thanks in Advance
 

Similar threads

Broker Special Offers

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Name:Phone:
Email:City:
State:
Are you a day trader?