
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
Never hard code constants. Write self-documenting code.
Not compiled, not tested, just typed.
Not compiled, not tested, just typed.It looks like the bit shift is 14 not 15.
We can get the MQL4 equivalent minute values as follows:
We can get the MQL4 equivalent minute values as follows: PeriodSeconds(TF)/60
Here is one way. It might not be the best but it gets the job done.
There is no point to use the numeric values. Your code doesn't make sense even with MT4.
You probably need PeriodSeconds() function.
1. If there was no point to having the ENUM_TIMEFRAMES match the number of minutes represented in the bars on the chart then why would the developers have thought to do so in the first place.
2. Why not simply explain the reasoning behind the new method? If there is any. Why be rude?
3. I've personally used the fact that the numbers match the number of minutes per bar for multiple projects in MT4 and I wanted to convert them to MT5 so the change made that more difficult.
4. It's great that the developers had the foresight to make a function like Period Seconds but that just adds calculations to something that was simple. On a small scale it wouldn't make a noticeable difference but when back testing on a large scale it would add a significant amount of time to completion.
parse the ENUM variables to integer type. It will take care of any future changes to assigned constant values.
That is all it requires.
It looks like the bit shift is 14 not 15.
We can get the MQL4 equivalent minute values as follows:
Thanks @Jian Chen for the pointer!! I converted it to python to use in my work. And here is the reverse in python:
And a test script:
Giving: