Setting up TradingView alerts for

This is a guide to setup sending alerts from TradingView to TradeLab. It assumes you know very little. If you know some things, you might be able to skip some parts

Introduction to Custom Alert Templates allows you to create trading bots and define their behavior. The behavior you define are rules, things like “If volume is greater than X then do something”. These rules run anytime you send an alert. Alerts tell TradeLab whats going on in the market, and the information inside the alert is processed through the rules you defined.

This means that Alerts are a very important part of and automating a strategy. Without alerts your strategy rules will never run and you won’t really have anything to process. When we send alerts to, the system needs to know what to expect. What information, in what format – this is where Alert Templates come in.

Alert Templates represent a set of data fields that are sent with an alert. Its important to setup an alert template so that TradeLab knows what data is in your alert, so you can easily setup strategies in the builder. Alert templates can be reused.

Not every alert must contain every field in the alert template – this means multiple alerts can use the same alert template even if they have differing fields. In simple terms: you could setup a single alert template and combine all of your data fields into one template. The reason TradeLab allows you to create multiple is to allow for organization, and easy import and export to share.

Deciding What Data We Need

Now that we know that Alert Templates are collections of data fields that we send to to make it do stuff – we now need to ask ourselves what data do we need?

This answer varies from situation to situation depending on what you are looking to do and how you wish to trade. Make no mistake, this is where trading knowledge comes in, understanding what information from a chart or indicator is important and when it needs to be sent.

In this step we aren’t doing anything but asking ourselves how do we trade, and why? Take a break and do some manual trading – see what decisions you are making and then ask yourself what data are you looking at to make those decisions? This is also where educational videos on different strategy types and techniques can come in handy.

To properly continue you will need to be able to identify on your chart or indicator what line/plot/data is important and how you want to use it. From here we can help you setup your alert into

Introduction to JSON

It’s recommended when creating alerts in TradingView that the Message body of the alert be formatted in JSON. JSON is a standard format for data. It can hold numbers, words (aka strings) or true/false. Each value has a field name. First comes the field name then the value. At the beginning and end of a list of data you use { and } Example:

{"myFieldName": "word value", "myNumberData": 6, "isOpen": true}

Notice that each field is wrapped in quotes. Also notice that when the value is words, you wrap them in quotes as well. When the value is a number, you do not wrap it in quotes. When the value is true or false you also do not wrap it in quotes. You’ll find more example alerts below.

Quickly Making Your First Alert Template

The Strategy Builder offers the quickest way to get started building alerts. If you are using TradingView or a similar alert system where it expects you to build the alert message yourself – you can use our handy Alert Builder to create your JSON for you.

Simply open the Strategy Builder by going to “My Strategies > New” and then hit the Alert Builder button. If you do not already have an alert template set up – the alert builder will pop up automatically.

After deciding what data you need, you should have an idea of what information you will be sending. For example if you need to know when volume is above a certain amount, part of your alert message should contain a “volume” field.

To do this open the Alert Builder and you will see three default fields. These are usually fields you should keep as they tell the basics of what type of alert this is, what symbol its for, and what time/chart interval it’s for. You can add your volume field as a fourth field by clicking on the “+” add button above the field list, and within the new field input typing “volume” and selecting “Number” in the type dropdown. Now your JSON at the top has changed to include this information.

The values that you enter on the Alert Builder are temporary and only used in the generated JSON. This is here to help you create multiple alert messages quickly so you can create multiple TradingView alerts pointed to the same Webhook Url using the same alert template. As long as the fields match – the values can be different every time.

You can click on this generated JSON to copy it and then open your TradingView alert and paste it into the Message box.

How to Make an Alert in TradingView

Making an alert in TradingView is fairly straight forward. Open the Alert panel on the right, click the add alert button and then fill out the popup.

For more information on how trading view alerts work click here

TradingView Plots

TradingView allows you to insert dynamic values directly from the live chart at the time the alert is sent.

