WalkForwardOptimizer MT5
- Bibliotheken
- Stanislav Korotky
- Version: 1.17
- Aktualisiert: 9 April 2025
- Aktivierungen: 5
Die WalkForwardOptimizer-Bibliothek ermöglicht Ihnen die Durchführung von Rolling- und Cluster-Walk-Forward-Optimierung von Expert Advisors (EA) in MetaTrader 5.
Um die Bibliothek zu verwenden, fügen Sie die Header-Datei WalkForwardOptimizer.mqh in Ihren EA-Quellcode ein und fügen Sie die bereitgestellten Funktionen nach Bedarf hinzu.
Sobald die Bibliothek in den EA eingebettet ist, können Sie die Optimierung gemäß der im Benutzerhandbuch beschriebenen Vorgehensweise starten. Wenn die Optimierung abgeschlossen ist, werden die Zwischenergebnisse in einer CSV-Datei und einigen speziellen globalen Variablen gespeichert. Außerdem wird ein verständlicher Bericht als HTML-Seite erstellt.
This is a library. It requires a user to have some developer skills. If you do not have source codes of your EA (if it's a 3-rd party commercial EA) or do not understand the sources codes (if it's made for you by custom developer), please, contact the author/developer of the EA (source codes) to solve all problems. If he thinks there is a bug in the library, then let the author/developer contact me directly. I need technical details (which are hard to receive from non-developers) to provide proper support.
Der Text ist aufgrund der Größenbeschränkung gekürzt - laden Sie die vollständige Datei von Comments herunter.
WalkForwardOptimizer.mqh Kopfdatei
#define DAYS_PER_WEEK 7 #define DAYS_PER_MONTH 30 #define DAYS_PER_QUARTER (DAYS_PER_MONTH*3) #define DAYS_PER_HALF (DAYS_PER_MONTH*6) #define DAYS_PER_YEAR (DAYS_PER_MONTH*12) #define SEC_PER_DAY (60*60*24) #define SEC_PER_WEEK (SEC_PER_DAY*DAYS_PER_WEEK) #define SEC_PER_MONTH (SEC_PER_DAY*DAYS_PER_MONTH) #define SEC_PER_QUARTER (SEC_PER_MONTH*3) #define SEC_PER_HALF (SEC_PER_MONTH*6) #define SEC_PER_YEAR (SEC_PER_MONTH*12) #define CUSTOM_DAYS -1 enum WFO_TIME_PERIOD {none = 0, year = DAYS_PER_YEAR, halfyear = DAYS_PER_HALF, quarter = DAYS_PER_QUARTER, month = DAYS_PER_MONTH, week = DAYS_PER_WEEK, day = 1, custom = CUSTOM_DAYS}; enum WFO_ESTIMATION_METHOD {wfo_built_in_loose, wfo_built_in_strict, wfo_profit, wfo_sharpe, wfo_pf, wfo_drawdown, wfo_profit_by_drawdown, wfo_profit_trades_by_drawdown, wfo_average, wfo_expression}; #import "WalkForwardOptimizer MT5.ex5" // !muss nach der Installation in MQL5/Libraries kopiert werden void wfo_setEstimationMethod(WFO_ESTIMATION_METHOD estimation, string formula); void wfo_setPFmax(double max); void wfo_setCloseTradesOnSeparationLine(bool b); void wfo_OnTesterPass(); int wfo_OnInit(WFO_TIME_PERIOD optimizeOn, WFO_TIME_PERIOD optimizeStep, int optimizeStepOffset, int optimizeCustomW, int optimizeCustomS); int wfo_OnTick(); double wfo_OnTester(); void wfo_OnTesterInit(string optimizeLog); void wfo_OnTesterDeinit(); #import input WFO_TIME_PERIOD wfo_windowSize = year; input int wfo_customWindowSizeDays = 0; input WFO_TIME_PERIOD wfo_stepSize = quarter; input int wfo_customStepSizePercent = 0; input int wfo_stepOffset = 0; input string wfo_outputFile = ""; input WFO_ESTIMATION_METHOD wfo_estimation = wfo_built_in_loose; input string wfo_formula = "";
Beispiel für die Verwendung
#include <WalkForwardOptimizer.mqh> ... int OnInit(void) { // Ihr eigentlicher Code kommt hier hin ... wfo_setEstimationMethod(wfo_estimation, wfo_formula); // wfo_built_in_loose standardmäßig wfo_setPFmax(100); // DBL_MAX standardmäßig // wfo_setCloseTradesOnSeparationLine(true); // standardmäßig falsch // dies ist der einzige erforderliche Aufruf in OnInit, alle Parameter kommen aus dem Header int r = wfo_OnInit(wfo_windowSize, wfo_stepSize, wfo_stepOffset, wfo_customWindowSizeDays, wfo_customStepSizePercent); return(r); } void OnTesterInit() { wfo_OnTesterInit(wfo_outputFile); // erforderlich } void OnTesterDeinit() { wfo_OnTesterDeinit(); // erforderlich } void OnTesterPass() { wfo_OnTesterPass(); // erforderlich } double OnTester() { return wfo_OnTester(); // erforderlich } void OnTick(void) { int wfo = wfo_OnTick(); if(wfo == -1) { // kann einige nicht handelsbezogene Aufgaben erledigen, wie z. B. das Sammeln von Balken- oder Tickstatistiken return; } else if(wfo == +1) { // kann einige nicht handelsbezogene Dinge tun return; } // Ihr eigentlicher Code kommt hier hin ... }

Excellent library! its very simple to setup and not too complex, just make sure to locate the ex5 library correctly (hidden in the market directory, this left me confused for a bit lmao) all in all. 5/5 would use it constantly