I have made a code to identify the accumulation phase as follows:
ratio1 = 0.05;
ratio2 = 0.07;
ratio3 = 0.1;
function GetLength(r, Minp, Maxp, Length, i)
{
Minp = Min(Minp, Ref(Close, -i));
Maxp = Max(Maxp, Ref(Close, -i));
x = (Maxp/Minp) - 1;
if(x > r)
return Length;
Length++;
i++;
return GetLength(r, Minp, Maxp, Length, i);
}
len1 = 15;
len2 = 20;
Len3 = 60;
Minp = Close;
Maxp = Close;
Length = 1;
i = 1;
d1 = GetLength(ratio1, Minp, Maxp, Length, i);
d2 = GetLength(ratio2, Minp, Maxp, Length, i);
d3 = GetLength(ratio3, Minp, Maxp, Length, i);
Filter= (d1 >= Len1 OR d2 >= Len2 OR d3 >= Len3) AND MA(Volume, 20) >= 20000;
AddColumn(d1 , "5%", 1, colorWhite, IIf(d1 >= len1, colorLime, colorWhite));
AddColumn(d2 ,"7%", 1, colorWhite, IIf(d2 >= Len2, colorLime, colorWhite));
AddColumn(d3 ,"10%", 1, colorWhite, IIf(d3 >= Len3, colorLime, colorWhite));
but when you run this code, it is always an error as follows:"Condition in IF, WHILE, FOR statements has to be Numeric or Boolean type. You can not use array here, please...". This problem was identified in the code:"if(x > r)".
I do not know how correct, expect people to help.
Thanks
ratio1 = 0.05;
ratio2 = 0.07;
ratio3 = 0.1;
function GetLength(r, Minp, Maxp, Length, i)
{
Minp = Min(Minp, Ref(Close, -i));
Maxp = Max(Maxp, Ref(Close, -i));
x = (Maxp/Minp) - 1;
if(x > r)
return Length;
Length++;
i++;
return GetLength(r, Minp, Maxp, Length, i);
}
len1 = 15;
len2 = 20;
Len3 = 60;
Minp = Close;
Maxp = Close;
Length = 1;
i = 1;
d1 = GetLength(ratio1, Minp, Maxp, Length, i);
d2 = GetLength(ratio2, Minp, Maxp, Length, i);
d3 = GetLength(ratio3, Minp, Maxp, Length, i);
Filter= (d1 >= Len1 OR d2 >= Len2 OR d3 >= Len3) AND MA(Volume, 20) >= 20000;
AddColumn(d1 , "5%", 1, colorWhite, IIf(d1 >= len1, colorLime, colorWhite));
AddColumn(d2 ,"7%", 1, colorWhite, IIf(d2 >= Len2, colorLime, colorWhite));
AddColumn(d3 ,"10%", 1, colorWhite, IIf(d3 >= Len3, colorLime, colorWhite));
but when you run this code, it is always an error as follows:"Condition in IF, WHILE, FOR statements has to be Numeric or Boolean type. You can not use array here, please...". This problem was identified in the code:"if(x > r)".
I do not know how correct, expect people to help.
Thanks