+84 888161016

24/7 Customer Support

Mon - Sunday: 24/24

Online store always open

Walk-forward optimization library for MetaTrader: advanced options – Other – 1 November 2023

November 1, 2023| Forex Market

The function wfo_setAdvancedOptions accepts an integer value which is a bitwise set of flags, that is a specific bit enables specific feature. All supported flags are listed in the header file with corresponding values.

#define WFO_FLAG_MISMATCH_FIX_OFF        2


Multiple features can be enabled by bitwise OR-ing (‘|’) flags or by separate calls to the function, for example:


Please note, that part of the flags affects code execution in the tester agents, and other part is intended for use in code executed in the terminal.

For agents you should call wfo_setAdvancedOptions in OnInit, for the terminal – call it in OnTesterInit. For generality you can call it in both places – this is safe, because excessive flags will simply not take effect.

The meaning of the flags and corresponding features are described below:

  • WFO_FLAG_AUTO_CLOSE_SPLIT_TRADES – enable automatic close of positions and pending orders on the boundary between walking window and forward test, the same as wfo_setCloseTradesOnSeparationLine (;
  • WFO_FLAG_MISMATCH_FIX_OFF – disable automatic correction of discrepancies, which may show up in WFO-reports under some circumstances; find more details in the FAQ (, Q.Why do I see discrepancies in some rows of walkforward tables?;
  • WFO_FLAG_STOP_ON_RANGE_VIOLATION – stop current tester pass if a trade(s) is detected before or after walking window and forward test; by default this feature is off, and EA developer is responsible for making sure in the source code, that trades are allowed strictly inside the window and forward;
  • WFO_FLAG_CHECK_TICK_MODELLING – enable tick modelling detection (empirical, not a part of MQL5 API), the result is shown in WFO-report;
  • WFO_FLAG_STOP_ON_NONSTD_PARAMS – enable strict check-up for proper optimization settings, that is at least one of wfo_windowSize, wfo_stepSize, wfo_stepOffset should be involved in optimization, otherwise, WFO will be disabled; not compatible with 3-rd party software wrappers of WFO-library, which setup these inputs programmatically;
  • WFO_FLAG_RESUME_OPTIMIZATION – keep WFO-specific data (csv and gvf files) and append new results into it, assuming continuation of optimization; find more details in other blog post;

All flags are optional.

Source link

Categories: Trading tips

Get In Touch!

What type of Forex Tool(s) are you interested in ?
How can we reach you ?