hey everyone, i d like to count that condition via barssince , how could i do that ?
If(Stoch(14,3)>=20 AND Stoch(14,3)<30,1,0) , i d like to see how many bars between that condition, if not plot 0 , if yes plot count number
Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
Hello,
It might be best to combine ValueWhen and Cumulate functions. You would need to subtract the two conditions from each other, although depending on which one comes first, this could generate a positive or negative count.
ValueWhen(1,Stoch(14,3)>=20,Cum(1)) - ValueWhen(1,Stoch(14,3)<30,Cum(1));
If you want the number to always be expressed as a positive, you could wrap the Absolute Value function around the above.
Abs(ValueWhen(1,Stoch(14,3)>=20,Cum(1)) - ValueWhen(1,Stoch(14,3)<30,Cum(1)));