I came to find the answer to the exact same question. Is there any difference between using any of these 3 options?
If my memory's good, "_Period" variable is just a depreciated method from MQL4, does the same as Period(), but Period() is usually better as per MQL5 and coding conventions.
Period() just returns the contents of _Period, and returns 0 for a service.
As for the PERIOD_CURRENT identifier, I do not really know, it's probably just a more verbose way of doing so.
If my memory's good, "_Period" variable is just a depreciated method from MQL4, does the same as Period(), but Period() is usually better as per MQL5 and coding conventions.
Period() just returns the contents of _Period, and returns 0 for a service.
As for the PERIOD_CURRENT identifier, I do not really know, it's probably just a more verbose way of doing so.
also add the answers for _Symbol and _Digits .. I believe they are just synonyms but which acts faster ? This can be known only by benchmark
- PERIOD_CURRENT is the constant zero (0). You can use it in those calls where it says you can. The call will replace it with the value of one of the others for your convenience.
- The others return the current chart's timeframe. The function version came from MT4. Now both terminals have both.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
1
PERIOD_CURRENT
All predefined timeframes of charts have unique identifiers. The PERIOD_CURRENT identifier means the current period of a chart, at which a mql5-program is running.
2
ENUM_TIMEFRAMES Period(); Returns the current chart timeframe
3
int _Period The _Period variable contains the value of the timeframe of the current chart.
What is the difference ?