Test Tradingview strategy alert
After server setup is done, this guide shows how to test you can receive strategy alert from Tradingview and execute order
- 1.On the Tradingview website, select BINANCE:BTCPERP(or whatever ticker your want) and set the time interval to 1 minute.

2. Open "Pine Editor" tab and paste the following script after deleting shown original script. Then click "Add to chart"
//@version=5
strategy("My test strategy")
_TestPeriod() =>
time >= timenow - 10000000 ? true : false
if _TestPeriod()
if (bar_index % 2 == 0)
strategy.entry("My Long Entry Id", strategy.long)
else
strategy.entry("My Short Entry Id", strategy.short)

3. Click Alert button

4. At Create alert popup, Set “Webhook URL” and “Message” and click “Create”
Message: paste the following code
For dYdX:
{
"exchange": "dydx",
"strategy":"testStrategy",
"market":"BTC_USD",
"size":"0.001",
"reverse":false,
"order":"{{strategy.order.action}}",
"position":"{{strategy.market_position}}",
"price":"{{strategy.order.price}}"
}
For Perpetual Protocol:
{
"exchange": "perpetual",
"strategy":"testStrategy",
"market":"BTC_USD",
"size":"0.001",
"reverse":false,
"order":"{{strategy.order.action}}",
"position":"{{strategy.market_position}}",
"price":"{{strategy.order.price}}"
}

This alert is triggered every minute and creates a buy/sell order alternately.
You can check if an order is executed on the exchange you selected after the first alert is triggered.
Last modified 1mo ago