What is the data type for timeframes in MQL5?

 
In MQL4, below code works pretty well.
But in MQL5, I'm getting errors when I make the timeframe an int variable.
What's the data type for declaring the timeframe (e.g. PERIOD_H1 ) as a variable/placeholder in MQL5? I can't seem to find it in the documentation.

I need to maintain TF as a variable.
Your advise is appreciated.

string Pair;
extern int TF=PERIOD_H1;
double lastBarRange;

void GetLastBarRange(){
lastBarRange = iClose(Pair,TF,1) - iOpen(Pair,TF,1)
}

void OnTick(){

Pair="EURUSD";  GetLastBarRange();

}
 
peterbabs:
In MQL4, below code works pretty well.
But in MQL5, I'm getting errors when I make the timeframe an int variable.
What's the data type for declaring the timeframe (e.g. PERIOD_H1 ) as a variable/placeholder in MQL5? I can't seem to find it in the documentation.

I need to maintain TF as a variable.
Your advise is appreciated.

Use  ENUM_TIMEFRAMES enumeration

Documentation on MQL5: Constants, Enumerations and Structures / Chart Constants / Chart Timeframes
Documentation on MQL5: Constants, Enumerations and Structures / Chart Constants / Chart Timeframes
  • www.mql5.com
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.
 
peterbabs: What's the data type for declaring the timeframe (e.g. PERIOD_H1 )

Perhaps you should read the manual. List of MQL5 Constants → PERIOD_H1 → Chart Timeframes → ENUM_TIMEFRAMES

 
Vladimir Karputov:

Use  ENUM_TIMEFRAMES enumeration

Thank you all.

I figured it out after posting.

Didn't know previously that ENUM_TIMEFRAMES is actually a data type.

Documentation on MQL5: Constants, Enumerations and Structures / Chart Constants / Chart Timeframes
Documentation on MQL5: Constants, Enumerations and Structures / Chart Constants / Chart Timeframes
  • www.mql5.com
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.
Reason: