Our plans and pricing are changing on 1st November. Learn more...

Automated Trading Trading Groups

Signals in Trading Groups

'Signals' are a key feature of Trading Groups. By keeping your trading scripts separate from your alerts, it is simpler to maintain and manage for large and complex groups and stategies.

What are signals

Within your trading group you can define any number of 'signals' that you'll send to Alertatron in an alert. Each signal contains the following :-

  • A name. You'll reference the signal using it's name in your alert.
  • A trading script. This is the script that will be executed in all your clients accounts each time this signal arrives.
  • A symbol. This is the symbol / market that the script will trade on, such as XBTUSD for a BitMEX trading group.

This is slightly different from regular automated trading in Alertatron, where you just place the script directly into the alert message.

A walkthrough of an example signal...

Some example signals in a trading group
Some example signals in a trading group

In the image above you can see the signals in an example trading group. There are 2 signals defined.

Both signals are configured to trade on the BTCUSD symbol.

The first signal is called long - we'll be triggering this one when our strategy wants to go long. The second is called short, and deals with entering a short position.

In the first box you'll see the script we want to use when the signal is triggered. You can use any Alertatron trading script here and we'll automatically fill in the exchange and symbol details.

In the second box you'll see the text you'll need to add to your alert message in order to trigger the signal. You can have other text in your alert message if you like, but the alert will need to contain at least this text for the signal to work.

Lets take a look at the text that has to be added to the alert message...

----
signal: long
#ExampleTradingGroup

The most important bit is the line starting signal:. This identifies which signal the alert message should trigger. You can see the name of the signal after signal: ('long' in this example).

Signal names can be pretty much anything you like, as long as they fit on a single line, though we recommend that you keep them short and informative to avoid confusion.

The hashtag below it causes the alert to be routed into the trading group. Once there, the associated script can be looked up and executed on every one of your clients accounts.

Variables in Scripts

Sometimes it is useful to pass in pre-calculated values for your scripts to use, such as stop loss levels, or take profit prices. Signals in trading groups support this via a simple system that users of TradingView might be familiar with.

Variables in script always look like this: {{name}}, where name is the name of the variable. You can use any name you like, as long as it only uses letters, numbers, underscore (_) and hyphen (-). You can have spaces between the double curly brackets and the variable name if you like. All of the following are valid variables:-
{{ takeProfit }}, {{takeProfit}}, {{ Stop_Loss_1 }} etc.

Names are not case sensitive, so {{ takeprofit }} and {{ TakeProfit }} are considered the same.

The whole variable ({{name}}) will be replaced with a value before your script is executed. For example, if takeProfit has a value of 10000, then we'll replace {{takeProfit}} with 10000 everywhere we find it in your script.

Sending values for your variables

So how do you pass along values to use in your script?

Let's take a look at a simple example script...

bybitTestnet(BTCUSD) {
  market(side=buy, amount=100%);

  # take profit at the target price
  limit(position=0, offset=@{{TakeProfitPrice}});
}

Once your script looks like this (we've added a variable called TakeProfitPrice that is expecting an absolute price to be used in it's place), you'll notice that the text to send in your alert has also been update and will now look something like this...

----
signal: long
takeprofitprice: ???
#ExampleTradingGroup

As you can see, a new line has appeared that contains the name of your variable, a colon, then 3 question marks. You'll need to replace the ??? with the actual value you want to pass into the script when you send the alert. This value can come direcctly from your strategy and be different every time the alert is sent, or could be just a fixed value you can edit in your alert.

If you use TradingView to fire your alerts, their feature for adding values from indicators into alert message might be of interest. You can learn more about this in our article on Including the current price in your alerts. Replace the three question marks with one of their placeholders.

Sending Several Signals in the same alert

You can send several signals at once, even from several trading groups.

If we had another signal that we wanted to trigger at the same time, just include the text for both signals in your alert message. For example...

----
signal: long
takeprofitprice: ???
#ExampleTradingGroup
----
signal: another
anothervalue: ???
#ExampleTradingGroup

Note: If you are using placeholder values in your signals (takeprofitprice and anothervalue in the example above), you can not use values of the same name in different signals. Simply use different names in each signal.

Some images from Unsplash

About Alertatron.com

Your TradingView alerts, with charts, PM'd to you.

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.