This is how you can send values like vwap, moneyflow and other things directly out of TradingView and into TradeLab so that you can perform more math and other comparisons. To do this you surround the field from the TradingView indicator in curly brackets with a special “plot” prefix


You will need to consult with the indicator developers or the code (google usually helps) on what the field names are for your indicator. Example – if the field in TradingView is called “vwap” (a number value) sending to a field in TradeLab called “myVwapField”:

{ "myVwapField": {{plot("vwap")}} }

Example if the field was a string and not a number

{ "lineType": "{{plot("line_type")}}" }

Example of a simple normal alert:

{ "symbol": "BTCUSD", "interval": "1d", "type": "buy_signal", "vwap": {{plot("vwap")}} }

Creating an Alert Template from Scratch

In other situations you may need to edit an existing Alert Template or create a new one from scratch using an alert you’ve already made or that was made for you. Sometimes we can’t always control what alerts are sent to us – like say if we buy alerts from somewhere. In these cases allows you to set up the alert based on an example, or even by capturing an example for you.

  1. In TradeLab go to Alerts > Custom Alert Template > Create New. Name your template
  2. Create your alert in TradingView, according to the section above.
  3. Hit the “Example Alert” button. Copy the “Message” from the TradingView Alert window, and paste it into the Example Alert popup. Hit save.
  4. Fields should appear at the bottom of the page. Descriptions are not mandatory, they help when sharing strategies, as they appear as help text in the builder.
  5. Click the link box to copy the Webhook URL. Paste this into the Webhook URL inside the TradingView alert window. You will use this same URL for all alerts that match the fields shown in the list from step 4. If you make a new alert that has another new field, you must add that to the template by repeating step 3 and pasting the new alert that includes the new field. All fields combine, so don’t worry about overriding or losing fields.
  6. Open the Strategy Builder Main Menu > Strategies > Build New Strategy
  7. Hit the blue Add Entry Rule button Press the + next to Conditions to add a new condition to the rule.
    1. Note: A condition is just like an if statement “If X is true, then do Y” Rules work the same way, all conditions in a rule must be met, then the actions are run. The first dropdown determines what type of field you want. In our case we want Custom Alerts since we just made a custom alert template. In the Field dropdown you should see your fields from your alert.

You can now use the strategy builder to create alerts using your TradingView alerts. As long as your alert in TradingView is pointed to the Webhook URL from earlier, your alerts will send to TradeLab. Each time an alert comes in, all of your strategies run their rules.

A note about symbols, intervals, and heartbeats

Typically an alert might come with some fields like “symbol” and “interval” to describe what chart the alert is for.

Remember because rules from all strategies run for each alert, any rule that you wish to run only for a particular symbol or interval must include a condition targeting that symbol/interval. Just because a strategy is set to a particular symbol (at the top in Trade Details) doesnt mean the rules will only run for alerts with “symbol”: “X”.

Strategies can listen for alerts across symbols. This allows an ETH strategy to change its behavior off of a BTC signal if you wanted. This also means that if you do not include any symbol or interval condition, that rule will run on every alert.

Built into TradeLab are “heartbeat” alerts which run every 60 seconds. This ensures your strategy rules run at least once a minute, allowing you to create rules with no symbol or interval that would always be checked every minute. This is useful for things like custom take/stop rules, checking stored variables, etc.

Additional Examples

Below you will find an example of two rule blocks, one which will only run if the alert matches the correct symbol and interval and another rule that will always run, once a minute:

Related Alert Example: (this would be the TradingView alert message)

{"symbol": "BTCUSD", "interval": 60, "type": "buy_signal"}

One comment

  1. I think that what you said made a bunch of sense. However,
    what about this? suppose you added a little information? I am not suggesting your information is
    not good., however suppose you added something that grabbed a person’s attention? I mean Setting up
    TradingView alerts for | is a little vanilla.
    You ought to glance at Yahoo’s front page and see how they write post titles
    to grab people to click. You might try adding a video or a related pic or two to get
    people interested about what you’ve written. In my opinion, it would bring your posts a little livelier.

Leave a Reply