Skip to content

ahangarha/devcartelgateway64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

DevCartelGateway64

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
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 0 - good till cancel
1 - good till day
2 - good till specified
3 - good till specified day
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
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=8
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
datetime Deal timestamp

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
datetime Deal timestamp

Support

  • Report an issue here

Changelog

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

About

DevCartel MT5 gateway for MetaTrader 5 Platform

Resources

License

Stars

Watchers

Forks

Packages

No packages published