Is there any way to test in a trade script then we are nearing the Macd cross over.
We can of course always determine when there is a crossover. But I am trying to find a region when there is an approximate crossover.
The reason is that when we are looking at combining various factors with MACD crossover, there would be statistically very less instances when there is an exact MACD crossover. What perhaps would be useful is when the line is just nearing the crossover. Which essentially means it is the distance between the signal line and the MACD line is very less (how less needs to be quantified) and the MACD line slope is positive. (that is trending up).
But I am not sure how to code this exactly. This must be a common problem so hoping that there would be a standard solution for this.
Thank you for any inputs