How do you code ideas that keep track of things that happened in the past?
For example if LineA > LineB, you know LineA crossed from below to above LineB at some point, but when?

And how would you do the "below to above" part?

They cross when LineA.value === LineB.value, but would you have to store the previous candle to know if it is coming from below to above or above to below?

Is there an easy way to do previous N candles or get the time at and time since the last cross happened?
Use an array.
Populate the array with your indicator results.
Then compare.

Forum Jump:

Users browsing this thread: