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



  • 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.



  • @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


  • administrators

    @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.



  • 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.