|
Category
Settings
Description
Number of periods to run the strategy rules before StartDate, so that the test starts already holding the positions the strategies hold at that point
Choices
0 - start flat on StartDate (default)
N - run the rules N periods before StartDate, then start holding their positions
Notes
Without this setting a backtest always starts flat on StartDate, and its first weeks or months are spent building up positions. A live account that starts trading a strategy which is already in the market starts invested instead: with OrderClerk and OrdersMode OrderClerkSync, the first Orders run buys everything the strategy currently holds. WarmupPeriods models that kind of start.
The rules run from N periods before StartDate, or from the start of the data if there are fewer. A period is one bar of the Settings BarSize, i.e. a trading day for daily Settings. Nothing from the warm-up is kept: the test statistics, StratData, graphs and trade list all begin at StartDate.
At the StartDate open, after any exits that fill at that open, the account starts with AccountSize exactly as in a normal test, and each strategy and benchmark buys every position it still holds:
•Each position is resized to the same fraction of the strategy's new allocation that it had when it was entered, priced at the prior close, the way an OrderClerkSync entry order is sized with OrdersNetLiq. Quantity is not evaluated again.
•It fills at the open, with the strategy's Slippage and Commission.
•A position that can't be bought at that open (no bar for the symbol, or it sizes to zero shares) is dropped.
A bought-in position is a new entry at the StartDate open, like a trade adopted with TLAdoptPos: its entry date and price in the trade list, BarsHeld, FillPrice, InitialRisk and any stops based on them all start there. Its exits can therefore differ from those of the same position in a test that started earlier. This matches live trading after a sync, where later Orders runs play back the actual fills.
Entries signaled on the last warm-up bar fill at the StartDate open as usual. CashList and FeesList entries dated before StartDate are ignored.
To see how much starting flat costs, compare the same test with and without WarmupPeriods, or with several StartDate values.
WarmupPeriods applies to Test and Optimize runs; Orders runs ignore it. It cannot be combined with WalkForward or a strategy that uses a TradeList.
Example
Start trading on the first trading day of 2021, holding what the strategies would hold after a year of running:
Settings:
StartDate: 2021-01-04
WarmupPeriods: 252
AccountSize: 100000
|