I would like to index the last 5 minutes from any current point
if current minute is 50 (CurMin) then last 5 (N) by index:
1 = 452 = 463 = 474 = 485 = 49
It's just CurMin-N+Index
But if current minute is 2 (CurMin) then last 5 (N) by index:
5 = 1
How can this be put in a formula? I think I need to work with MathMod().
You don't index time. Simply subtract 5 minutes (300) from current time (TimeCurrent.)
You index bars. Once you have the time you can find the M1 bar that corresponds with iBarShift.