24. Connecting Your Strategy to Perpbot
Once you’re happy with a backtested strategy:
Make sure it uses clear alert messages:
"long"for opening longs."short"for opening shorts."close_long"and"close_short"(or generic"close") for closing positions.
Then in TradingView:
Click the Alarm/Alert icon on your chart.
In “Settings”:
Select the corresponding strategy you saved as condition (e.g. Perpbot Strategy 1). Make sure to do this on the time frame you wish to automate on.
Set Interval as the time interval you want to trade on
Set expiration to Open Ended (only available for Premium Tradinview subscription). Otherwise, set to the expiration you like and update it every month.
In “Message", paste exactly the JSON Perpbot expects shown below. Notice they are all the same for all actions as
{{strategy.order.alert_message}}is used.
Open Long
{
"action": "{{strategy.order.alert_message}}",
"symbol": "BTCUSDT",
"leverage": 20,
"quantity": "25%",
"secret": "YOUR_STRATEGY_PASSWORD"
}Open Short
{
"action": "{{strategy.order.alert_message}}",
"symbol": "ETHUSDT",
"leverage": 20,
"quantity": "25%",
"secret": "YOUR_STRATEGY_PASSWORD"
}Close Position
{
"action": "{{strategy.order.alert_message}}",
"symbol": "ETHUSDT",
"leverage": 20,
"quantity": "25%",
"secret": "YOUR_STRATEGY_PASSWORD"
}Key points:
action: {{strategy.order.alert_message}} is one of "long", "short", or "close" (case-insensitive).
symbol: Aster futures symbol (e.g. BTCUSDT, ETHUSDT).
leverage: integer leverage (1–125) for non-close orders.
quantity:
"25%"= use 25% of account (based on available balance & leverage)."$100"= roughly $100 of notional (depending on your leverage/mode).
secret: must match the password you set for the strategy; otherwise Perpbot rejects the alert.
In “Notifications”:
Enable Webhook URL.
Paste your Perpbot strategy webhook URL shown in Perpbot when you select your strategy:
https://webhook.perpbot.io/yourToken
Important: You should only automate a strategy after you’ve:
Backtested it over a decent sample size.
Checked drawdown is tolerable.
Appropriate safety measures.
PLEASE NOTE: YOU CAN ONLY HAVE 1 LONG OR SHORT ACTIVE AT ONE TIME PER STRATEGY.
Last updated