Button on chart changes timeframe
-
Hi,
I would like buttons on my chart to switch timeframes,
I have no problems making the buttons but cant find a block to switch timeframes.
Can someone please help me with a custom code block to perform this task.
Thanks -
https://fxdreema.com/shared/8s6x69b0c
you can do it with one row of custom code:

here are IDs (enumerations) for all timeframes for MT4 (change them in your blocks for other timeframes)
https://docs.mql4.com/constants/chartconstants/enum_timeframesand with the same way it should working for MT5, where are more timeframes:
https://www.mql5.com/en/docs/constants/chartconstants/enum_timeframes... Symbol() can be replaced by pair name with quotes ("EURUSD", "GBPUSD", ...) and that way pair should be changed, I have not tried it
-
Thankyou Miro.