What is a good example code of how to use ENUM_TIMEFRAME, PERIOD_CURRENT, Period() and _Period?
Can I check the timeframe of the current chat by writing the following?
if (Period() == ENUM_TIMEFRAME)
Bla bla bla
or
if (ENUM_TIMEFRAME == PERIOD_CURRENT)
Bla bla bla
Both examples are giving me error.
- Indicators: Stochastic Divergence
- Is it wrong designing and EA this way?
- Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor - The first is equivalent to if(15 == int) babble.
- The second is equivalent to (if int == 0) babble.
- The current chart is always the current chart. What you are trying to test makes no sense.
- Period() and _Period are identical. Period_Current equals zero.
- Enumered lists - Indices - Expert Advisors and Automated Trading - MQL5 programming forum

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