RSI-MACD-EMA Crossover buy signal

#1
Dear All

I have the AFL code for Buy/Sell signal for EMA, STO and RSI Crossover.
However when i plot this afl, Buy Sell arrows are not visible. Also when I scan the Formula in Analysis Section, I dont get the results. Can someone help me out on this. I need this badly.

--------------------------------------------------------------------------
_SECTION_BEGIN("STOCHA_RSI_EMA_SAR_4NP");
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() );

Sell = Short = Cross( EMA( Close, 34 ), EMA( Close, 12 )) AND (StochD(40 , 1, 1) < 50 ) AND (RSI(14) < 50);
Buy = Cover = Cross( EMA( Close, 12 ), EMA( Close, 34 )) AND (StochD(40 , 1, 1) > 50 ) AND (RSI(14) > 50);

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

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-1, High+1));
_SECTION_END();
--------------------------------------------------------------------------
Best regards and Happy New Year
 

amitrandive

Well-Known Member
#2
Dear All

I have the AFL code for Buy/Sell signal for EMA, STO and RSI Crossover.
However when i plot this afl, Buy Sell arrows are not visible. Also when I scan the Formula in Analysis Section, I dont get the results. Can someone help me out on this. I need this badly.

--------------------------------------------------------------------------
_SECTION_BEGIN("STOCHA_RSI_EMA_SAR_4NP");
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() );

Sell = Short = Cross( EMA( Close, 34 ), EMA( Close, 12 )) AND (StochD(40 , 1, 1) < 50 ) AND (RSI(14) < 50);
Buy = Cover = Cross( EMA( Close, 12 ), EMA( Close, 34 )) AND (StochD(40 , 1, 1) > 50 ) AND (RSI(14) > 50);

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

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-1, High+1));
_SECTION_END();
--------------------------------------------------------------------------
Best regards and Happy New Year

Arrows are plotting,Check the image and set the parameter of arrow on
Added Exploration for the code.


Code:
_SECTION_BEGIN("STOCHA_RSI_EMA_SAR_4NP");
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() );

Sell = Short = Cross( EMA( Close, 34 ), EMA( Close, 12 )) AND (StochD(40 , 1, 1) < 50 ) AND (RSI(14) < 50);
Buy = Cover = Cross( EMA( Close, 12 ), EMA( Close, 34 )) AND (StochD(40 , 1, 1) > 50 ) AND (RSI(14) > 50);

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

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-1, High+1));
_SECTION_END();

BuyPrice=ValueWhen(Buy, C);
SellPrice=ValueWhen(Sell, C);
 
 
Filter=Buy OR Sell ;
 
 
                SetOption("NoDefaultColumns", True);
                AddTextColumn(Name(), "Symbol", 77, colorDefault, colorDefault, 120);
                AddColumn(DateTime(), "Trigger Date", formatDateTime);
 
 
 
                AddColumn(IIf(Buy, 66, 83), "Signal", formatChar, colorYellow, IIf(Buy, colorGreen, colorRed));
               AddColumn(IIf(Buy, BuyPrice, SellPrice),  "Entry", 6.2);
 AddColumn(LastValue(C), "Entry Price.", 6.2);
_SECTION_END();