Devcartelgateway64 Save Abandoned

DevCartel MT5 gateway for MetaTrader 5 Platform

Project README

DevCartelGateway64

GitHub release platform GitHub downloads Enterprise Support

Built with MT5 gateway API, DevCartelGateway64 accepts connection from MT5 platform and connects to a remote PyMT5 application. It accepts various data types from PyMT5. For complete protocol and documentation, visit PyMT5 GitHub.

application

Installation

  • Download a gateway package from our releases
  • Unzip the package and put the whole folder in MT5 platform's gateway directory e.g. D:\MetaTrader 5 Platform\History\Gateway

Launching

  • On MT5 Administrator, add a gateway by choosing DevCartelGateway64
  • Trading server should be an IP address and port of a PyMT5 server application

    Launching gateway

  • Click OK and the gateway will establish connection to your PyMT5 application

Gateway Network Protocol

TCP socket.

Message Format

Message is composed of Header+Body+<LF> where each field in Body is demilited using ASCII SOH (\x01) and must be prefixed by the Header. Each message is ended with ASCII LF (\x0A), for example:

ver=3<SOH>type=3<SOH>tag1=value1<SOH>tag2=value2<SOH>...<SOH>tagN=valueN<LF>

In this documentation, light vertical bar character () represents the delimiter ASCII SOH.

Message Type

Login

Tag Comments
Header ver=3❘type=1
Body
login
password
res 0 - ok
2 - error

Logout

Tag Comments
Header ver=3❘type=2
Body None

Symbol

Tag Comments
Header ver=3❘type=3
Body
index Symbol index
symbol
path
description
source
page
currency_base
currency_profit
currency_margin
digits
tick_flags
calc_mode
exec_mode
chart_mode
fill_flags
expir_flags
tick_value
tick_size
contract_size
volume_min
volume_max
volume_step
market_depth
margin_flags
margin_initial
margin_maintenance
margin_long
margin_short
margin_limit
margin_stop
margin_stop_limit
settlement_price
price_limit_max
price_limit_min
time_start Trading start date
time_expiration Trading expiration date
trade_mode 0 - trade disabled
1 - only long positions allowed
2 - only short positions allowed
3 - only position closure
4 - all trade operations are allowed

Tick

Tag Comments
Header ver=3❘type=4
Body
symbol
bank
bid
ask
last
volume
datetime POSIX timestamp e.g. 1523278796000

Order

Tag Comments
Header ver=3❘type=5
Body
symbol
bank
bid
ask
last
volume
datetime POSIX timestamp e.g. 1523278796000
order_action 1 - new
2 - modify
3 - cancel
state 0 - unkonwn
1 - confirmed
2 - placed
3 - new
4 - rejected
5 - deal
6 - modification received
7 - modified
8 - modification rejected
9 - cancelation received
10 - canceled
11 - cancelation rejected
20 - complete
order MT order ticket
exchange_id Exchange order ID
custom_data
request_id
symbol
login MT client login
type_order 0 - buy market
1 - sell
2 - buy limit
3 - sell limit
4 - buy stop
5 - sell stop
6 - buy stop limit
7 - sell stop limit
type_time Expiration
0 - good till cancel
1 - good till day
2 - good till specified
3 - good till specified day
type_fill Filling
0 - Return
1 - fill or kill
2 - immediate or cancel
action Client action:
0 - prices for
1 - request
2 - instant
3 - market
4 - exchange
5 - pending
6 - stop loss/taking profit
7 - modify
8 - cancel
100 - activate
101 - activate stop loss
102 - activate take profit
103 - activate stop-limit order
104 - delete stop-out order
105 - close stop-out position
106 - expire
price_order
price_sl Stop Loss level
price_tp Take Profit level
price_tick_bid Symbol bid price in external trading system
price_tick_ask Symbol ask price in external trading system
volume
expiration_time
comment String (32 char max)
position Position ID
flags Trade action flags:
1 - position close
2 - at market price
3 - market close
result Result of order processing:
1 - ok
10006 - rejected
10007 - canceled
10008 - placed
10009 - complete

Heartbeat

Tag Comments
Header ver=3❘type=6
Body None

Deal

Tag Comments
Header ver=3❘type=7
Body
exchange_id Exchange order ID
order Order exchange ticket
symbol
login MT client's login
type_deal 0 - buy
1 - sell
volume Deal volume
volume_rem Non-filled volume
price Lot price
Optional
datetime Deal timestamp
comment String (32 char max)
position Position ID

External Deal

Tag Comments
Header ver=3❘type=50
Body
exchange_id Exchange order ID
order Order exchange ticket
symbol
login MT client's login
type_deal 0 - buy
1 - sell
volume Deal volume
volume_rem Non-filled volume
price Lot price
Optional
datetime Deal timestamp
comment String (32 char max)

Support

  • Report an issue here

Changelog

1.9.0

  • 13 May 2022
  • Support source in symbol message

1.8.0

  • 7 April 2022
  • Fix volume in tick message
  • Support type_fill in order message

1.7.0

  • 17 June 2021
  • Support position, flags in order message

1.6.0

  • 1 June 2021
  • Support comment in order message

1.5.0

  • 28 May 2021
  • Support up to 8 decimal for price_order

1.4.0

  • 26 May 2021
  • Support decimal volume

1.3.0

  • 22 January 2021
  • Make datetime in deal message optional
  • Make comment in deal message optional

1.2.0

  • 6 August 2020
  • Supports comment field in external deal

1.1.0

  • 26 April 2018
  • Supports external deal DatetimeMsc

1.0.0

  • 13 April 2018
  • Supports login, logout, order, confirm, deal
  • Supports external deal submission to MT5
Open Source Agenda is not affiliated with "Devcartelgateway64" Project. README Source: devcartel/devcartelgateway64
Stars
41
Open Issues
2
Last Commit
2 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating