i have a afl triangular , i slightly modified it to get signals
i want signal every time a green dot appears for two consecutive
times and if after one green dot a red appers the previous is green is to
be nullified and it has to wait again for two green dots in a sequence.( the
other way for red dots also)
BUT
afl gives redundant signal
see file attached
what is to be incorporated to filter this ,
I know somethingis missing tried hard
This is a traingular moving average ( afl library) slightly
modified by me
Odd=13;//enter Odd numbers only
CoefOdd=round(Odd/2);
Even=12;//enter Even numbers
only
Coefeven=Even/2;
Coefeven2=Coefeven+1;
CongestionPercent=2.8;/*Set
% above/below Moving average for congestion / sideways market*/
TriangularOdd=MA(MA(C,CoefOdd),CoefOdd);
TriangularEven=MA(MA(C,Coefeven),Coefeven2);
finalMov_avg=IIf(Odd > even,triangularOdd,TriangularEven);
colordots = IIf(finalMov_avg < L,colorBrightGreen,IIf(finalMov_avg
> H,colorRed,colorWhite));
Buy = Cross(C,finalMov_avg); Buy = Ref(Buy,-1); BuyPrice = O;
Sell =
Cross(finalMov_avg,C); Sell = Ref(Sell,-1); SellPrice = O;
SetBarsRequired(-2,-2);
SetChartOptions(0,
chartShowDates);
Plot(C,"\nClose",colorWhite,64);
Plot(finalMov_avg,"\finalMov_avg",colordots,styleDots|styleNoLine);
Color=colorBrightGreen;//select Moving average line
color
tickercolor=colorBlack;//select price color
Plot(finalMov_avg,"",IIf(C <
finalmov_avg,colorRed,Color),styleLine|styleThick);
Plot(C,"",tickercolor,styleCandle);
Short = Sell;
Cover = Buy;
Buy = ExRem(Buy,Sell);
Sell=
ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
Please help out