What shifts to use for coding crossovers?

 

Should I be using shift 0 and 1 or 1 and 2?

 
booboothefool:

Should I be using shift 0 and 1 or 1 and 2?

if you use shift 0 and 1, you are working with the current bar. This means that your code may detect a cross, but by the time the bar closes, the cross may have reversed.

For this reason, most coders prefer to use 1 and 2 so that the cross is confirmed.

 
booboothefool :

Should I be using shift 0 and 1 or 1 and 2?

If you are using high timeframes (H4 and higher) you should use 0 and 1.

I am unsure about the H1 timeframe, you can use both.

At a timeframe lower than H1, it would be better if you use 1 and 2.