# Alerts

{% stepper %}
{% step %}

### Add Alert

<div data-with-frame="true"><figure><img src="https://3353728891-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1dlOGDREop4WMfLcctYT%2Fuploads%2FiOntTnpwgHDfrYBjgctU%2Fimage.png?alt=media&#x26;token=f5b2094c-98a8-4cf4-ba21-9480f15b524f" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Set Condition and Expiration Date

<div data-with-frame="true"><figure><img src="https://3353728891-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1dlOGDREop4WMfLcctYT%2Fuploads%2FtrraRpEvN3QQMcNIFjy2%2Fimage.png?alt=media&#x26;token=a8f0b23d-66dd-4fd3-9198-b603ce93eb75" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Customize the Alert Message

<mark style="color:$info;">Enter a clear</mark> <mark style="color:$info;"></mark><mark style="color:$info;">**Alert Name**</mark> <mark style="color:$info;"></mark><mark style="color:$info;">and edit the</mark> <mark style="color:$info;"></mark><mark style="color:$info;">**Message**</mark> <mark style="color:$info;"></mark><mark style="color:$info;">that will appear when the alert triggers.</mark>\ <mark style="color:$info;">You can also add</mark> <mark style="color:$info;"></mark><mark style="color:$info;">**placeholders**</mark> <mark style="color:$info;"></mark><mark style="color:$info;">like</mark>

* `{{ticker}}` <mark style="color:$info;">- ticker of the symbol used in alert (AAPL, BTCUSD, etc.)</mark>
* `{{interval}}`  <mark style="color:$info;">- returns the interval (i.e. timeframe/resolution) of the chart that the alert is created on</mark>
* `{{strategy.position_size}}` <mark style="color:$info;">- returns the value of the same keyword in Pine, i.e., the size of the current position.</mark>
* `{{strategy.order.action}}` <mark style="color:$info;">- returns the string “buy” or “sell” for the executed order.</mark>
* `{{strategy.order.contracts}}` <mark style="color:$info;">- returns the number of contracts of the executed order.</mark>
* `{{strategy.order.price}}` <mark style="color:$info;">- returns the price at which the order was executed.</mark>
* `{{strategy.order.id}}` <mark style="color:$info;">- returns the ID of the executed order (the string used as the first parameter in one of the function calls generating orders: strategy.entry, strategy.exit or strategy.order).</mark>
* `{{strategy.order.comment}}` <mark style="color:$info;">- returns the comment of the executed order (the string used in the comment parameter in one of the function calls generating orders: strategy.entry, strategy.exit or strategy.order). If no comment is specified, then the value of</mark> <mark style="color:$info;"></mark>*<mark style="color:$info;">strategy.order.id</mark>* <mark style="color:$info;"></mark><mark style="color:$info;">will be used.</mark>
* `{{strategy.order.alert_message}}` <mark style="color:$info;">- returns the value of the alert\_message parameter which can be used in the strategy's Pine code when calling one of the functions used to place orders: strategy.entry, strategy.exit or strategy.order. This feature is only supported in Pine v4 and higher.</mark>
* `{{strategy.market_position}}` <mark style="color:$info;">- returns the current position of the strategy in string form: “long”, “flat”, or “short”.</mark>
* `{{strategy.market_position_size}}` <mark style="color:$info;">- returns the size of the current position as an absolute value, i.e. a non-negative number.</mark>
* `{{strategy.prev_market_position}}` <mark style="color:$info;">- returns the previous position of the strategy in string form: “long”, “flat”, or “short”.</mark>
* `{{strategy.prev_market_position_size}}` <mark style="color:$info;">- returns the size of the previous position as an absolute value, i.e. a non-negative number.</mark>

<div data-with-frame="true"><figure><img src="https://3353728891-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1dlOGDREop4WMfLcctYT%2Fuploads%2F6Je4EuDPXCrWAWmoO9Jm%2Fimage.png?alt=media&#x26;token=ca39c578-6e35-4f9a-b1cc-052e31c86f75" alt=""><figcaption></figcaption></figure></div>

**Example:**\ <mark style="color:$info;">Alert name: SMC Backtester</mark>\ <mark style="color:$info;">Message:</mark>&#x20;

{\
"symbol":"{{ticker}}"\
"size":"{{strategy.order.action}}"\
"qty":"{{strategy.position\_size}}"\
"price":"{{close}}"\
"trigger\_time":"{{timenow}}"\
}
{% endstep %}

{% step %}

### Click **Create Alert**

<mark style="color:$info;">Once all settings are configured — click</mark> <mark style="color:$info;"></mark><mark style="color:$info;">**Create Alert**</mark> <mark style="color:$info;"></mark><mark style="color:$info;">to activate it.</mark>\ <mark style="color:$info;">Your alert will now monitor the (SMC) Backtester trades automatically and send a notification as soon as the trade appears.</mark>
{% endstep %}
{% endstepper %}
