Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Add MT4 to brokers

    General Discussion
    4
    6
    2492
    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.
    • P
      puhtooie last edited by puhtooie

      I started working on adding code to the stores and brokers files to make a connection to MT4 that would allow live trading using the following library: https://github.com/Puhtooie/dwx-zeromq-connector

      There is also the following libraries:
      https://github.com/AustenConrad/mql4zmq
      https://github.com/dingmaotu/mql-zmq
      https://github.com/krisn/lws2mql

      The first two also use ZeroMQ, the last one does not. I have not explored these in much depth. There are not many commits, and some of them are rather old, but they may be good reference points at the very least.

      Unfortunately, I'm freshly new to Backtrader and there are a few file titles whose names it appears are different inside the files calling them than the files themselves? like in backtrader\brokers\oandabroker for
      from backtrader import (TimeFrame, num2date, date2num, BrokerBase, Order, BuyOrder, SellOrder, OrderBase, OrderData)

      I cannot find BrokerBase, and I am unsure of if that's just cause it's been changed to just broker, or if I'm missing something.

      I also want to plug in as many of the features that are offered into this library, but like I said freshly new to this framework, but the combination of these two seems really powerful.

      There's currently no coded support for getting historical data from MT4, and the live data feed could have some files layered over it to split the time frames up more dynamically. Other than that it seems like it should be able to plug in fairly well. Obviously I am going to keep working on dissecting this to get it up and running, but any help or advice to speed the process up would be greatly appreciated.

      B 1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        @puhtooie said in Add MT4 to brokers:

        I cannot find BrokerBase, and I am unsure of if that's just cause it's been changed to just broker, or if I'm missing something.

        BrokerBase is a class inside broker.py

        • If my answer helped, hit reputation up arrow at lower right corner of the post.
        • Python Debugging With Pdb
        • New to python and bt - check this out
        1 Reply Last reply Reply Quote 2
        • B
          backtrader administrators @puhtooie last edited by

          @puhtooie said in Add MT4 to brokers:

          I cannot find BrokerBase, and I am unsure of if that's just cause it's been changed to just broker, or if I'm missing something.

          It will be a surprise if you can find any of the other names on that list as a file.

          @puhtooie said in Add MT4 to brokers:

          from backtrader import (TimeFrame, num2date, date2num, BrokerBase, Order, BuyOrder, SellOrder, OrderBase, OrderData)

          Those are all entities defined somewhere and which are imported.

          1 Reply Last reply Reply Quote 1
          • P
            puhtooie last edited by

            Cool, thank you. I've been working mostly with java and c++ lately so my syntax's are all mixed up.
            If anyone is interested, I'll upload progress on the library to this thread.

            1 Reply Last reply Reply Quote 0
            • K
              kojinakata last edited by

              How is the MT4 integration going?

              1 Reply Last reply Reply Quote 0
              • B
                backtrader administrators last edited by

                https://www.backtrader.com/recipes/storesbrokersdata/mql5/mql5/

                1 Reply Last reply Reply Quote 1
                • 1 / 1
                • First post
                  Last post
                Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors