Hi,
Hoping someone can help me.
I have been trying to create an exploration which computes the number
of days 3 moving averages are above each other ( Bill Williams
alligator).
I have coded the following but getting an endless loop
condition...see code below.
Could someone kindly explain to me what I am doing incorrectly.
Might there be an easier methof to do this?
Thank you in advance for your consideration.
Tony
outsidebar = Outside();
insidebar = H <= Ref(H,-1) AND L >= Ref(L,-1);
upbar = H > Ref(H,-1) AND L >= Ref(L, -1);
downbar = L < Ref(L,-1) AND H <= Ref(H,-1);
barcolor=IIf(outsidebar, 1, IIf(downbar, 4, IIf(upbar,27, 6) ) );
A=((H+L)/2);
AlligatorBlue=Ref(Wilders(A,13),-8);
AlligatorRed=Ref(Wilders(A,8),-5);
AlligatorGreen=Ref(Wilders(A,5),-3);
Continue_check= 365;
CheckAlligator= 1;
NumberOfDays = 0;
for ( i=0; i < Continue_check ; i--)
{
CheckAlligator =IIf( Ref(AlligatorGreen,i) > Ref(AlligatorRed,i),1,
IIf(Ref(AlligatorRed,i) > Ref(AlligatorBlue,i )
,1,0) );
if (CheckAlligator = 1 )
NumberOfDays = 1 + NumberOfDays;
else
i== 365;
}// end for loop
Filter = C > 1;
AddColumn(NumberOfDays , "NumberOfDays ");
AddColumn(Close , "Close");
AddColumn(AlligatorGreen, "AlligatorGreen");
AddColumn(AlligatorRed, "AlligatorRed");
AddColumn(AlligatorBlue, "AlligatorBlue");