Walk-forward optimization library for MetaTrader: Parameters

15 August 2016, 19:42
Stanislav Korotky

This post is a part of documentation of WalkForwardOptimizer library for MetaTrader4/5 - here is the table of contents.


  • wfo_windowSize - one of predefined optimization window sizes; by default - year; if custom is selected, a custom day number should be passed in wfo_customWindowSizeDays; if none is selected, window management is disabled, that is EA will continue trading after the ending date of the window and forward test; use it as a final check up of optimized setup and for figuring out how EA performance may degrade in a distant time without re-optimizations;
  • wfo_customWindowSizeDays - optimization window size in days; may be added to optimization as meta-parameter for cluster analysis;
  • wfo_stepSize - one of predefined forward step sizes; by default - quarter; should be less than window size;
  • wfo_customStepSizePercent - forward step size in percents of window; may be added to optimization as meta-parameter for cluster analysis;
  • wfo_stepOffset - serial number of rolling forward step; must be always added to optimization as meta-parameter (except for anchored mode), and its increment must be always 1; 
  • wfo_outputFile - output file name with csv data; required; if the file name is empty, the library does not do its job, but EA keeps working; this can be used as a simple way to disable the library without re-compilation of EA;
  • wfo_estimation - a selector of estimator used as EA performance measure during optimization; by default - wfo_built_in_loose;
  • wfo_formula - custom formula of estimator, if wfo_estimation is wfo_expression.

Time periods used for specifying optimization window and forward test sizes (such as year, quarter, month, week) are defined in days in WFO_TIME_PERIOD enumeration (see the header).

As a result, when you choose a period, actual window boundaries can differ slightly from calendar dates of change of days, weeks, months, or years. For example, with 1 month period defined as 30 days it's obvious that "monthly" step can occur on a day after or before next months switching, if you start optimization from 1-st of any month (because months differ in day number: 30, 31, 28, 29). If you start process from a middle of a month, then steps will occur on a middle of next months, but concrete dates may vary as well.

This is done for the sake of efficiency, to eliminate the need to lookup weekly, monthly, and other timeframe's bars.


Share it with friends: