Introduction
The built-in tester of MetaTrader 5 allows you to optimize most sophisticated algotrading strategies. The result of this process is a table with the robot’s performance for different (more profitable, if found) input settings. Each specific pass has its own set of input variables, and can be probed directly from the GUI table by mouse click or context menu command Run Single Test.
The things become slightly more difficult if you run not an ordinary optimization, but a walk-forward optimization driven by the WFO library. The library generates its own HTML-report with testing passes grouped by walking windows and forward steps. You can’t double click there to launch the robot with correponding parameters.
The problems
To alleviate the problem the library displays the number of each pass in the 1-st left column of tables in HTML-reports. The idea of identifying passes by their numbers is very logical and easy to use, yet there is another problem here.
Unfortunately, MetaTrader 5 provides real pass numbers only for full-scale (slow) optimization mode, but not for genetic (fast) optimization. You can check that after thorough optimization, pass IDs in the built-in tester table corresponds to IDs in the HTML-report. When genetics come into action, the IDs are displayed in the built-in tester in the form (generation index; instance index), whereas MQL5 programs (and WFO library as well) receives abstract numbers calculated by internal (undisclosed) algorithm from test hash. As a result, user can’t easily find corresponding records in the standard report and in the WFO report.
And even worse. The genetic-related tuple IDs (generation index; instance index) are shown in the GUI table only after optimization! If you run another optimization or just close the terminal and reopen it some time later, then the tester reloads the cached table without the IDs. The column with numbers of passes is empty in case of genetic optimization. While you’re working inside MT5 only, this is not a big problem, because you can copy settings from the table without knowing their ID. But in case when an external program is involved, pass ID would be essential for integration.
WFO library is much like an external program, since MQL5 API provides very limited info. Normally you have a HTML-report from WFO where best current settings are highlighted in green and you need to locate these specific settings in MetaTrader in order to test or apply online. The number of the pass (shown in HTML) can’t help in the tester or on a chart.
With that being said, the only official way to match passes in HTML-report and passes in the tester table is by settings itself! Taking into account that input parameters can be numerous, it’s very hard to do in practice.
This is why I developed a Chrome extension which solves the problem at least for users of Chromium-based browsers.
The solution
The Chrome extension is a set of files, which should be installed into your browser. After this is done (once), your browser will get a new small function: you’ll be able to click specific table cell with settings (in the column Parameters) in HTML-report of WFO and corresponding settings will be copied into Windows clipboard. Then you can save it into a set-file and apply to your robot as usual.
The name of the extension is MT5-WFO-set-clipboard.
- Unzip the attached archive into a dedicated folder.
- In your browser choose Settings -> Extensions and enable Developer Mode by clicking the toggle switch.
- In your browser choose Settings -> Extensions and press Load unpacked extension.
- Navigate to the folder with the extension and confirm your choice. The extension MT5-WFO-set-clipboard should appear on the page with extensions.
- Press Details button inside the extension’s panel and make sure Allow access to file URLs is enabled.
- [Optional] It might be helpful to turn on the option Allow in incognito in Details as well.
You can disable or remove extension at any time.
Practice
In HTML-report built by WFO there exist 2 kinds of parameters: fixed parameters (non-optimized) with constant values and variables (optimized). All of them are mentioned at the top of the report.
Below on the page are tables with walk-forward tests. Variable parameters are specified in the rightmost column for each pass. You can hover mouse over the caption Parameters in order to see the order in which the parameters are shown.
Clicking on any cell with variables (in the column Parameters) will generate a text in the format of MT5’s set-file and copy it into clipboard.
For example, here is what you get after clicking on the green cell from the screenshot above.
Signal_ThresholdOpen=10.0 Signal_ThresholdClose=10.0 Signal_PriceLevel=0.0 Signal_StopLevel=200 Signal_TakeLevel=400 Signal_Expiration=4.0 Signal_Envelopes_PeriodMA=30 Signal_Envelopes_Shift=0.0 Signal_Envelopes_Method=0.0 Signal_Envelopes_Applied=1.0 Signal_Envelopes_Deviation=0.4 Signal_Envelopes_Weight=1.0 Signal_WPR_PeriodWPR=13 Signal_WPR_Weight=1.0 Trailing_ParabolicSAR_Step=0.060 Trailing_ParabolicSAR_Maximum=1.95 EnableWFO=1.0 wfo_windowSize=-1.0 wfo_customWindowSizeDays=90.0 wfo_stepSize=-1.0 wfo_customStepSizePercent=10.0 wfo_stepOffset=0.0 wfo_estimation=2.0 wfo_advancedOptions=32.0
Please note that the set-text contains all parameters – both constant and variable.