Tester: cannot add tick event (events' array size is 35782656)

 

Hello,

sometimes the strategy tester stops short before completing the backtest. Then, after a couple of minutes it throws the following error:

CS      2       11:43:38.525    Tester  cannot add tick event (events' array size is 35782656)
CS      0       11:43:38.589    Tester  DIS,Daily: 4782497 ticks, 145 bars generated. Environment synchronized in 0:00:00.093. Test passed in 0:06:20.060 (including ticks preprocessing 0:00:03.094).
CS      0       11:43:38.589    Tester  DIS,Daily: total time from login to stop testing 0:06:20.153 (including 0:00:00.093 for history data synchronization)
CS      0       11:43:38.589    Tester  49479167 total ticks for all symbols
CS      0       11:43:38.589    Tester  DIS: passed to tester 4799979 ticks
CS      0       11:43:38.589    Tester  EURUSD: generate 78191111 ticks in 0:00:03.094, passed to tester 44696670 ticks
CS      3       11:43:38.642    Tester  not enough available memory, 7392 Mb used, 5026 Mb available, maximal available block is 5026 Mb
CS      0       11:43:38.642    Tester  log file "C:\Users\...\AppData\Roaming\MetaQuotes\Tester\1A55FAA85B60C737304934B2D831858E\Agent-127.0.0.1-3000\logs\20221021.log" written
CS      0       11:43:38.643            test Experts\AlgoTrading\EA.ex5 on DIS,Daily thread finished
CS      0       11:43:38.655    127.0.0.1       prepare for shutdown

However, this does not happen all the time. If I restart the backtest without changing anything in the code or settings, it completes fine but sometimes it throws the above error.

I found two relevant posts in this forum

1) https://www.mql5.com/en/forum/411809

2) https://www.mql5.com/en/forum/393733/page2824#comment_29660540

Within the first link it is suggested to manually delete the data but I don't know which data is exactly meant:

"Did you backtest other symbols before that? I often run into a similar problem after testing different symbols. MT keeps the old data and keeps storing it till you run out of memory. Deleting it manually could solve the problem."

Within the second link, I did not find any useful content to solve this error.

Is it somehow possible to delete the kept data within the OnInit() function using code?

This backtest is rather short but I also run some across 6 years and there it happens much more often that the tester does not complete it. Probably because more data is stored along the test run. So maybe it is also possible to delete data during the run to free some memory?

Backtesting Issue... - I'm trying to backtest on UK100 symbol because I run out of memory
Backtesting Issue... - I'm trying to backtest on UK100 symbol because I run out of memory
  • 2022.05.01
  • www.mql5.com
Hi, i'm encountering a data loading issue when trying to backtest on uk100 symbol. Did you backtest other symbols before that. I’m using 1 minute ohlc and have found that the data only goes back to 28/03/2017
 
Hmm have you read:
Tester  not enough available memory, 7392 Mb used, 5026 Mb available, maximal available block is 5026 Mb

Try another solution: 'bigger' pc, the MQ-cloud of agents:


 

Hello Carl, thanks for your input!

yes, I have read this bit related to "not enough memory". It is also said to be the issue in the first link. 

When I run a 6 years backtest in about 30% of the cases I get this memory issue and in about 70% of the cases it runs without any errors. On the other hand, when I run just a 1 year backtest, it also happens that I get this error even though much less data is used. I can only explain this behaviour in that way that windows is using some more RAM for whatever reason, when the backtest is currently running.

For me, it would make much mor sense when the test fails let's say when the backtest is longer than roughly 2 years. Then you could argue that after these 2 years too much data is loaded into the RAM and then it fails but as described it behaves kind of randomly.

I have a new Microsoft Surface Laptop 4 with the following specs:

Gerätename      LAPTOP-1U58FQN1
Prozessor       11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz   3.00 GHz
Installierter RAM       16,0 GB (15,8 GB verwendbar)
Systemtyp       64-Bit-Betriebssystem, x64-basierter Prozessor
Edition Windows 11 Home
Version 22H2
Installiert am  ‎08.‎10.‎2022
Betriebssystembuild     22621.674
Leistung        Windows Feature Experience Pack 1000.22634.1000.0
EDIT: Also what is interesting is that this error occurres only at the end of the backtest when it stops. It never happens during the run itself. So maybe there is something going on during the deinit process.
Reason: