There are no M2, M20 & H2 timeframes in MT4, so obviously you won't get a value.
Thanks for that answer @Keith Watford. I know that, but in the mql4 doc for enum_timeframes it says:
Note
The constants of non-standard timeframes are included in the MQL4 language to enable translation and compilation of MQL5 programs, where these timeframes are standard and are included in the ENUM_TIMEFRAMES enumeration.
So it's here to translate from mql5 to mql4 but it can't work?

- docs.mql4.com
If you know that those timeframes don't exist in MT4 why would you expect them to work in an iMFI() call or anything for that matter?
There is no timeframe data for those timeframes.
If you know that those timeframes don't exist in MT4 why would you expect them to work in an iMFI() call or anything for that matter?
There is no timeframe data for those timeframes.
I thought it was simple calculations.
Thanks for the answer

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I have a problem to translate MQL indicators from MQL5 to MQL4. (https://docs.mql4.com/constants/chartconstants/enum_timeframes)
For the example, I will use iMFI (https://docs.mql4.com/indicators/imfi)
With a simple print, I can see that MQL5 timeframes are not loaded (M2, M20, H2) but MQL4 timeframes are loading correctly (M1, H1).
Print("m1: "+ DoubleToString( iMFI(_Symbol, PERIOD_M1, 12, 0),2) + ", " + DoubleToString( iMFI(_Symbol, PERIOD_M1, 12, 1),2) + ", " + DoubleToString( iMFI(_Symbol, PERIOD_M1, 12, 2),2) );
Print("m2: "+ DoubleToString( iMFI(_Symbol, PERIOD_M2, 12, 0),2) + ", " + DoubleToString( iMFI(_Symbol, PERIOD_M2, 12, 1),2) + ", " + DoubleToString( iMFI(_Symbol, PERIOD_M2, 12, 2),2) );
Print("m20: "+ DoubleToString( iMFI(_Symbol, PERIOD_M20, 12, 0),2) + ", " + DoubleToString( iMFI(_Symbol, PERIOD_M20, 12, 1),2) + ", " +DoubleToString( iMFI(_Symbol, PERIOD_M20, 12, 2),2) );
Print("h1: "+ DoubleToString( iMFI(_Symbol, PERIOD_H1, 12, 0),2) + ", " + DoubleToString( iMFI(_Symbol, PERIOD_H1, 12, 1),2) + ", " + DoubleToString( iMFI(_Symbol, PERIOD_H1, 12, 2),2) );
Print("h2: "+ DoubleToString( iMFI(_Symbol, PERIOD_H2, 12, 0),2) + ", " + DoubleToString( iMFI(_Symbol, PERIOD_H2, 12, 1),2) + ", " + DoubleToString( iMFI(_Symbol, PERIOD_H2, 12, 2),2) );
As you can see below, M2, M20 & H2 stay at 0.
Can somebody explain me why this is not working for the MQL5 timeframes and how to make it work?
Thank you,
Arthur