What is the difference among PERIOD_CURRENT,Periond(),_Period

 

 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

int _Period   The _Period variable contains the value of the timeframe of the current chart.

 

 What is the difference ?

Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Chart Timeframes
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Chart Timeframes - Documentation on MQL5
 
Up.

I came to find the answer to the exact same question. Is there any difference between using any of these 3 options?
 
Martin Bittencourt #:
Up.

I came to find the answer to the exact same question. Is there any difference between using any of these 3 options?

Me too...nobody wants to educate us ?

 

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.

 
Zaky Hamdoun #:

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

 
OldZ What is the difference ?
  1. 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.
  2. The others return the current chart's timeframe. The function version came from MT4. Now both terminals have both.