Hi all
I have problems with the display of the timeframe label in push notifications?
Specifically, I attached an indicator to charts that are in different timeframes such as M1 M15 H1 H4 D1. My problems are:
when a signal appears:
- if timeframes are M15 M5 M1, the push notification can correctly show the timeframe label to which the indicator is attached.
- However; if the timeframes are H1, H4, and D1, the push notification can not show correctly the timeframe label. Instead of showing the correct timeframe label, it shows 16385, 16408, etc.
Please refers to my attached image and file (.mql5) for more clarity.
Could anyone please take the time to help me fix this problem?
TIA.
Best Regards
You assume that the enumeration values are in minutes. They are not. See as_string(…) or use PeriodSeconds(…)/60.
Why are MT5 ENUM_TIMEFRAMES strange? - General - MQL5 programming forum - Page 2 #11 (2020)
when a signal appears: - if timeframes are M15 M5 M1, the push notification can correctly show the timeframe label to which the indicator is attached. - However; if the timeframes are H1, H4, and D1, the push notification can not show correctly the timeframe label. Instead of showing the correct timeframe label, it shows 16385, 16408, etc. Please refers to my attached image and file (.mql5) for more clarity. Could anyone please take the time to help me fix this problem?
On MQL5 (unlike MQL4), the time-frame enumerations don't correspond to minutes, but have their own special format (see below), so use EnumToString instead.
Forum on trading, automated trading systems and testing trading strategies
Vladimir Karputov, 2022.05.23 12:51
Updated script - printout 'ENUM_TIMEFRAMES'
Timeframe in MT5 is a bit field. Printing out 'HEX' values gives an idea of how timeframes are encoded (See timeframe coding from H1 and higher).
Result:
0: "PERIOD_CURRENT", int: 0, HEX: 0, "Current timeframe" 1: " PERIOD_M1", int: 1, HEX: 1, "1 minute" 2: " PERIOD_M2", int: 2, HEX: 2, "2 minutes" 3: " PERIOD_M3", int: 3, HEX: 3, "3 minutes" 4: " PERIOD_M4", int: 4, HEX: 4, "4 minutes" 5: " PERIOD_M5", int: 5, HEX: 5, "5 minutes" 6: " PERIOD_M6", int: 6, HEX: 6, "6 minutes" 7: " PERIOD_M10", int: 10, HEX: A, "10 minutes" 8: " PERIOD_M12", int: 12, HEX: C, "12 minutes" 9: " PERIOD_M15", int: 15, HEX: F, "15 minutes" 10: " PERIOD_M20", int: 20, HEX: 14, "20 minutes" 11: " PERIOD_M30", int: 30, HEX: 1E, "30 minutes" 12: " PERIOD_H1", int: 16385, HEX: 4001, "1 hour" 13: " PERIOD_H2", int: 16386, HEX: 4002, "2 hours" 14: " PERIOD_H3", int: 16387, HEX: 4003, "3 hours" 15: " PERIOD_H4", int: 16388, HEX: 4004, "4 hours" 16: " PERIOD_H6", int: 16390, HEX: 4006, "6 hours" 17: " PERIOD_H8", int: 16392, HEX: 4008, "8 hours" 18: " PERIOD_H12", int: 16396, HEX: 400C, "12 hours" 19: " PERIOD_D1", int: 16408, HEX: 4018, "1 day" 20: " PERIOD_W1", int: 32769, HEX: 8001, "1 week" 21: " PERIOD_MN1", int: 49153, HEX: C001, "1 month"
24 -> HEX -> '18'
Thank you so much all.
Best Regards

- 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 all
I have problems with the display of the timeframe label in push notifications?
Specifically, I attached an indicator to charts that are in different timeframes such as M1 M15 H1 H4 D1. My problems are:
when a signal appears:
- if timeframes are M15 M5 M1, the push notification can correctly show the timeframe label to which the indicator is attached.
- However; if the timeframes are H1, H4, and D1, the push notification can not show correctly the timeframe label. Instead of showing the correct timeframe label, it shows 16385, 16408, etc.
Please refers to my attached image and file (.mql5) for more clarity.
Could anyone please take the time to help me fix this problem?
TIA.
Best Regards