Hello guys pls help me add buy sell signal and exploration to this afl,the conditions are long over high of blue candle,short bellow low of red candle ,sl is high/low of 2 previous candle when there is a new low/high.The exploration should show the candle colour..
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() );
SetChartBkColor(colorBlack) ;
SetBarFillColor( IIf( C >O AND C>MA(C,21) AND C>EMA(C,8),colorBlack, IIf( C <O AND C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,IIf(( C<O AND C<MA(C,21) AND C>EMA(C,8)) OR ( C<O AND C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,IIf(( C>O AND C<MA(C,21) AND C>EMA(C,8)) OR ( C>O AND C>MA(C,21) AND C<EMA(C,8)) ,colorBlack,IIf( C>O AND C<MA(C,21) AND C<EMA(C,8) ,colorBlack,colorRed) )))));
Col=IIf( C<MA(C,21) AND C<EMA(C,8) ,colorRed,IIf( C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,IIf(( C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,colorYellow)));
Plot( C, "Close", col, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_BEGIN("MA2");
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();
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() );
SetChartBkColor(colorBlack) ;
SetBarFillColor( IIf( C >O AND C>MA(C,21) AND C>EMA(C,8),colorBlack, IIf( C <O AND C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,IIf(( C<O AND C<MA(C,21) AND C>EMA(C,8)) OR ( C<O AND C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,IIf(( C>O AND C<MA(C,21) AND C>EMA(C,8)) OR ( C>O AND C>MA(C,21) AND C<EMA(C,8)) ,colorBlack,IIf( C>O AND C<MA(C,21) AND C<EMA(C,8) ,colorBlack,colorRed) )))));
Col=IIf( C<MA(C,21) AND C<EMA(C,8) ,colorRed,IIf( C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,IIf(( C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,colorYellow)));
Plot( C, "Close", col, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_BEGIN("MA2");
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();