Home
Name Modified Size InfoDownloads / Week
mql4 2022-03-24
mql5 2022-03-24
mtbridge-server-linux_3.2.0 2021-09-12 38.6 MB
readme.md 2021-09-11 6.9 kB
mtbridge-server.postman_collection 2021-09-11 49.7 kB
mtbridge-server-windows_3.2.0.exe 2021-09-11 44.4 MB
mtbridge-server-windows_3.1.3.exe 2021-02-18 44.4 MB
mtbridge-server-linux_3.1.3 2021-02-18 48.6 MB
mtbridge-server-macos_3.1.3 2021-02-18 48.7 MB
settings.json 2021-02-18 201 Bytes
Metatrader API Server Documentation Setup 1.0.0.exe 2020-10-27 54.9 MB
mtbridge_post.exe 2020-10-26 28.7 kB
Totals: 12 Items   279.7 MB 2

Installation

First, download the Metatrader API Server

First download the following files into the same folder/directory,

1. mtbridge-server.exe (Windows x64), mtbridge-server-linux, or mtbridge-server-macos standalone executable
2. settings.json = defines the host name, IP port, database file and maximum sessions to be used

Second, download a Metatrader Client

Use the link https://www.tradersway.com/?ib=1004584

Third, setup your Metatrader Client

For Metatrader 4, See mq4l/readme.md

For Metatrader 5, See mql5/readme.md

Forth, start the Metatrader API Server

Start the standalone executable

> mtbridge-server.exe|mtbridge-server-linux|mtbridge-server-macos

The response should be similar to,

>  localhost server running on port 3000

Fifth, test the Metatrader API Server

Now, open your browser to

URL: http://localhost:3000/about

expected result,

{
    "name":"mtbridge",
    "version":"3.1.3",
    "description":"Metatrader API Bridge",
    "main":"index.js",
    "scripts":{
        "start":"node index.js",
        "clean":"del index-*",
        "build":"pkg index.js",
        "doc": "apidoc -f index.js -o ./doc/"
    },
    "keywords":[
        "metatrader","forex","presspage entertainment","redeecash"
    ],
    "author":{
        "name":"Patrick Ingle",
        "company":"PressPage Entertainment Inc DBA RedeeCash",
        "email":"presspage.entertainment@gmail.com",
        "url":"https://redeecash.com"
    },
    "license":"AAL",
    "dependencies":{
        "body-parser":"^1.19.0",
        "cluster":"^0.7.7",
        "config.json":"0.0.4",
        "cors":"^2.8.5",
        "express":"^4.17.1",
        "killable":"^1.0.1",
        "nodejs-md5":"^1.1.0"
    },
    "cpuCount":4
}

List all routes

To list all routes available, use

http://localhost:3000/

Settings.JSON

Edit the settings.json to specify the host, port, maximum sessions, and password

{
    "domain": "localhost",
    "host": "localhost",
    "port": 3000,
    "max_sessions": 50,
    "password": "5f4dcc3b5aa765d61d8327deb882cf99",
    "cluster": 0
}

When the cluser paramter is set to 1, clustering is turn on and is considered experimental as sharing variables across threads is a pending issue.

The password is an MD5 hash. Use the MD5 route to determine the MD5 hash value,

http://localhost:3000/md5/password

where password is yout plain text password, then copy and paste (without double quotes) to the settings.json (the password for the above is: password)

Verify Session Data

You can verify session data is being sent from Metatrader to MTBridge Server by navigating your browser to,

http://localhost:3000/GetAllSessions

Postman Collection

The following file contains the list of API's exported by the @presspage/metatrader-bridge module

mtbridge-server.postman_collection

Open from within the Postman application which can be download from https://www.postman.com/downloads/

Release Schedule

Whenever the code base is updated, a new standalone executable is created and replaced with the existing executable.

Version     Date        Changes
3.2.0       09/11/2021  Refactored to use node module @presspage/metatrader-bridge
3.1.3       11/02/2020  Fixed Issue #5 - session_count is not defined
3.1.2       10/26/2020  Fixed Issue #2 - ReferenceError: index is not defined at index.js:546:25, 
                        added API documentation, historical rate implementation, control for cluster control
3.1.1       10/21/2020  Fixed Issue #1 - TypeError: req.json is not a function
3.1.0       03/23/2020  Implemented as a Node-Cluster
3.0.5       09/23/2019  Parameter reference fixes, added exception handling, added status routes
3.0.4       09/23/2019  Converted POST to GET requests, restored CORS
3.0.3       09/23/2019  Fix for Initialize to prevent duplicate entries, included FOREXGENERAL.MQ4 (and MQL4-HTTP.MQH)
3.0.2       09/20/2019  Remove duplicate ROOT route
3.0.1       09/20/2019  Added route directory, MD5 and shutdown routes
3.0.0       09/18/2019  Initial commit

When a new version is released the older version will be deleted (overwritten)

Documentation

A separate node-electron executable is created to display the Metatrader API Server route reference. The files are identified as,

Metatrader API Server Documentation Setup x.x.x - for Windows

Advanced Topic - Metatrader Bridge on Apache

Using apache mod_proxy, you can configure MTBRIDGE to be invoked from an apache URL, even as a secured connection. The following steps show you how to configure apache.

Step 1: Setup Apache for PROXY

his step will allow the use of valid SSL session from apache and proxy the request to a backend node process.

First enable mod_proxy,

a2enmod proxy

then restart apache,

service apache2 restart

Edit the apache.conf, and place the following after </Directory> tag

ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
    Require all granted
</Proxy>

<Location /mtbridge.app>
    ProxyPass http://127.0.0.1:3000
    ProxyPassReverse http://127.0.0.1:3000
</Location>

then restart apache,

service apache2 restart

Step 2: Create a service process

Create a new file located in /etc/systemd/system/

nano /etc/systemd/system/mtbridge.service

Then copy the contents,

[Unit]
Description=Metatrader Bridge Node-Express-Cluster Server
AFtert=network.target
StartLimitIntervalSec=0
#
[Service]
Type=simple
User=root
Restart=always
RestartSec=1
WorkingDirectory=/root
ExecStart=/root/mtbridge-server-linux-service
#
[Install]
WantedBy=multi-user.target

then enable the new service,

systemctl enable mtbridge.service

Step 3: Upload the files to the /root path

You will need to upload these two files to /root path,

mtbridge-server-linux
settings.json

Also change the permissions on the file mtbridge-server-linux-service to be executable,

chmod +x mtbridge-server-linux-service

Step 4: Start the Service

To start the service,

systemctl start mtbridge.service

Step 5: Access the Metatrader Bridge from Apache

Use the URL,

http://localhost/mtbridge.app/

or

https://localhost/mtbridge.app/

if you have SSL enabled?

EOL or End-of-Life

When a piece of software is useful, there should never be an EOL doctrine. The intention for mtbridge-server is to achieve immoratlity ;).

At some point of time in the future, this project may appear to be dead and abandon. The opposite will be true!

When this project reaches that stage, this project has matured to a level where maintenance is minimal (mostly updating to latest version of Node).

Patrick Ingle
Developer
September 18, 2019
Source: readme.md, updated 2021-09-11