Navigation: Realtest Script Language > Syntax Element Details >

CalendarSym

 

 

 

 

Category

Strategy Elements

Description

Symbol to use as the market date list for this strategy

Input

Any symbol in the current data file (does not require an extra $)

Notes

CalendarSym is only needed when a multi-strategy script includes strategies for different countries or for markets with different trading calendars.

An external date list is needed when evaluating formulas that don't have a specific symbol context, e.g. MaxPositions, MaxExposure, etc.

The default external date list includes every date that has a bar for any stock in the data file.

Specifying CalendarSym replaces the default date list with a specific symbol's date list for this strategy only.

An example of the problem that this optional element solves:

it is Tuesday morning and Monday was a US holiday

your data file includes the symbol AUDUSD which has a bar for Monday

the global date list therefore includes Monday's date

your strategy uses a MaxPositions formula that varies depending on a US-index-based trend filter

while trying to evaluate MaxPositions for Tuesday's trades, it sets the context to Monday's date, based on the global date list

there is no Monday bar for US indices, so references to them return nan

MaxPositions is therefore 0

Adding e.g. CalendarSym: $SPX to the strategy would resolve this issue.

(Importing with  Padding: AllMarketDays would also resolve it but there may be reasons you don't want to do that.)

 

 

 

 

Copyright © 2020-2024 Systematic Solutions, LLC