Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Tester Control - MetaTrader 4 Library | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources

author EAcpu | 4 reads | 0 comments |

Idea: As far as I know, many times I need to backtest some EA to find the suitable settings. Run the backtest from time1 to time2, change the settings and run again... After waiting for 1 hour, you have to click "Start and test" again.

If you use summary reporting or something similar or newer, you can completely automate the entire backtesting process. Just use this library... :D

So the inspiration was Mike Friend - the script , but his code wasn't good enough (thank you btw), ofc my code wasn't that good...

2 files are required:

- MetaTrader\experts\include -> testerControl.mqh
- MetaTrader\Library->specialUser32.mq4

You must compile specialUser32 separately because some control processing requires the SendMessageA function in that file to be of a different type than user32.dll. The lparam is a string instead of an integer.
and the testerControl file uses this special User32 as the library imported by the ex4 file.

- MetaTrader\experts\scripts -> AutomataTesterSample.mq4

In this example it is demonstrated how to use this library, just like enough. Specify multiple experts, symbols, periods, (from-to) times... Work your way with Ofc, with just a few requirements:

Use this function during Init() - this rutin detects the tester window and controls...

 initTester();

and set the tester options

 SetTesterOptions(...);

and run it

 startTester();

This is everyone.

For each comobox project, it is enough to write a unique name, for example the consultant name: ea_symr_tes but the full name is ea_symr_test, Copyright © 2011, Symr

New method appears - settings are similar to the Expert Properties window

 #define TST_POS_LONG_ONLY "Long only"
#define TST_POS_SHORT_ONLY "Short only"
#define TST_POS_LONG_SHORT "Long and Short"

#define TST_OPT_BALANCE "Balance"
#define TST_OPT_PROFIT_FACTOR "Profit Factor"
#define TST_OPT_EXPECTED_PAYOFF "Expected earnings"
#define TST_OPT_MAXIMAL_DRAWDOWN "Maximum drawdown"
#define TST_OPT_DRAWDOWN_PERCENT "Drawdown Percentage"

invalid setTestOptions( string- advisor, integer- money, string- money, string- positions, string-oppa , boolean- hered= wrong );


- You can edit optimization parameters through this library


Attachment download

📎AutomataTesterSample.mq4 (1.75 KB)

📎 specialUser32.mq4 (0.61 KB)

📎 testerControl.mqh (10.59 KB)

Source: MQL5 #10360

Verification code Refresh