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.