Trading libraries for MetaTrader 5

Special Offer!

Time Left to Buy:

Up to 25% OFF

Shopping cart

The cart is empty

MetaTrader 5

Top Rated Products MT5

999 $749 $ AI Gen XII MT4
Denis Kurnev
3.66667 5 3 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 MT5

walkforwardoptimizer-mt5-logo-200x200-9684
95 $71 $

Free updates are included

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

30-Day Money Back Guarantee
100% Guarantee of Originality

Information

Libraries
MetaTrader 5
Stanislav Korotky
1.17
5

Overview

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

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. Also a comprehensible report is generated as HTML page.

Warning! Do not pause optimization process. Clicking Start button (even if it resumes suspended optimization) will rewrite WF results from scratch. MQL5 API does not allow to distinguish new optimization from resumed old one.


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.

The text is shortened due to size limit - download full file from Comments.

WalkForwardOptimizer.mqh Header File

#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" // !after install must be copied into MQL5/Libraries
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 = "";


Example of Usage

#include <WalkForwardOptimizer.mqh>

...

int OnInit(void)
{
  // your actual code goes here
  ...

  wfo_setEstimationMethod(wfo_estimation, wfo_formula); // wfo_built_in_loose by default
  wfo_setPFmax(100); // DBL_MAX 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);
  
  return(r);
}

void OnTesterInit()
{
  wfo_OnTesterInit(wfo_outputFile); // required
}

void OnTesterDeinit()
{
  wfo_OnTesterDeinit(); // required
}

void OnTesterPass()
{
  wfo_OnTesterPass(); // required
}

double OnTester()
{
  return wfo_OnTester(); // required
}

void OnTick(void)
{
  int wfo = wfo_OnTick();
  if(wfo == -1)
  {
    // can do some non-trading stuff, such as gathering bar or ticks statistics
    return;
  }
  else if(wfo == +1)
  {
    // can do some non-trading stuff
    return;
  }

  // your actual code goes here
  ...
}

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