Strategy optimisation with Walk Forward analysis

Walk Forward analysis allows you to optimize a trading system and to validate its robustness and stability over time.First, the walk forward analysis optimizes a set of variables on an initial period called “in-sample data”, then it tests the best parameters on the following period called “out of sample data”, and repeats the process by shifting forward the time windows. The optimization periods (in-sample) may have a single starting point (Anchored mode), or different starting points (Non-anchored mode).

By comparing the results of these 2 periods, the method allows you to:

  • Check that the performance of the strategy on the optimization periods (in-sample data: shown in blue) are consistent with the test periods (out-of-sample data: shown in grey). This avoids the risk of “overfitting”
  • Check how the strategy behaves in changing market conditions
  • Test the strength of the strategy on past data

Practical example of Walk Forward analysis

This section shows how to optimize an existing trading system using the Walk Forward method.
First click on the ‘wrench’ button at the top of the code editor window shown below.

The window below will then appear. Once your variables are defined, you can activate the Walk Forward method by clicking on the “Active” button and choose the Walk Forward parameters. Select Non Anchored mode for different starting points, or Anchored mode for a single starting point for all test repetitions.
You can also define the number of Walk Forward repetitions (one repetition consists in optimizing the parameters on the optimization period and testing the best set on the test period), and the ratio between the optimization period and the test period.

Once the parameters are defined, close the window above and launch the Walk Forward analysis by clicking on “ProBacktest my system”.
During the Walk Forward analysis, the platform starts by optimizing the strategy on a first sample to determine the set of variables that generates the highest performance. Then the performance of this set is evaluated on an additional sample that was not included in the optimization sample. The process is repeated 5 times. The aim is to determine whether the optimal set of variables has generated consistent or greater performances in different market conditions.
Depending on the number of variables and repetitions, the calculation can be more or less complex. The backtest execution time will depend on this complexity.
After calculation, a chart containing an equity curve will be displayed together with the detailed report of the system performance. In addition to the usual detailed report tabs, an additional Walk Forward tab compares the results for each test repetition.
In order to determine if the strategy is robust, the WFE ratio (or Walk Forward ratio) compares the annualized gain of the test period (out-of-sample) to the annualized gain of the optimization period (in-sample). A ratio above 50 or 60% is necessary to consider that the strategy is not over-optimized.

The equity curve aggregates and displays the first in-sample (or optimization) period and the 5 out-of-sample (or test) periods on the chart.
When moving your mouse over the lower bands, the corresponding period will be highlighted with the parameters used, along with the performances of this time period. On the above screenshot, the mouse is over the first test period. The values shown above for the variables PROTECTION, ORDERS, and NUMBER gave the best results during the 1st
optimization period (in-sample #1) and were then applied on the test period (out-of-sample #1), resulting in a gain of 2,000 € during test period #1 (highlighted in the image above).
(this article is a copy/paste of the ProOrder documentation, I will make videos later to explain it better).

Share this

  1. barnabebear • 363 days ago #

    Looks promising, thank you Nicolas for your role in helping develop such a tool !

    • Nicolas • 363 days ago #

      Thanks. But all credits go to all prorealtime developers who contribute everyday to make a better and reliable trading platform for all of us!  🙂 

  2. manel • 363 days ago #

    Amazing work and addition to the tool set, should prove to be very valuable. Thank you very much for this Nicolas.

  3. Bin • 362 days ago #

    Hi Nicolas
    I am using v10.3, When this amazing function avaiable?

    • Nicolas • 361 days ago #

      It’s already available for prorealtime software/IB customers. It will be released in a few weeks for other users (IG/PRT-CFD).

  4. Bin • 361 days ago #

    Thanks Nicolas.

  5. Lotar • 358 days ago #

    Yes! Thats it! I love PRT !!

  6. winnie37 • 357 days ago #

    Amazing! Impatient to discover and explore this function

  7. zilliq • 357 days ago #

    Alleluiaaaaaaaaaaaaaaaaaaaaaaaaaa 🙂
    I don’t remember the first time I wait for it.
    Do you know if the MulTiFrame will be come soon too ?

  8. Canale di Fill By Filippo • 354 days ago #

     Anche per me questa nuova funzione potrebbe attenuare il problema della sovra-ottimizzazione delle nostre strategie. Aspetto impaziente di poterla utilizzare. 
    Un saluto a tutti. Fill

  9. SebTrades • 336 days ago #

    I’ve been expecting this functionality for years… great to read that it’s coming to PRT!

  10. Crystal Babe • 194 days ago #

    Any videos on these in english ?

Register or