and you want to get another multiple timeframe, you can only do it with string conversion:
uint second;
string val_seconds;
// Example
// current period PERIOD_M5
// second period PERIOD_M30
if (seconds == 300) // PERIOD_M5
last_period = PERIOD_M30;
val_seconds = EnumToString (PERIOD_M30);
You can not convert val_seconds to int because
ENUM_TIMEFRAME can only convert for long whole lengths
2E + 14 (16384
int PeriodEnumToMinutes(ENUM_TIMEFRAMES period = PERIOD_CURRENT)
{
period = period==PERIOD_CURRENT?(ENUM_TIMEFRAMES)Period():period;
returnPeriodSeconds(period)/60;
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
If you have a time frame current
and you want to get another multiple timeframe, you can only do it with string conversion:
uint second;
string val_seconds;
// Example
// current period PERIOD_M5
// second period PERIOD_M30
if (seconds == 300) // PERIOD_M5
last_period = PERIOD_M30;
val_seconds = EnumToString (PERIOD_M30);
You can not convert val_seconds to int because
ENUM_TIMEFRAME can only convert for long whole lengths
2E + 14 (16384