# Set Tradingview strategy alert

1. Go to the following website and generate an alert message

<https://alert-message-generator.vercel.app/>

On this website, users can build [JSON formatted alert message](/docs/setup/set-tradingview-strategy-alert.md#alert-message-json-format) easily using the following step.

Input each parameter on the left side and click “GENERATE” button. Then on the right side copy generated JSON by clicking “Copy to clipboard”

<figure><img src="/files/GOOku8fopN3IwTIxyybz" alt=""><figcaption></figcaption></figure>

We recommend setting a small order size to test your strategy and the bot's behavior.

2\. At The Tradingview website, choose Market and strategy you want to use. show that strategy on your chart.

![](/files/Y9t5odetE0PJyfs5vUgz)

3\. At “Strategy Tester” tab, Click the alert button

![](/files/f5jSmHLMiJ1FXm4oVQTN)

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

* **Webhook URL:** your endpoint URL to receive alerts
* **Message:** paste generated JSON which created at Step1

![](/files/rN27akZImSVnkmUkf7dQ)

Other fields are optional to set.

That's it! Please wait until your strategy alert is triggered and execute an order

![executed order automatically to dYdX](/files/DXACDuaxbSc5JFZpsBCb)

<figure><img src="/files/gJcacYbYk84VXwbJfAyf" alt=""><figcaption><p>executed order automatically to Perpetual Protocol</p></figcaption></figure>

#### "reverse" parameter

If you set "reverse" parameter to true in the alert message, this tool doubles order size from your second order so that position on dYdX is matched to Tradingview's one. Please give a different strategy name in "strategy" parameter to each strategy.&#x20;

Each strategy data is stored as a JSON file in `/data/strategies` folder.

You can reset to the initial state by deleting this JSON file (or modifying in JSON file)&#x20;

```
rm -rf ./data/strategies/[mainnet | testent]
```

#### Order History CSV

Order history data is stored in /data/exports folder in CSV format.

You can transfer that CSV file by scp command

{% embed url="<https://render.com/docs/disks#transferring-files>" %}

#### Alert message JSON format

<table><thead><tr><th width="160.66505513975397">Key</th><th width="221.09589511021971">Value</th><th>Description</th></tr></thead><tbody><tr><td>exchange </td><td>dydx | perpetual | gmx | dydxv4 | bluefin | hyperliquid</td><td>If you don't set this parameter, exchange is regarded as "dydx v4" to be compatible with older version.</td></tr><tr><td>strategy</td><td>any string to distinct each strategy</td><td>please avoid containing "/"</td></tr><tr><td>market</td><td>market to trade.</td><td>Must be XXX_<em>USD format(ex. BTC_USD)</em></td></tr><tr><td>size</td><td>Number of order size(amount) or {{strategy.order.contracts}}</td><td>ex. 0.1 for 0.1 BTC order. Can be also set to "{{strategy.order.contracts}}" if you want to retreive size from strategy parameter.</td></tr><tr><td>sizeUsd</td><td>Number of order size in USD</td><td>Required field for GMX.</td></tr><tr><td>sizeByLeverage</td><td>Number</td><td>optional field when you want to specify size by leverage.<br>ex. 0.1 for 10% of your collateral balance.</td></tr><tr><td>reverse</td><td>true or false</td><td>Set true if this strategy takes opposite position on each trade and always has long or short position</td></tr><tr><td>order</td><td>{{strategy.order.action}}  or "buy" | "sell" </td><td>Use {{strategy.order.action}} if order direction is specified on TradingView  strategy </td></tr><tr><td>position</td><td>{{strategy.market_position}} or "long" | "short" | "flat" </td><td></td></tr><tr><td>price</td><td>{{strategy.order.price}}</td><td></td></tr><tr><td>passphrase</td><td>any string</td><td>optional but recommended to enhance security</td></tr></tbody></table>

Please specify only one of the `size`, `sizeUsd` or `sizeByLeverage` field.

Reference:

{% embed url="<https://www.tradingview.com/support/solutions/43000481368-strategy-alerts>" %}


---

# 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/set-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.
