how to obtain time values ...

 

Let say, now there is an MACD crossover, how to record its time (the closing time of that particular bar), and later when i want to open a position, i want to know how far the current time is from that MACD crossover time? I want to open a trade only if the current time is less than 10 bars away from that MACD crossover. How to program it?

Many thanks to all the high hands for your kind help!

 
wang:

Let say, now there is an MACD crossover, how to record its time (the closing time of that particular bar), and later when i want to open a position, i want to know how far the current time is from that MACD crossover time? I want to open a trade only if the current time is less than 10 bars away from that MACD crossover. How to program it?

Many thanks to all the high hands for your kind help!

At the moment of crossover you save the time using Time[0] or TimeCurrent() and later you will need to use iBarShift() to count how many bars have passed since the crossover.