bool CheckRiskTrader(double lots) {
string webhook_url = "YOUR_WEBHOOK_URL";
string json = StringFormat("{\"action\":\"CHECK\",\"symbol\":\"%s\",\"volume\":%f}",
Symbol(), lots);
char post_data[];
StringToCharArray(json, post_data);
char result[];
string headers = "Content-Type: application/json\r\n";
int res = WebRequest("POST", webhook_url, headers, 5000, post_data, result, headers);
if(res == -1) {
Print("Error: ", GetLastError());
return true; // Allow trade if can't connect
}
string response = CharArrayToString(result);
return (StringFind(response, "\"allowed\":true") >= 0);
}
if (CheckRiskTrader(LotSize)) {
int ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, 3, 0, 0, "My order", 16384, 0, Green);
} else {
Alert("Trade blocked by RiskTrader!");
}
Tools โ Options โ Expert Advisors โ Allow WebRequests
Add URL: https://your-app.vercel.app
if (longCondition)
strategy.entry("Long", strategy.long,
alert_message='{"action":"OPEN","symbol":"' + syminfo.ticker + '","volume":' + str.tostring(position_size) + ',"price":' + str.tostring(close) + '}')
1. Create Alert on your strategy
2. Set Webhook URL to your RiskTrader webhook
3. Make sure "Webhook URL" is checked
import requests
WEBHOOK_URL = "YOUR_WEBHOOK_URL"
def check_trade(symbol, volume):
"""Check if trade is allowed before placing"""
response = requests.post(WEBHOOK_URL, json={
'action': 'CHECK',
'symbol': symbol,
'volume': volume
})
if response.status_code == 200:
data = response.json()
if not data['allowed']:
print(f"Trade blocked: {data.get('reason', 'Unknown')}")
if 'suggestion' in data:
print(f"Suggestion: {data['suggestion']}")
return data['allowed']
return True # Allow if API is down
# Example usage
if check_trade('EURUSD', 1.0):
# Place your trade here
place_order('EURUSD', 1.0)
else:
print("Trade not placed - risk limit reached")
curl -X POST YOUR_WEBHOOK_URL \
-H "Content-Type: application/json" \
-d '{"action":"CHECK","symbol":"EURUSD","volume":1.0}'
{
"allowed": true,
"dailyPL": 0,
"dailyLimit": 500,
"tradesLeft": 3
}
RiskTrader works with ANY platform that can send HTTP requests:
Need help with integration?
๐ง Email: beta@risktrader.ai
๐ฌ Community: Coming soon!
๐ Website: risktrader.ai
We're here to help you integrate successfully. Don't hesitate to reach out!