Actions
Actions are elements tied to a user set condition producing a specific effect when the assigned condition is true. These allow users to have more control over their scripted alert, from invalidating sequences, to plotting graphical elements on the chart.
Actions always have the structure @keyword() = ...
, starting with @
, with an identifier, and ()
.
=
will assign to the action a condition. When the assigned condition is true the action will trigger.
Like functions in classical programing languages, actions can have arguments located within ()
, adding further degrees of control over the action.
All actions arguments are optional.
This page lists out the available actions syntax as well as their utility.
@alert
The @alert
action allows users to get alerted when the associated condition is true.
Arguments
message (string): Alert message. Default is the associated condition.
Examples
@label
The @label
action allows users to draw labels on the toolkit pane when the associated condition is true.
Syntax
Arguments
y (placeholder): y coordinate value of the label. Accepts data placeholders as values. Default is "{close}"
.
text (string): text displayed on the label. Default text is the condition.
Placeholders can be used within the text, these will be replaced with the corresponding value. For example:
color (color): color of the label. Possible values include:
Default is the opposite color to the chart background.
text_color (color): color of the text displayed on the label. Possible values include:
Default is the chart background color.
style (string): Shape of the displayed label, possible values include:
"none"
"xcross"
"cross"
"triangleup"
"triangledown"
"flag"
"circle"
"arrowup"
"arrowdown"
"label_up"
"label_down"
"label_left"
"label_right"
"label_lower_left"
"label_lower_right"
"label_upper_left"
"label_upper_right"
"label_center"
"square"
"diamond"
Default is "label_down"
Examples
Remarks
Currently, the value in y
does not fully support historical referencing.
@line
The @line
action allows users to draw lines on the toolkit pane when the associated condition is true.
Syntax
Arguments
x1 (integer): How far ahead from the current bar the x1 coordinate of the line is located. Accepts negative values. Default is "0"
.
y1 (placeholder): y1 coordinate value of the line. Accepts data placeholders as values. Default is "{close}"
except for the Oscillator Matrix® which uses 50.
x2 (integer): How far ahead from the current bar the x2 coordinate of the line is located. Accepts negative values. Default is "0"
.
y2 (placeholder): y2 coordinate value of the line. Accepts data placeholders as values. Default is "{close}"
except for the Oscillator Matrix® which uses 50.
color (color): color of the label. Possible values include:
Default is "blue"
.
Examples
Remarks
Currently, values of y1
/y2
do not fully support historical referencing.
@valuewhen
Plot a user set value on the chart when the assigned condition is true.
Syntax
Arguments
source (placeholder): value to plot when the assigned condition is true, only supports placeholders. Default is {close}
except for the Oscillator Matrix® which uses 50.
Examples
Remarks
The plot for @valuewhen
is accessible as input for other scripts with name “@Valuewhen”, also allowing users to create alerts using it.
@invalidate
Invalidate a sequence of condition when the assigned condition is True
.
Syntax
Arguments
step (integer, integer list): step to consider for invalidation, supports multiple values. If no steps are provided all steps will be evaluated.
Examples
Example evaluating our invalidation condition on a specific step:
Example evaluating our invalidation condition on multiple step:
@filter
Use the assigned condition as filtering condition for all or user defined steps.
Syntax
Arguments
step (integer, integer list): step where the filtering condition is applied, supports multiple values. If no steps are provided all steps will have the filtering condition applied.
Examples
Example providing different filters across steps:
@set_step
Set the sequence step to a user defined value, or increase/decrease the current set by a user set increment/decrement.
Syntax
Arguments
value (integer): New value of the step. Users can also increase the current step value using +
as prefix, e.g: +1
, or decrease it using -
as prefix, e.g: -1
.
Example
Remarks
Users cannot set a negative value for a step (e.g: @set_step(-1)
), which would instead set the step to 0, however, the step can become negative when using increments/decrements.