fxDreema

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

    How to get iMACD from MT4 to MT5

    Questions & Answers
    2
    3
    1055
    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.
    • D
      drankman last edited by

      Hi everyone and all the experts @jstap @l-andorrà @roar ,

      I am trying to convert MT4 to MT5, however, the iMACD value in "custom MQL mode" is not well converted. I tried to look up on MQL5 website, but I could not get it right.

      So basically,
      iMACD in MT4:

      iMACD(_Symbol,PERIOD_CURRENT,12,26,9,PRICE_CLOSE,MODE_MAIN,0);

      but in MT5, the main line and candle shift are not included (the last two functions in bracket). see below.

      iMACD(_Symbol,PERIOD_CURRENT,12,26,9,PRICE_CLOSE);

      Anyone have any idea how to convert this iMACD from MQL4 to MQL5 that include the main line and candle shift?

      Thanks in advance!

      roar 1 Reply Last reply Reply Quote 0
      • roar
        roar @drankman last edited by

        @andrewfrank indicators work very differently on mql5. It would be easier to just use the "modify variables" block rather than custom code, when getting indicator outputs.

        But if you do it the custom way, you must first "load" the MACD indicator with the code you mentioned, and then use CopyBuffer() function to read some value from that indicator.

        Need small help? Tag me in your post
        Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

        1 Reply Last reply Reply Quote 1
        • D
          drankman last edited by drankman

          @roar how do you use CopyBuffer function in this case?

          iMACD(_Symbol,PERIOD_CURRENT,12,26,9,PRICE_CLOSE);
          CopyBuffer(handle,0,0,20,MACDBuffer)

          is 20 in this particular example candle shift?
          I'm thinking to make a loop with this, so I was wondering which one is the candle shift..

          I saw something like this from MQL5 websites:

          image.png

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

          Online Users

          K

          11
          Online

          146.8k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors