RealTest is able to combine data from multiple sources and/or for multiple asset types.
During data import, a "global calendar" is created. This is simply a list of all dates for which any symbol has a bar.
When tests or scans are run, the outermost loop is across this global calendar. For each date, RealTest then loops through the symbols and processes each symbol that has a bar for that date. This ensures that all references to bar data are correctly aligned to the date being processed.
The following is an overview of how calendar logic is applied during backtesting:
for each date
for each symbol
if it has a bar for this date (the potential transaction date)
get prior date from the global calendar
if it had a bar for that date (the order generation date)
determine and process trading signals
What this means, by default, is that for a transaction to be simulated in a backtest, the symbol must have bars for both the current and the prior date in the global calendar.
A strategy can optionally specify AllowMissingBar: True to remove the second requirement above. That would allow orders for tomorrow to be generated for symbols currently in trading halts, and backtests to model such orders having been generated. This implies that capacity slots might be consumed by stocks that cannot be traded tomorrow, which is why the default is False for this setting.
When one script includes data from multiple countries that have different holidays, there are two other solutions available:
1.Add a CalendarSym specification to each strategy definition
2.Add a Padding specification to your Import definition
Option 1 is generally preferable as it avoids potential distortion of multi-bar indicator calculation caused by padding bars, but there may be cases where you need option 2.
|