Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Views:
1154
Rating:
(4)
Published:
\MQL5\Include\fxsaber\EAToMath\
Data_Tester.mqh (1.57 KB) view
FileMap.mqh (8.72 KB) view
EAToMath.mqh (61.7 KB) view
\MQL5\Experts\fxsaber\
EA_Test.mq4 (3.52 KB) view
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

This library adds the ability to test trading Expert Advisors in the MT5 tester mathematical mode.


Some explanations of the proposed implementation will be given below.


Connection.

To give your EA the ability to trade in math mode, you need to add the following line to it.

#include <fxsaber\EAToMath\EAToMath.mqh> // Testing on history in MT5 tester maths mode

#include "EA_Test.mq4" // Any tick-based MT4-style Expert Advisor.

And allow the use of DLL (safe - open source code).


Saving ticks.

First you need to save ticks by running a single pass of the EA with the corresponding specified input parameter.



After the pass, the log will contain information about the saved ticks.

EURUSD : real ticks begin from 2025.01.01 00:00:00
final balance 10000.00 pips
OnTester result 10000
2025.07.08 23:59:00   EAToMath.mqh 672: 1 988 733 onlytrade-ticks (11.380 MB, Compress = 10.00) are saved in C:\Users\Unknown\AppData\Roaming\MetaQuotes\Terminal\Common\EAToMath.mqh\Ticks.tsh
EURUSD,M1: 1988773 ticks, 38773 bars generated. Environment synchronized in 0:00:00.025. Test passed in 0:00:02.679 (including ticks preprocessing 0:00:00.172).
EURUSD,M1: total time from login to stop testing 0:00:02.704 (including 0:00:00.025 for history data synchronization)


Run.

After that you can run the Expert Advisor in the trading and mat mode of the MT5 Tester.



In the Tester's log there will be the corresponding information.

EAToMath.mqh 549: EURUSD: testing of Experts\fxsaber\EAToMath_Example.ex5 from 2025.06.01 00:00:00 to 2025.07.09 00:00:00
EAToMath.mqh 599: EURUSD ticks data begins from 2025.06.02 00:02:00.225
EAToMath.mqh 814: final balance 9986.43
OnTester result 9986.43
0 : mathematical test passed in 0:00:00.133
127 Mb memory used


Performance.

The screen shows the performance of optimisation in different modes from left to right: on real ticks (pips), on real ticks with virtual environment and mathematical mode.

You can clearly see that in this case the math mode is much faster.


Advantages.

The math mode outperforms the usual MT5 tester trading mode when using this library by only two indicators.

  • Performance is noticeably higher.
  • Almost zero memory consumption.


Libraries.

The following libraries are used for compilation.

#include <fxsaber\TicksShort\TicksShort.mqh>    // https://www.mql5.com/en/code/61126
#include <fxsaber\MultiTester\MTTester.mqh>     // https://www.mql5.com/en/code/26132
#include <fxsaber\Virtual\Virtual.mqh>          // https://www.mql5.com/en/code/22577
#include <fxsaber\HistoryTicks\Data_String.mqh> // https://www.mql5.com/en/code/20298
#include <TypeToBytes.mqh>                      // https://www.mql5.com/en/code/16280
#include <fxsaber\Expert.mqh>                   // https://www.mql5.com/en/code/19003
#include <fxsaber\Sequence.mqh>                 // https://www.mql5.com/en/code/31446
#include <Report.mqh>                           // https://www.mql5.com/en/code/18801


Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/61283

Bollinger Bands Crossover Signals Bollinger Bands Crossover Signals

Indicator Description – Bollinger Bands Crossover Signals Name: Bollinger Bands Crossover Signals Version: 1.1 Author: BENALI Link: https://www.mql5.com/en/users/dahmi_benali

Ascending Sort A Struct Array By A Field Example Ascending Sort A Struct Array By A Field Example

This is an example of ascending sort a struct list by a field. You can find out and customize the above algorithm depending on the purpose of use, this is the most basic example is also a direction to resolve the arrangement in an array of structure. The algorithm used in this example is Quick Sort and Merge Sort.

AIS Correlation AIS Correlation

The indicator implements some of the most interesting approaches to measuring correlations

Outbreak Trader 1.0 Outbreak Trader 1.0

Breakout Trader 1.0 trades breakouts from the range.