# Test Tradingview strategy alert

1. On the Tradingview website, select BINANCE:BTCPERP(or whatever ticker your want) and set the time interval to 1 minute.

![](/files/qsXlMtEh39zFo0cv9BSi)

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)
```

![](/files/uZjRYv42BF2G2wakTx5o)

3\. Click Alert button

![](/files/VQ9SjTxOG8vhrZZnLpw5)

4\. At Create alert popup, Set “Webhook URL” and “Message” and click “Create”

**Webhook URL:** HTTPS endpoint URL got in [Running on local PC](/docs/setup/run-on-local-pc.md) or [Run on cloud service](https://tv-connector.gitbook.io/docs/setuup/run-on-cloud-service)

**Message:**  paste the following code

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

<img src="/files/QKdLDrCqBowEqn3tjuVm" alt="" data-size="original">

This alert is triggered every minute and creates a buy/sell order alternately.&#x20;

You can check if an order is executed on the exchange you selected after the first alert is triggered.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tv-connector.gitbook.io/docs/setup/test-tradingview-strategy-alert.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
