Using FIX Trader with MT4 terminal

3.1 Offline charts

Once the FIX Trader connected to FIX providers server and MT4 parameters are prescribed (see section 2.3 ), the FIX Trader starting to fill the information in files that can be used to display “offline charts”. Despite the confusing word ”offline”, that charts can be used for online data representation and trading.

To start working the offline chart, please open your MT4 terminal and click menu item “File -> Open offline”. You will see the next dialog (fig.7):

MT4 offline charts

Fig.7 Selecting symbol and timeframe for offline chart

Please select the symbol and timeframe (from that one you provided in section 2.3 ) and click Open.

NOTE: If you want to use chart not just for indicative purposes but also for transferring the orders opened by the EA you place on this chart to FIX Trader, press F8 on chart (or right click and select Properties), and on the tab Common uncheck checkbox “Offline chart” (fig.8).

offline chart propeties

Fig.8 Making offline chart available for trading from EA

3.2 Connecting MT4 to FIX trader

To connect MT4 to FIX Trader for transferring orders to FIX providers, put script “BJF Fix connector” on the chart (fig.9). In script inputs, in port_4_buy_commands/ port_4_sell_commands specify the port on which is running the instance of program responsible for sending buy/sell orders. If you are using single instance of the program, this ports should coincide. NewOrderDetectionMethod stands for the method the new order in terminal will be detected: 0 – for Automatic method and 1 for Manual method (see section 3.3 for explanations).

NOTE: For running the connector script, you need to select for chart you are planning to run it on, the symbol that is not used for collecting market data from FIX (see section 2.3).


script for MT4 connect

Fig. 9 Launching script to connect to MT4

3.3. New order detection methods

There are two ways for script to detect the new order request appearance. For users, that do not have source code (mq4 files) of the EA, only Automatic method is acceptable. In this case the script will catch new order request from terminal as soon as it appears in terminal info and transfer it to the FIX Trader (please note, that script catches not order execution event but sending event).

With Manual method in the source code of the EA before OrderSend and OrderClose commands should be inserted line of the code that creates new Global Variable with the name that contains information about the orders. The template for the Global Variable name is:


So, for example, to open new market order to sell 0.1 EURUSD you need to insert next line before order send command:


To close that order, you need to insert next line before order close command:


NOTE: Do not delete the created global variables, they will be automatically deleted from the script when the order command is transferred to FIX Trader.

3.4. Using EA on offline charts

Before placing the EA on offline chart to start trading, please make sure automated trading is allowed and “Offline chart” checkbox is unchecked (see section 3.1). For testing you can use the EA NewBarCatcher, that will appear in your MT4 terminal after program installation. It is very simple EA, its logic is the next: if there is no opened orders (with particular magic number) on symbol on bar opening, it opens new order. Otherwise, if the orders exists, it closes it. The source code of EA is available as illustration to section 3.3.