Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Connect Ninjatrader to Metatrader

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    you dont need to buy Softwares or bridges or whatever
    you can just write two codes, one as an EA in MT4 and the other one as a strategy in NT8. both can share information using a simple txt file. that is what i have done.

    Comment


      #32
      Originally posted by bahmaniq View Post
      you dont need to buy Softwares or bridges or whatever
      you can just write two codes, one as an EA in MT4 and the other one as a strategy in NT8. both can share information using a simple txt file. that is what i have done.
      Hello @bahmaniq

      As I can understand, the idea you say would be about to have 2 strategies, 1 strategy in NT8 and 1 strategy in MT4/MT5, and if you want to send automated orders generated in the NinjaTrader 8 strategy to the MT4/MT5 EA/Strategy, then a way would be to use the feature in NT8 where the script can automatically write data into a .txt file, and then in MT4/MT5 the process would be the oppositive, i.e.to read data from the same .txt file you are working in NT8, reading the orders information and finally placing the orders in MT4/MT5.

      Would the process be more or less as I'm describing? and if yes, exactly what information is what you need to write from the NinjaTrader 8 strategy to then be read in MT4/MT5? because both platforms use different code syntax etc.

      How can I get started with this? I mean not only talking about to write and to read data in one or the other platform, but only covering the part of what data to write, what data to read, and deeper details about the process.


      Could you please share a guide about the process?


      Thank you in advance for your help

      Comment


        #33
        Originally posted by futurenow View Post

        Hello @bahmaniq

        As I can understand, the idea you say would be about to have 2 strategies, 1 strategy in NT8 and 1 strategy in MT4/MT5, and if you want to send automated orders generated in the NinjaTrader 8 strategy to the MT4/MT5 EA/Strategy, then a way would be to use the feature in NT8 where the script can automatically write data into a .txt file, and then in MT4/MT5 the process would be the oppositive, i.e.to read data from the same .txt file you are working in NT8, reading the orders information and finally placing the orders in MT4/MT5.

        Would the process be more or less as I'm describing? and if yes, exactly what information is what you need to write from the NinjaTrader 8 strategy to then be read in MT4/MT5? because both platforms use different code syntax etc.

        How can I get started with this? I mean not only talking about to write and to read data in one or the other platform, but only covering the part of what data to write, what data to read, and deeper details about the process.


        Could you please share a guide about the process?


        Thank you in advance for your help
        The process is as you described above.
        You don't need to share code syntax, I mean you don't put " if (x>=1) then .." in the txt file.
        Let me make an example
        My strategy is based on NinzaRenko Bars+some indicators. NinjaTrader has provided NinzaRenko but we don't have these bars in MT4. So I can write a code(strategy) in ninjatrader that makes a TXT file when my conditions to open a position is met. for example if INDICATOR1>50 and INDICATOR2>1 and MA50 Crosses MA200 (just an example) then open a BUY position with 5pips stop and 50pips TP and save this number in the TXT file: 10550
        Then MT4 reads the number 10550 and interpretates it as below:
        first number is 1 so we have a market execution BUY pisition (2 can be sell, 3 can be sell limit ...)
        the next two number is 05 so the stop loss is 5 pips
        last two digits are 50 so TP is 50 pips

        It was just the idea, you may change it due to your own strategy

        for example my code only sends 1 or 2 or 3 or 4to MT4. When each of these numbers are saved in TXT file, the EA in MT4 does different actions.

        you may find these lines handy in MT4:


        input string InpFileName52="ninja52.txt"; // ninza52 File name
        input string InpDirectoryName="Data"; // Folder name

        int file_handle52_buy=FileOpen(InpDirectoryName+"//"+InpFileName52,FILE_READ|FILE_TXT);
        int ninza52_buy=FileReadString(file_handle52_buy,INT_V ALUE);
        FileClose(file_handle52_buy);​ //YOU MUST CLOSE THE FILE AFTER READ/WRITE IN BOTH NINJA AND MT

        Comment


          #34
          Originally posted by bahmaniq View Post

          The process is as you described above.
          You don't need to share code syntax, I mean you don't put " if (x>=1) then .." in the txt file.
          Let me make an example
          My strategy is based on NinzaRenko Bars+some indicators. NinjaTrader has provided NinzaRenko but we don't have these bars in MT4. So I can write a code(strategy) in ninjatrader that makes a TXT file when my conditions to open a position is met. for example if INDICATOR1>50 and INDICATOR2>1 and MA50 Crosses MA200 (just an example) then open a BUY position with 5pips stop and 50pips TP and save this number in the TXT file: 10550
          Then MT4 reads the number 10550 and interpretates it as below:
          first number is 1 so we have a market execution BUY pisition (2 can be sell, 3 can be sell limit ...)
          the next two number is 05 so the stop loss is 5 pips
          last two digits are 50 so TP is 50 pips

          It was just the idea, you may change it due to your own strategy

          for example my code only sends 1 or 2 or 3 or 4to MT4. When each of these numbers are saved in TXT file, the EA in MT4 does different actions.

          you may find these lines handy in MT4:


          input string InpFileName52="ninja52.txt"; // ninza52 File name
          input string InpDirectoryName="Data"; // Folder name

          int file_handle52_buy=FileOpen(InpDirectoryName+"//"+InpFileName52,FILE_READ|FILE_TXT);
          int ninza52_buy=FileReadString(file_handle52_buy,INT_V ALUE);
          FileClose(file_handle52_buy);​ //YOU MUST CLOSE THE FILE AFTER READ/WRITE IN BOTH NINJA AND MT


          Thank you for your extra explanation, it is an interesting point of view to work in that way.

          Comment


            #35
            Hey bahmaniq! It's a late reply but thanks for sharing your approach to connecting NinjaTrader and MetaTrader platforms. It seems like you've found a creative solution using text files to share information between the two platforms. It's great to see traders finding innovative ways to integrate different trading tools. To clarify, in this setup, you would have a strategy in NinjaTrader 8 (NT8) that writes data to a .txt file, and then in MetaTrader 4/5 (MT4/MT5), you would read the data from the same .txt file to place orders based on the information received. Additionally, Quantum AI Trading offers advanced trading solutions and tools that might be of interest to you. You can check out their website for more information on how their technology can assist with your trading strategies.
            Last edited by Karbowski795; 07-14-2023, 06:50 AM.

            Comment


              #36
              GLBridge is now called MTAPI.pro with a new website. https://mtapi.pro/

              MTAPI is the best way to copy trade from Ninjatrader 8 to Metatrader 4 or 5!

              You can see the full live demo here on Youtube. https://www.youtube.com/watch?v=vMYwNLEkTwo

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Perr0Grande, Today, 08:16 PM
              0 responses
              2 views
              0 likes
              Last Post Perr0Grande  
              Started by elderan, Today, 08:03 PM
              0 responses
              5 views
              0 likes
              Last Post elderan
              by elderan
               
              Started by algospoke, Today, 06:40 PM
              0 responses
              10 views
              0 likes
              Last Post algospoke  
              Started by maybeimnotrader, Today, 05:46 PM
              0 responses
              12 views
              0 likes
              Last Post maybeimnotrader  
              Started by quantismo, Today, 05:13 PM
              0 responses
              7 views
              0 likes
              Last Post quantismo  
              Working...
              X