< All Topics

Specifying Walkforward In/Out Periods

Specifying Walkforward In/Out Periods

A walkforward has two important time periods associated with it — the in-sample period and out-of-sample period.  Another way of thinking of these periods are as a lookback period (in-sample) and step forward period (out-of-sample).  In this regard, a walkforward is a simulation of what would have happened at each “step forward” point when you optimize the strategy (using the lookback period) and then choose a new set of parameters to trade at that “step forward” point-in-time until you reach the next “step forward” time.

Each period has a period type and a period unit.  However, Trading Days do not need a period type designation — simply enter them as numbers without any period type and MultiWalk will know that the period type is Trading Days.

Period Types

Calendar Dates — can be used for either lookback (in-sample) or step-forward (out-of-sample periods)

Example: 2Y/1Y,2Y/6M,2Y/3M,1Y/1Y,1Y/6M,1Y/3M,6M/6M,6M/3M

Calendar dates can be specified using any of the following periods:

      • Days
      • Weeks
      • Months
      • Years

Calendar based period types require MultiWalk Pro.  They provide a flexible and consistent means to define your lookback periods or step-forward periods. They remain fixed and will not change when the data changes due to data corrections.  If you specify 1 month, for example, for your lookback period, MultiWalk will determine the exact date 1 month ago.  If the current date is March 5, 2023, then 1 month ago would be February 5, 2023.  Calendar units are based solely on the calendar, not number of days in those calendar units.

Start Date

The date that MultiWalk uses to start your calendar period is important since it will effect the begin date of each successive forward period. For example, you may define the project begin date as Jan 1, 2007 on the Settings->Walkforward screen, but, because of the New Years holiday, the actual first trading date will Jan 2. If you had an out-period of one month, then each forward period would start on Jan 2, 2007. If you want to standardize all your strategies so that re-optimizations occurred on the same date, such as the 1st of the month regardless of project start date, then you need to be sure to specify the correct Start Date methodology on the Settings->Walkforward configuration screen:

Use date of first bar in strategy

The start date will be the first actual date that appears in the symbol data after your defined project walkforward begin date.

First of each month

The start date will be the first of the month after your defined project walkforward begin date. For example, if your project begin date is 4/25/2020, then the walkforward will start on 5/1/2020.

First of each quarter (Jan 1, Apr 1, Jul 1, Oct 1)

The start date will be the first of the month of the next quarter after your defined project walkforward begin date. For example, if your project begin date is 4/25/2020, then the walkforward will start on 7/1/2020, the start of the next quarter.

Important:  While calendar based dates provide better date consistency for the walkforward process, they can still be effected by data changes which may alter the walkforward results.  If, for example, price data was corrected or added that effected the trades and resulting equity curve, the outcome of the walkforward process can change if a different iteration is now considered “best” rather than the original iteration chosen during the previous (before data changes) walkforward.  However, extensive testing has shown that the use of calendar days is still prone to fewer changes in net profit equity changes as opposed to using trading days.

Trading Days — can be used for either lookback (in-sample) or step-forward (out-of-sample periods)

Trading days are entered as numbers only.  There is no special period type designation needed.

Example: 504/252,504/126,504/63,252/252,252/126,252/63,126/126,126/63

Trading days refer to days that the market is open. Weekends and holidays will not be included.  We use an estimate to approximate one year’s worth of data, where 252 trading days are approximately 365 calendar days.  This is derived as follows:

1 year trading days = 365 – 104 calendar days for weekends (52 * 2) – 9 calendar days for US federal holidays = 252 trading days

However, trading days are based on the days that are present within the data. They are not determined from an external calendar based source, but rather the dates found in the symbol data itself. This makes them prone to these issues:

Data corrections

When dates are added or subtracted due to symbol data corrections, the trading day range will change and effect the outcome of the new walkforward simulation.  Click here for an example of the ramifications of this behavior.

