# Walk Forward Optimization

Walk Forward Optimization is an optimization process that addresses the issue of curve fitting in strategy development.

Walk Forward Optimization segregates the data series into multiple segments, and each segment is divided into an in-sample (IS) portion and an out-of-sample (OOS) portion.

Parameter optimization for the strategy is performed using the IS portion of the first segment. The same parameters are then used to back test the strategy on the OOS portion of the same segment. The process is repeated for the remaining segments.

The OOS performance results from each of the segments are considered "real" instead of "curve-fit" because the parameters that produced the OOS results were generated from IS data.

## Walk Forward Optimization (not anchored)

Suppose a data series has 220 bars, and it is divided into five segments of 100 bars per segment.

The first 70 bars of each segment are the IS portion and the remaining 30 bars are the OOS portion.

The table below shows the segmentation details.

Segment | # of Bars per Segment | ||
---|---|---|---|

IS | OOS | ||

Segment 1 | 1-70 | 71-100 | 100 |

Segment 2 | 31-100 | 101-130 | 100 |

Segment 3 | 61-130 | 131-160 | 100 |

Segment 4 | 91-160 | 161-190 | 100 |

Segment 5 | 121-190 | 191-220 | 100 |

Step 1: Parameter optimization is performed using Segment 1's IS data. These parameters are then used to back test the strategy on Segment 1's OOS data.

Step 2: Parameter optimization is performed using Segment 2's IS data. These parameters are then used to back test the strategy on Segment 2's OOS data.

Step 3: Parameter optimization is performed using Segment 3's IS data. These parameters are then used to back test the strategy on Segment 3's OOS data.

Step 4: Parameter optimization is performed using Segment 4's IS data. These parameters are then used to back test the strategy on Segment 4's OOS data.

Step 5: Parameter optimization is performed using Segment 5's IS data. These parameters are then used to back test the strategy on Segment 5's OOS data.

The walk forward optimization is complete.

There are OOS performance results for bars 71-220. Walk Forward Optimization considers the OOS performance results "real" instead of "curve-fit" because the parameters that produced the OOS results were generated from IS data.

As shown, the starting point of each subsequent segment begins 30 bars after the starting point of the previous segment. The starting point of each segment steps forward. Hence, this type of walk forward optimization is said to be not anchored. The reason the step is 30 bars is because that's the length of the OOS portion.

## Walk Forward Optimization (anchored)

Anchoring means the starting point of all segments is the same as the starting point of the first segment.

The starting points do not step forward. Hence, this type of walk forward optimization is said to be anchored.

The effect is that the IS portion of each subsequent segment is longer than IS portion of the previous segment, and therefore the total length of each subsequent segment is also longer than the total length of the previous segment.

The table below shows the segmentation details.

Segment | # of Bars per Segment | ||
---|---|---|---|

IS | OOS | ||

Segment 1 | 1-70 | 71-100 | 100 |

Segment 2 | 1-100 | 101-130 | 130 |

Segment 3 | 1-130 | 131-160 | 160 |

Segment 4 | 1-160 | 161-190 | 190 |

Segment 5 | 1-190 | 191-220 | 220 |

The rest of the anchored walk forward optimization process is the same as not-anchored walk forward optimization.

## Using Walk Forward Optimization

To use Walk forward Optimization:

- Open the
**Format Objects**window.

To open the**Format Objects**window, right-click on an empty area of the chart and then click**Format Signals**.

The**Format Objects**window can also be opened by one of the following methods:

- Select**Format**in the main menu and click**Signal**.

- Double-click any one of the signal's labels on the chart.

- Position the mouse pointer over any one of the signal's labels on the chart; once the**Pointer**changes into a**Hand**, right-click the label and then click**Format Signals**. - Select the
**Signals**tab and select the signal in the box. - Click the
**Optimize**button. The**Select Optimization Method**box will appear. - Select either
**Exhaustive**or**Genetic**radio button for the type of optimization. (Both will work with**Walk Forward Optimization**.) - Select the
**Walk Forward**check box. - Enter the number of bars/days for the IS portion of a segment into the
**IS**textbox. - Enter the number of bars/days for the OOS portion of a segment into the
**OOS**textbox. - Check the
**Anchored**checkbox to use anchoring. Uncheck the**Anchored**checkbox to not use anchoring. - Click the
**OK**button. - Select the
**Optimizable Inputs**tab. Input start and end values for the inputs. - If performing an
**Exhaustive**optimization, select the**Optimization Criteria**tab and complete inputs.

If performing a**Genetic**optimization, select the**Algorithm-specific Properties**tab and complete inputs.

For more information, see Performing Optimization - Click the
**OK**button.