Skip to main content

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

KeyValueDescriptionRequired
symbolEURUSD
CADUSD
...
Currency Pair
license_keystringYour Shadow.Trading License Key, which can be found in your profile
discord_channel_idstringTo get the Channel ID, refer to this link
typeLimitBuy
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.
pricefloatEntry price for Limit orders only (LimitBuy or LimitSell)🔗
timeout_secondsintTimeout seconds for Limit orders. If orders are not filled after X seconds, they will be automatically cancelled. This feature prevents manual actions.🔗
risk_percentagefloatYou 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
🔗
volumefloatYou need to choose between risk_percentage or volume, as at least one is required.
🔗
slfloatStoploss price, required when risk_percentage is set.🔗
tp1floatFirst Take Profit price, if set, qty1_percentage needs to be set also.-
qty1_percentagefloatFirst Take Profit Volume Percentage to take at the tp1 level
Ex: qty1_percentage=0.2 means 20% of the total volume to take when tp1 is reached
-
tp2floatSecond Take Profit price, if set, qty1_percentage needs to be set also.-
qty2_percentagefloatSecond Take Profit Volume Percentage to take at the tp2 level
Ex: qty2_percentage=0.3 means 30% of the total volume to take when tp2 is reached
-
tp3floatThird Take Profit price, if set, qty1_percentage needs to be set also.-
qty3_percentagefloatThird Take Profit Volume Percentage to take at the tp3 level
Ex: qty3_percentage=0.5 means 50% of the total volume to take when tp2 is reached
-
notification_onlybooleanDefault value is false
If true, it will just send notification to your Discord Channel and will not take any action on the exchange
-
commentstringA comment message that will be displayed in the Discord Notification-
testnetbooleanDefault 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.

KeyValueDescriptionRequired
symbolEURUSD
CADUSD
...
Currency Pair
license_keystringYour Shadow.Trading License Key, which can be found in your profile
discord_channel_idstringTo get the Channel ID, refer to this link
typeCloseBuy
CloseSell
Type of order
pricefloatClosing price-
entry_pricefloatEntry price, useful to calculate price variation in Discord notification-
notification_onlybooleanDefault value is false
If true, it will just send notification to your Discord Channel and will not take any action on the exchange
-
commentstringA comment message that will be displayed in the Discord Notification-
testnetbooleanDefault 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