Each strategy maps to ONE TradingView alert that fans out to multiple exchanges.
The middleware resolves base_asset to each exchange's native symbol
(HL: BTC, Bybit: BTCUSDT) automatically.
Order size per signal comes from the TradingView alert payload
("quantity", in base-asset units like 0.001 BTC),
letting your pine-script sizing logic drive it.
File: /app/data/strategies.yaml. Every write requires the
webhook secret.
Paste this into the alert's
Message field, replacing the secret:
{
"secret": "<paste WEBHOOK_SECRET here>",
"strategy_id": "MR_VOTING_BTC_6H",
"action": "{{strategy.order.action}}",
"quantity": {{strategy.order.contracts}},
"alert_id": "{{time}}"
}
{{strategy.order.contracts}} is the order size in
base-asset units (e.g. 0.001 = 0.001 BTC), as computed by
your pine-script sizing logic — NOT a USD amount.
{{strategy.order.action}} auto-fills as
buy /
sell.
{{time}} in
alert_id is the dedup key —
a bar that repaints and re-fires the same signal collapses to one alert.
Keep it to a
single placeholder: TradingView's editor flags
a JSON warning if you concatenate several (e.g.
{{ticker}}_{{interval}}_{{time}}). strategy_id already
makes the key unique per strategy, so
{{time}} alone is
enough.
Per-signal sizing is fully driven by TradingView — change your strategy's
sizing logic and the middleware honours it without any config change here.
If your pine script sizes in dollars, convert in pine before sending:
qty = cash_size / close.