fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Button on chart changes timeframe

    Questions & Answers
    2
    3
    1622
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Moofty last edited by

      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

      1 Reply Last reply Reply Quote 0
      • M
        miro1360 last edited by miro1360

        https://fxdreema.com/shared/8s6x69b0c

        you can do it with one row of custom code:
        0_1534264421114_0cce3554-80e5-4049-8b91-0173a34dadd0-image.png

        here are IDs (enumerations) for all timeframes for MT4 (change them in your blocks for other timeframes)
        https://docs.mql4.com/constants/chartconstants/enum_timeframes

        and 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

        Between trading and gambling is a very small gap, be careful.

        1 Reply Last reply Reply Quote 0
        • M
          Moofty last edited by

          Thankyou Miro.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          Online Users

          P
          R
          S
          R
          E
          M
          P
          C
          J

          20
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors