Include current price and more in your alerts

26 October 2019

Using TradingView alerts, it is now possible to add the current price, indicator values and more into your alert messages. Here we explain how...

TradingView now let you add special placeholders into your alert message text (when you create or edit an alert) that are replaced with key trading data at the moment the alert is sent to you.

Let's start with an example alert message text...

The current price of {{ticker}} is {{close}}!

When an alert with this message text is sent to you, {{ticker}} will be replaced with the ticker symbol that the alert was set up on. {{close}} will be replaced with the close price on the current candle. So the message your receive might look more like this...

The current price of XBTUSD is 10000!

Here is a list of all the standard values that you can now drop into your alert messages...

Placeholder Replaced with
{{open}} The opening price of the current candle.
{{high}} The high price of the current candle.
{{low}} The low price of the current candle.
{{close}} The closing price of the current candle. AKA, the current price
{{volume}} The volume on the current candle.
{{time}} The current bar time (in ISO8601 format, eg: 2019-10-01T15:52:00Z)
{{timenow}} The exact time the alert was sent from TradingView (in ISO8601 format, eg: 2019-10-01T15:52:00Z)
{{ticker}} The current ticker (eg XBTUSD).
{{exchange}} The exchange the ticker is from (eg BITMEX).

What about values from my indicators?

Yes, that's possible too.

Let's say you have an indicator that gives you signals to open and close positions, and tracks a Stop Loss price and a Take Profit price for you. Ideally you want to be able to send out the SL and TP values with the alert, so you can either auto-trade using those values, or use them in manual trading.

All the indicator values that are plotted can be accessed. The Data Window (a panel on the right hand side of TradingView) shows you all the values exposed by an indicator.

Below are the placeholders for plotted values in your indicators...

Placeholder Replaced with
{{plot_0}} The value of the first plot in your indicator.
{{plot_1}} The value of the second plot in your indicator.
... and so on...

Working out the exact order of your plots, so you know which one is which is a little fiddly at the moment and will likely require a bit of trial and error and testing. Check the order in the Data Panel - that will be a great place to start. If you wrote the indicator in PineScript, then it should be the order your plot() calls appear in the script.

Using the names of plots

You can also refer to the names of each of the plots, which can easier to use. The name is the title given to the plot in pinescript.

Placeholder Replaced with
{{plot("Name")}} The value of the plot with the title Name in your indicator.

How can I use this...

Let's make an automated trading command to open an order, set a stop loss and take profit using the price given in an imaginary indicator we might have that plots the take profit line and stop loss line.

We'll assume that the Stop Loss price turns out to be in plot 1, and the take profit price in plot 2.

myApiKeys({{ticker}}) {
    marketOrder(side=buy, amount=100);
    stopOrTakeProfit(side=sell, amount=100, sl=@{{plot_1}}, tp=@{{plot_2}})
}

We are using the special 'absolute price' notation for sl=... and tp=.... For example, to set at stop loss at the exact price of $10,000 (regardless of what the current price is), the automated trading bot allows us to write sl=@10000. In the example above, {{plot_1}} and {{plot_2}} are replaced with the target prices.

Learn More...

Some images from Unsplash

About Alertatron.com

Your TradingView alerts, with charts, PM'd to you.
Auto-trade on any alert.

Get all your alerts from TradingView, sent to Telegram, Discord, Slack, Email or webhooks, with a chart snapshot attached.

Capture Charts

See a high quality chart with every alert, captured at the moment the alert was triggered. See exactly what the market was doing and make informed decisions.

Automate Trading

Trigger orders on popular cryptocurrency exchanges and trade 24/7. Access powerful algorithmic orders to maximise your profits.

Integrations

Connect your alerts to Telegram (channels, groups and private chats), Discord, Slack, email or send push notifications to other services with webhooks.

Easy To Setup

Nothing to install and no browser extensions. Captures alerts 24/7, even with your computer switched off. Be up and running in seconds.

Related content

Guide

How we calculate alert usage

Your usage is measured using a continuous 30 day rolling total. Here's how that works...

Read more

Guide

Adjusting the symbol and time interval on saved TradingView charts

TradingView has a feature that lets you view any of your shared charts using a different symbol or time interval to the one used on the saved chart. Alertatron offers a couple of ways you can use this to adjust your charts for each alert that arrives.

Read more

Guide

Keeping your alerts organized

It's too easy to end up with all your alerts mixed up in a big mess. Here's how we recommend you keep things organised and ensure you see the right alerts in the right places at the right times.

Read more

Guide

Making use of groups

Groups provide a powerful way to filter your alerts into different categories. Each group can have its own set of integrations linked to it so each group can forward alerts to different places.

Read more

Guide

Troubleshooting guide

Answers to common questions and problems

Read more

Guide

Sending alerts to Telegram

Telegram is our most popular integration, so it makes sense to include a step by step guide to help you get started. Each Telegram integration you add can send alerts to a single chat, group or channel, and there are a couple of simple steps to go through to securely link up Alertatron and your chat session.

Read more