
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
It should work with W1.
Er, no. Thinking about it, it will round to a Thu-Wed week, not Sun-Sat. The following should work on all periods:
This works well for the low /medium timeframes, however I'm not sure it will map correctly to the Weekly and Monthly boundaries
v3 attached, changing the RoundTime() function as above, and adding another couple of improvements (described in notes in the code's header).
I also profiled it and the overhead is smaller than I expected.
It's faster than I was expecting. For example, the performance of its internal MTF_iBarShift seems extremely close to that of MT4's own iBarShift - around half a microsecond per call, on my computer.
I had wondered whether storing the bar table in a hashtable might be a better approach, but I don't believe that anything written in and reliant on MQL4 is going to match the speed which it gets from being able to use the platform's own native-code ArrayBsearch.