Scripting Basics

Using scripting you can create your own custom alert, combining multiple existing indicators, optionally spanning multiple trading periods.

Indicators are all about comparing values. For example, consider an alert that triggers when the RSI becomes overbought. This is realized by comparing the value of the RSI with the number 80. Specifically, we are comparing these values using the "greater than" comparison operator in order to check for the RSI being overbought: "RSI > 80".

Scripts are put together using the following structure:

  • A script consists of a number of conditions. For example, an alert that triggers when a golden cross occurs while the RSI is overbought consists of two conditions:
    1. The RSI being overbought.
    2. A golden cross takes place.
  • Each condition consists of two expressions (values) that are compared using a comparison operator. For example, the condition "RSI overbought" is represented by comparing the RSI (first expression), using the comparison operator greater than (>), with the value 80 (second expression representing the overbought range).
  • Expressions can be picked from a predefined list. Example expressions are the RSI, the candlestick opening price, an Exponential Moving Average or a fixed value (like 80).
  • Some expressions like the RSI take additional parameters, such as the length and the period (e.g. the hourly).
  • When scripts are evaluated the expressions result into values that are compared. The values can be taken "as is" (unmodified), or, you can apply a modifier. Using a modifier, you can e.g. take the previous value, or an average over a window of values. Please refer to the section on Advanced Scripting for more information.

Given the structure defined above, the condition "RSI overbought" can then be represented as follows:

FIRST EXPRESSION (A)
4 hours
RSI
Length14
COMPARISON OPERATOR
<>=ƒ
SECOND EXPRESSION (B)
Value: Number
Number80

When evaluating scripts the following rules apply:

  • Alerts only fire when all conditions hold.
  • Alerts only fire when the actual status changes. So, if you aiming for "RSI overbought", you will only get an alert when the RSI actually changes from neutral to overbought.