input timeframe InpTF = H4;
Soheil Hossein:
Hi.
I just migrate from mql4 to mql5 and I can't define timeframe as input and initializing it.
Can anyone help me to do that?
Thank you so much.
No need to create a new enumeration.
The solution is the same in MQL4 and MQL5
input ENUM_TIMEFRAMES timeframe = PERIOD_H4; // Timeframe for MACD int OnInit() { macdHandle = iMACD(_Symbol, timeframe, 12, 26, 9, PRICE_CLOSE); }
- Fernando Morales: No need to create a new enumeration.
Unless you want to restrict the valid timeframes to just those listed.
-
Why did you post your MT5 question in the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum?
Next time post in the correct place. The moderators will likely move this thread there soon. -
macdHandle = iMACD(_Symbol, PERIOD_H4, 12, 26, 9, PRICE_CLOSE);
If you want to pass timeframe to the MACD, cast it to a ENUM_TIMEFRAMES. That is why your original enumeration used PERIOD_… as values.
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
Hi.
I just migrate from mql4 to mql5 and I can't define timeframe as input and initializing it.
Can anyone help me to do that?
Thank you so much.