Trading libraries for MetaTrader 4

Special Offer!

Time Left to Buy:

Up to 25% OFF

Shopping cart

Name Price
Total 150 $
Currencies Cleaner 150 $
Proceed to checkout

MetaTrader 4

Top Rated Products MT4

999 $749 $ AI Gen XII MT4
Denis Kurnev
4 5 4 Product
999 $749 $ Nmt5
Liang Qi Quan
4.5 5 2 Product
2 199 $1 649 $ Ak47tutu
Dian Zhou
4.5 5 2 Product

WalkForwardOptimizer

walkforwardoptimizer-logo-200x200-9050
85 $64 $

Free updates are included

We accept crypto: BTC, ETH, BCH and more...

30-Day Money Back Guarantee
100% Guarantee of Originality

Information

Libraries
MetaTrader 4
Stanislav Korotky
1.6
5

Overview

WalkForwardOptimizer library allows you to perform rolling and cluster walk-forward optimization of expert advisers (EA) in MetaTrader 4.

To use the library include its header file WalkForwardOptimizer.mqh into your EA source code, add call provided functions as appropriate.

Once the library is embedded into EA, you may start optimization according to the procedure described in the User guide. When it's finished, intermediate results are saved into a csv-file and some special global variables. Then you can view and analyse the results by means of accompanying script WalkForwardReporter, which generates comprehensible reports as html-pages. The script is free.


Header file WalkForwardOptimizer.mqh

#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};

extern WFO_TIME_PERIOD wfo_windowSize = year;
extern int wfo_customWindowSizeDays = 0;
extern WFO_TIME_PERIOD wfo_stepSize = quarter;
extern int wfo_customStepSizePercent = 0;
extern int wfo_stepOffset = 0;
extern string wfo_outputFile = "";
extern WFO_ESTIMATION_METHOD wfo_estimation = wfo_built_in_loose;
extern string wfo_formula = "";

#import "WalkForwardOptimizer.ex4"
void wfo_setEstimationMethod(WFO_ESTIMATION_METHOD estimation, string formula);
void wfo_setHeader(string s);
void wfo_setPFmax(double max);
void wfo_setGVAutomaticCleanup(bool b);
void wfo_setCleanUpTimeout(int seconds);
int wfo_OnInit(WFO_TIME_PERIOD optimizeOn, WFO_TIME_PERIOD optimizeStep, int optimizeStepOffset, int optimizeCustomW, int optimizeCustomS, string optimizeLog);
int wfo_OnTick();
double wfo_OnTester(string payload = "");
void wfo_setCloseTradesOnSeparationLine(bool b);
#import


Example of usage in your source code

#include <WalkForwardOptimizer.mqh>

...

int OnInit()
{
  ...

  wfo_setEstimationMethod(wfo_estimation,wfo_formula); // wfo_built_in_loose by default
  wfo_setHeader("EnvelopeRange,EnvelopeLength"); // "Payload" by default
  wfo_setPFmax(100); // DBL_MAX by default
  
  // can be set to true, only if genetics not used
  // wfo_setGVAutomaticCleanup(true); // false by default
  
  // wfo_setCloseTradesOnSeparationLine(true); // false by default

  // this is the only required call in OnInit, all parameters come from the header
  int r = wfo_OnInit(wfo_windowSize, wfo_stepSize, wfo_stepOffset, wfo_customWindowSizeDays, wfo_customStepSizePercent, wfo_outputFile);
  
  return(r);
}

double OnTester()
{
  // the passed string with optimizable work parameters of EA should match specified header in wfo_setHeader
  // the parameter is optional, you may have EA without parameters
  // the call to wfo_OnTester is required
  return wfo_OnTester(DoubleToStr(EnvelopeRange, 1) + "," + IntegerToString(EnvelopeLength));
}

void OnTick()
{
  int wfo = wfo_OnTick(); // required in OnTick
  if(wfo == -1) // this tick is before optimization window
  {
    return;
  }
  else if(wfo == +1) // this tick is after optimization window and forward test
  {
    return;
  }
  
  ...
  // your actual code goes here
}



Recently Viewed

100 $75 $ Most Efficiency Dashboard by Flawless
Onjira Singphun
250 $188 $ Lemm Scalper EA MT5
Fabio Sanna
250 $188 $ Manual Orders Variety Utility EA MT5
Opengates Success International
Results 1 - 3 of 3

30-Day Money Back Guarantee

If for any reason you do not like the purchased program, you can request a refund within 30 days from the date of purchase. You can also make an exchange for any other product at an equal cost or by paying the difference.
Simply send a request for refund or exchange with your order number by email: [email protected].
Refund requests received more than 30 days after purchase will be rejected.

Email Us Now! Support is available 24/7
by Email: [email protected]

Do You Need Help?
Click Here To Start Live Chat

Contact Us

Image

Search