I'm attempting to set a bool flag on an instance of a crossover. Here is the code:
if (CrossAbove(DinapoliStochastic(6, 6, 14).LineK, DinapoliStochastic(6, 6, 14).LineD, 10)
&& DinapoliStochastic(6, 6, 14).LineD[0] > 20
&& DinapoliStochastic(6, 6, 14).LineD[0] < 50)
{
DrawSquare("DSLong" + CurrentBar, true, 0, High[0] + 2, Color.DarkGoldenrod);
DSMiddleLong = true;
What I'm finding is the Dot/Flag is getting set not just on the crossover instance, but all the time the LineK > LineD. So the crossover may have occurred < 20 or > 50 but if the lines pass above 20 or below 50 I'll still get the dot and my flag is setting at times that I don't want it. Any suggestions on how I could just get the moment of the crossover and not the continuation?
Thanks
Comment