Hi,
Below is an AFL.
I would like to incoporate following conditions/options into the AFL.
1) BUY CONDITION: Green Arrow when MA (Close,50) crosses MA (Close,100) from below & goes up.
2) SHORT CONDITION: Red Arrow when MA (Close,100) crosses MA (Close,50) from below & goes up.
3) BUY EXECUTION: Buy at open of next candle after point 1 candle ; TARGET: 50 points; SL: 25 points
4) SHORT EXECUTION: Short at open of next candle after point 2 candle; TARGET: 50 points; SL 25 points
5) Draws automatically HORIZONTAL LINES for TARGET & SL with respective values as soon as BUY /SHORT is triggered.
6) Shows BUY@ PRICE ; SHORT@ PRICE on chart above candles of points 3 & 4.
7) VOICE ALERTS as soon as point 1 & 2 are met.
8) VOICE ALERTS as soon as TARGET or SL is hit.
9) POP-UPS as soon as point 1 & 2 are met.
10) POP-UPS as soon as point TARGET / SL is hit.
11) Back testing facility.
12) Scanning facility.
Thanks a lot.
AFL:
_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("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("MA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
A=MA(Close,50);
B=MA(Close,100);
Buy=Cross(A,B);
Sell=Cross(B,A);
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-50);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-50);