Trading Connector - Metatrader 5
API Endpoint
If you have your own trading system, you can use the following url to open and close trades
https://webhook.shadow.trading/trade-metatrader
TradingView Webhook Endpoint
For Webhook alerts are sent from TradingView Platform use the following endpoint. No rate limiting applied to this endpoint.
https://webhook.shadow.trading/view/trade-metatrader
Important Note: Using this endpoint through your local machine won't work as it check the IP Address of the request comes from TradingView.
Message structure
Send POST request with the following body example
POST https://webhook.shadow.trading/trade-metatrader
Content-Type: text/plain
symbol=EURUSD&license_key=...&discord_channel_id=&comment=...&api_key=...&secret_key=...&testnet=false&price=1873.55&type=LimitSell...
The Body sent to the endpoint is under the form [key]=[value]
, with each key-value pair separated by &
.
(Note: The "🔗" symbol in the table denotes parameters that are linked or dependent on other parameters.)
Open trade parameters
Key | Value | Description | Required |
---|---|---|---|
symbol | EURUSD CADUSD ... | Currency Pair | ✅ |
license_key | string | Your Shadow.Trading License Key, which can be found in your profile | ✅ |
discord_channel_id | string | To get the Channel ID, refer to this link | ✅ |
type | LimitBuy LimitSell MarketBuy MarketSell | Type of order:LimitBuy Limit order for Long trade.LimitSell Limit order for Short trade.MarketBuy Market order for Long trade.MarketSell Market order for Short trade.For Limit type orders, price is required. | ✅ |
price | float | Entry price for Limit orders only (LimitBuy or LimitSell) | 🔗 |
timeout_seconds | int | Timeout seconds for Limit orders. If orders are not filled after X seconds, they will be automatically cancelled. This feature prevents manual actions. | 🔗 |
risk_percentage | float | You need to choose between risk_percentage or volume , as at least one is required. If risk_percentage is set, then the sl key is needed as well.Example: risk_percentage=0.02, the volume will be automatically calculated to risk only 2% of your account balance | 🔗 |
volume | float | You need to choose between risk_percentage or volume , as at least one is required. | 🔗 |
sl | float | Stoploss price, required when risk_percentage is set. | 🔗 |
tp1 | float | First Take Profit price, if set, qty1_percentage needs to be set also. | - |
qty1_percentage | float | First Take Profit Volume Percentage to take at the tp1 levelEx: qty1_percentage=0.2 means 20% of the total volume to take when tp1 is reached | - |
tp2 | float | Second Take Profit price, if set, qty1_percentage needs to be set also. | - |
qty2_percentage | float | Second Take Profit Volume Percentage to take at the tp2 levelEx: qty2_percentage=0.3 means 30% of the total volume to take when tp2 is reached | - |
tp3 | float | Third Take Profit price, if set, qty1_percentage needs to be set also. | - |
qty3_percentage | float | Third Take Profit Volume Percentage to take at the tp3 levelEx: qty3_percentage=0.5 means 50% of the total volume to take when tp2 is reached | - |
notification_only | boolean | Default value is false If true , it will just send notification to your Discord Channel and will not take any action on the exchange | - |
comment | string | A comment message that will be displayed in the Discord Notification | - |
testnet | boolean | Default value is false | - |
Close trade parameters
If Stop Loss and Take Profit are both set when entering trade, you may not need to exit trade with request call. As it is already setup on trades.
Key | Value | Description | Required |
---|---|---|---|
symbol | EURUSD CADUSD ... | Currency Pair | ✅ |
license_key | string | Your Shadow.Trading License Key, which can be found in your profile | ✅ |
discord_channel_id | string | To get the Channel ID, refer to this link | ✅ |
type | CloseBuy CloseSell | Type of order | ✅ |
price | float | Closing price | - |
entry_price | float | Entry price, useful to calculate price variation in Discord notification | - |
notification_only | boolean | Default value is false If true , it will just send notification to your Discord Channel and will not take any action on the exchange | - |
comment | string | A comment message that will be displayed in the Discord Notification | - |
testnet | boolean | Default value is false | - |
Request examples
In all the following examples, we assume you provide license_key
and discord_channel_id
.
1. Place a buy limit order for EURUSD with SL and 2 TPs and cancel order after 1 hour if not filled and risk 2% of your account balance per trade.
symbol=EURUSD&type=LimitBuy&risk_percentage=0.02&price=1.1800&sl=1.1750&tp1=1.1850&qty1_percentage=0.3&tp2=1.1900&qty2_percentage=0.7&timeout_seconds=3600
2.1. Place a sell market order for EURUSD with Stop Loss and risk 5% of your account balance per trade.
symbol=EURUSD&type=MarketSell&sl=1.1850&risk_percentage=0.05
2.2. Close a previous sell position EURUSD
We provide here entry_price
and price
in order to send well formatted notification on Discord, with Win or Loss notification.
symbol=EURUSD&type=CloseSell&entry_price=1.1800&price=1.1750
3. Place a buy market order for 1 Lot of EURUSD with SL and TP
symbol=EURUSD&type=MarketBuy&volume=1&sl=1.1750&tp1=1.1850&qty1_percentage=1