Actions have the structure
@keyword()
, starting with @
, with an identifier, and ()
.Some actions can have a condition assigned to them using =
. When the assigned condition is true the action will trigger.()
, adding further degrees of control over the action.
Actions used for scripted alerts are also available for scripted strategies, however, this page only lists the actions that are exclusively used for scripted strategies.
To see a list of other actions, see scripted alerts actions
@long
The@long
action allows entering a long position when the associated condition is true.
Syntax
Examples
Remarks
By default a long position is entered at the opening of the next bar. Using “fill on bar close” from the settings in PROPERTIES → FILL ORDERS will open a position at the close of the bar the condition is true.
@short
The@short
action allows entering a short position when the associated condition is true.
Syntax
Examples
Remarks
By default a short position is entered at the opening of the next bar. Using “fill on bar close” from the settings in PROPERTIES -> FILL ORDERS will open a position at the close of the bar the condition is true.
@exit_long
The@exit_long
action closes all open long positions when the associated condition is true.
Syntax
Arguments
qty (float): Optional. Number of contracts/lots/shares/units to close on exit for a long position. If the character%
is present, the specified % of the long position is closed. If not provied the entire position is closed.
Examples
Remarks
By default, a long position is exited at the opening of the next bar. You can enable “fill on bar close” from PROPERTIES → FILL ORDERS to trigger the exit at the bar close instead.
@exit_short
The@exit_short
action closes all open short positions when the associated condition is true.
Syntax
Arguments
qty (float): Optional. Number of contracts/lots/shares/units to close on exit for a short position. If the character%
is present, the specified % of the short position is closed. If not provied the entire position is closed.
Examples
Remarks
By default, a short position is exited at the opening of the next bar. To exit at the close of the bar where the condition is true, enable “fill on bar close” from PROPERTIES → FILL ORDERS.
@exit_all
The@exit_all
action closes all open positions (long or short and scripted/unscripted) when the associated condition is true.
Syntax
Examples
Remarks
This exits both scripted long and short positions, but also any other long/short condition you may have set.By default, the exit occurs at the next bar’s open unless “fill on bar close” is enabled in PROPERTIES → FILL ORDERS.
@start_date
The@start_date
action determines the starting date of the scripted strategy evaluation using a Datestring placeholder.
Syntax
Arguments
datestring: Datestring placeholder, must comply with the ISO 8061 standard. The time and timezone are optional.Examples
Remarks
The Timezone setting does not affect this placeholder. Default timezone for this placeholder is UTC-0.
@end_date
The@end_date
action determines the starting date of the scripted strategy evaluation using a Datestring placeholder.
Syntax
Arguments
datestring: Datestring placeholder, must comply with the ISO 8061 standard. The time and timezone are optional.Examples
Remarks
The Timezone setting does not affect this placeholder. Default timezone for this placeholder is UTC-0.
@only_scripted
The@only_scripted
action determines if only scripted entries/exits should be considered during the backtest. If true
it will ignore any other entry condition set in the other Backtester settings.