JSParticipant
Senior
Hi,
True, there are differences, but these can possibly be overcome…
I myself am always struggling with dates and times and have experienced several times that unexpected situations occur…
When next Monday everything has to change to a new day, new week and a new month, I would be more surprised if you didn’t get an error message…
I made this proposal because this way is more “robust” and should not depend on 1 bar…
Not too sure how you can overcome the differences between <> and crosses over – under but in any cases the cause of the problem isn’t there.
As expected the system stopped this morning.
The line with the CROSSOVERS shows potential sources of error as the system has to compare the two prior values against the current value of PP.
You can replace the crossover with:
// c1 = (close[1] CROSSES UNDER pp) //perhaps c1 = (close[1] CROSSES UNDER pp[1]) ????
// replacement for the CROSSOVER (crossing under in this case)
c2 = (close[2] > pp) AND (close[1] < pp)
I can’t actually know what you want to achieve, but if you simply need to check that there’s been a crossover the prior candle, you could replace the line
c1 = (close[1] CROSSES UNDER pp) with:
c1 = (close CROSSES UNDER pp)
// then you can refer to c1[1] to know whether a crossover occurred the prior candle)