Intraday data that includes Sunday open

252 trading days assume 52 weekends that include both Saturday and Sunday.  This works fine for daily bars where the Sunday open is folded into Monday’s bar. However, intraday strategies that use smaller bars (such as 120, 60, etc. minute bars) will often include Sunday in the daily, periodic data.  You’ll see this behavior when you look at TradeStation’s periodic daily chart or MultiWalk’s periodic walkforward chart.  When this happens, 252 tradings will no longer approximate a year, but rather ~10 months.  When Sundays are included, a more appropriate value to use is 304 trading days (252 + 52 Sundays).

Changes in holidays

Holidays may not always fall on weekdays.  They have also changed through the years, so now there are actually 11 federal holidays.

Using calendar based time periods avoids these issue and provide better consistency for future re-optimizations.

Trade Count — can only be used for lookback (in-sample periods).  You will receive an error if used for step-forward (out-of-sample periods).

Example: 50T/1Y, 100T/6M

Trade count period type requires MultiWalk Pro.  Trade count refers the number of trades in the period.  This brings in a level of statistical significance to the walkforward process. For example, if you specified your lookback/in-sample period to be 25 trades, then this means that for every step forward of the walkforward process, each iteration will include the last 25 trades for the in-sample period. In this way each iteration is ensured to be comparing the same number of trades rather than a discrete time period.

Therefore, using Trade Count is not time based, but trades based.  MultiWalk will search the data of each iteration for the previous Trade Count for every step forward of the walkforward process.

Trade count can only be used for lookback (in-sample) periods.  Step-forward (out-of-sample) time points need to be consistent for each optimized iteration and, since, each optimized iteration will contain a different number of trades moving forward in time, it is not possible to have all iterations contain the same number of trades at the same point in time.

Period Units

Period units are simply the number of units to include in each period.  The type of period defines what “unit” means. If you are using Calendar Days, then units refer to the number of days in the period. If you are using Trade Count, then units are the number of trades to include in the period.

Formatting a Single In/Out Period

Periods have “type identifiers”.  If no type is specified, the default period type will be Trading Days so that usage remains consistent with previous versions of MultiWalk.  The following period types can be used:

TD : Trading Days.  Ex: 504/252 or 504TD/252TD, step forward every 252 trading days with a lookback of 504 trading days each time.

D : Calendar Days.  Ex: 20D/1Y, step forward every 20 calendar days with a lookback of 1 calendar year each time.

W : Calendar Weeks.  Ex: 2W/1Y, step forward every 2 calendar weeks with a lookback of 1 calendar year each time.

M : Calendar Months.  Ex: 3M/1Y, step forward every 3 calendar months with a lookback of 1 calendar year each time.

Y : Calendar Years.  Ex: 1Y/1Y, step forward every calendar year with a lookback of 1 calendar year each time.

T : Trade Count.  Ex: 50T/1Y, step forward every calendar year with a lookback of 50 trades each time.

Formatting a matrix of In/Out Periods

Walkforward periods can also be expressed as a matrix.  This makes it possible to do a large run of walkforward periods for comparative analysis without having to enter each walkforward period separately.  The general expression of a matrix is:

[in-sample-start] – [in-sample-end] x [in-sample-step-value] / [out-sample-start] – [out-sample-end] x [out-sample-step-value]

Examples:

15-560×25 / 10-250×10

This will create a 15-560 trading days in-sample by 10-250 trading days out-sample matrix of 550 in/out periods starting at 15/10 and ending at 560/250.

2-24x1M / 8-52x2W

This will create a 2-24 month in-sample by 8-52 week out-sample matrix of 529 in/out periods starting at 2M/8W and ending at 24M/52W.

100-400x50T / 2-12x1M

This will create a 100-400 trades in-sample by 2-12 month out-sample matrix of 77 in/out periods starting at 100T/2M and ending at 400T/12M.

 

Table of Contents