ENUM_TIMEFRAMES Period();
What is this supposed to do?
Alert(ENUM_TIMEFRAMES Period());
You need a string for an Alert.
What is this supposed to do?
You need a string for an Alert.
Hello thanks for the response.
well I didn't use a string type before when my script worked correctly before. For alerting the current time frame, I only need the result as a number (ENUM_TIMEFRAME index number).
I found this function from https://www.mql5.com/en/docs/check/period
In this above link they have explained exactly how to use it to get the current chart timeframe. But I'm just lost somewhere around that I can't get it right
Please help me
- www.mql5.com
What are you trying to do?
I want to get the ENUM index numerical value for the the current timeframe, when I run my script on a forex chart.
example : I get an alert saying "1" which means I'm in 1 minute chart
Alert(Period());
Thats giving me the basic chart time frame value which is not the ENUM_TIMEFRAME Index value.
period function itself without enum returns strange values after m30 chart like 16385 for 1 hour chart.
I want to obtain the ENUM index value
May I also know what parameters can we insert into period() function ?- www.mql5.com
If you want the actual string.
Alert(EnumToString(Period()));
If you want the actual string.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi programmers! I'm a newbie to MQL 5 language and I need help with using the " ENUM_TIMEFRAMES Period();" function.
My objective : I need to write a simple script to determine the current chart timeframe using the ENUM_TIMEFRAMES Period(); function.
When I execute the script, I need an alert giving me the current chart timeframe in terms of ENUM Values example : 0( for current period), 1 (for one minute chart),2(for 2minute chart),3,4,5,6.... to the respective chart
I earlier used to get the correct result but something went wrong and I can't figure out what I did before.
this is my current code which is giving me an error: