Tradingview Alert Connector
  • Overview
  • What is Tradingview Strategy
  • Setup
    • Run on local PC
    • Run on cloud service
    • Test Tradingview strategy alert
    • Set Tradingview strategy alert
    • How to get dYdX v3 Credentials
    • GMX Setup
    • dYdX v4 Setup
    • Bluefin Setup
    • Add Sentry.io monitoring
    • FAQ
  • Additional Usage
    • Execute order from non-strategy alert
    • Run DCA bot
Powered by GitBook
On this page
  1. Setup

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

PreviousRun on cloud serviceNextSet Tradingview strategy alert

Last updated 1 year ago

  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

dYdX v3:

{
"exchange": "dydx",
"strategy":"testStrategy",
"market":"BTC_USD",
"size":"0.001",
"reverse":false,
"order":"{{strategy.order.action}}",
"position":"{{strategy.market_position}}",
"price":"{{strategy.order.price}}"
}

dYdX v4:

{
"exchange": "dydxv4",
"strategy":"testStrategy",
"market":"BTC_USD",
"size":"0.0001",
"reverse":false,
"order":"{{strategy.order.action}}",
"position":"{{strategy.market_position}}",
"price":"{{strategy.order.price}}"
}

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}}"
}

GMX:

{
"exchange": "gmx",
"strategy":"testStrategy",
"market":"BTC_USD",
"sizeUsd":"3",
"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.

Webhook URL: HTTPS endpoint URL got in or

Running on local PC
Run on cloud service