Line_Trader: I would like to index the last 5 minutes from any current point
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.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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 = 45
2 = 46
3 = 47
4 = 48
5 = 49
It's just CurMin-N+Index
But if current minute is 2 (CurMin) then last 5 (N) by index:
1 = 572 = 58
3 = 59
4 = 0
5 = 1
How can this be put in a formula? I think I need to work with MathMod().
Thanks.