Optimization consumes too much hard drive life

 

I have found that after every optimization, my hard drive health status decreases by 1%. Later, I found out that a large amount of data was written to the hard drive during each optimization.Is this normal? What is writing to the hard drive? I know that functions such as Print() will not be executed during optimization. Is there a way to avoid this massive write to hard disk operation?


 

It all depends on how efficient your MQL code is.

I am currently running an optimisation myself (on real ticks), and I have way less resources being consumed (because my code is efficient) ...


2023.11.21 13:00:58.367 Terminal        MetaTrader 5 x64 build 4040 started for MetaQuotes Software Corp.
2023.11.21 13:00:58.368 Terminal        Windows 10 build 19045, 8 x Intel Core i7-4790T  @ 2.70GHz, AVX2, 8 / 15 Gb memory, 148 / 893 Gb disk, touchable, UAC, GMT+0
 
Jia Run Yuan:

I have found that after every optimization, my hard drive health status decreases by 1%. Later, I found out that a large amount of data was written to the hard drive during each optimization.Is this normal? What is writing to the hard drive? I know that functions such as Print() will not be executed during optimization. Is there a way to avoid this massive write to hard disk operation?


once all your ram is used by the agents the program will take the capacity of the disk as RAM but obviously this is slower since the hdd/sdd disk does not have the same speed as the ram itself.

That is why your disks are used.

To avoid this, increase the amount of RAM you have.

 
Fernando Carreiro #:

It all depends on how efficient your MQL code is.

I am currently running an optimisation myself (on real ticks), and I have way less resources being consumed (because my code is efficient) ...


I would be more careful talking about efficient MQL code. Of course you are right, but it's, by far, not the only criteria.

It depends on the EA, the data used (1 symbol or more ?, 1 timeframe or more ?, etc...), indicator(s) used, the testing period (1 month, 1 year or 10 years are very different), the testing mode of course. MT5 strategy tester is VERY greedy in resources (RAM and temporary files on the disk drive).

 
@Alain Verleyen #: I would be more careful talking about efficient MQL code. Of course you are right, but it's, by far, not the only criteria. It depends on the EA, the data used (1 symbol or more ?, 1 timeframe or more ?, etc...), indicator(s) used, the testing period (1 month, 1 year or 10 years are very different), the testing mode of course. MT5 strategy tester is VERY greedy in resources (RAM and temporary files on the disk drive).

In my example the EA in question is trading 4 symbols, accessing tick data history, OHLC data, 3 indicators and the test range is 1 year.

However, I agree that there are other factors to consider, but for the most part I have never had MetaTester eat away at my resources as much as reported by the OP, to the point of it causing damage to SSD life-span.

So, in this case, even if we consider other "greedy" factors by MetaTester, I am very confidant that the main culprit is EA code efficiency.

 
Jia Run Yuan:

I have found that after every optimization, my hard drive health status decreases by 1%. Later, I found out that a large amount of data was written to the hard drive during each optimization.Is this normal? What is writing to the hard drive? I know that functions such as Print() will not be executed during optimization. Is there a way to avoid this massive write to hard disk operation?


tick data . That's what all these reads are subsequently . It cannot keep it all in memory .

Is this the result of half a year of testing or a recent decline . 

For its price half a year of testing is okay.

 
Fernando Carreiro #:

In my example the EA in question is trading 4 symbols, accessing tick data history, OHLC data, 3 indicators and the test range is 1 year.

However, I agree that there are other factors to consider, but for the most part I have never had MetaTester eat away at my resources as much as reported by the OP, to the point of it causing damage to SSD life-span.

So, in this case, even if we consider other "greedy" factors by MetaTester, I am very confidant that the main culprit is EA code efficiency.

I can say you it's not necessarily the case. I had this issue and you can be sure my code is very efficient.

But try to optimize an EA with 28 symbols, some indicators, custom data and several timeframes on real ticks for 5 years. I was able to put a workstation with 128 GB RAM on the knees. The only solution is then to use less agents or reduce the testing period.

Anyway, you could also be right about the OP, I am just saying that all is possible.

 

Thank you all. The following is the relevant information about my current optimization:

Symbol:XAUUSD,Account currency:JPY(So USDJPY data is needed). 

Period: 1H, In the past three years

Modelling:Every tick

Indicators used:5

Recently, I have been working hard to improve the efficiency of my code.And my current RAM is 16G, which seems too small for Optimization. I will also upgrade my RAM.

BTW:Do you have any recommended articles to improve the efficiency of mql5 code?

 
Jia Run Yuan #:

Thank you all. The following is the relevant information about my current optimization:

Symbol:XAUUSD,Account currency:JPY(So USDJPY data is needed). 

Period: 1H, In the past three years

Modelling:Every tick

Indicators used:5

Recently, I have been working hard to improve the efficiency of my code.And my current RAM is 16G, which seems too small for Optimization. I will also upgrade my RAM.

BTW:Do you have any recommended articles to improve the efficiency of mql5 code?

As you can see from my computer specs, I also use 16 GB RAM, and I have 1TB SSD, but it only has about 150-180GB free at any given time.

The optimisation I was running also does not differ much from yours, You are testing one symbol, while I was testing 4. I was testing for 1 year and you for 3 years.

So, in all, there is a very big difference between the amount of resources your EA test is consuming and my own. You may need to have a serious look at how your EA is doing things.

 
Fernando Carreiro #:

As you can see from my computer specs, I also use 16 GB RAM, and I have 1TB SSD, but it only has about 150-180GB free at any given time.

The optimisation I was running also does not differ much from yours, You are testing one symbol, while I was testing 4. I was testing for 1 year and you for 3 years.

So, in all, there is a very big difference between the amount of resources your EA test is consuming and my own. You may need to have a serious look at how your EA is doing things.

What testing mode in your test ? How much ticks ?

You said real ticks but I hardly see how it's possible to get your values !?!


That's an empty EA, or almost, just added some code for it to run 15 seconds. 1 symbol, 3 years, Every Tick so simplify.


Files:
 
@Alain Verleyen #: What testing mode in your test ? How much ticks ? You said real ticks but I hardly see how it's possible to get your values !?! That's an empty EA, or almost, just added some code for it to run 15 seconds. 1 symbol, 3 years, Every Tick so simplify.

I finished the test yesterday, so I am no longer able to give you any screenshots of current situation.

The test period was for the whole year of 2022, with "Every tick based on real ticks", with 50ms delay, "Slow complete" optimisation (about 3000 passes).

The EA itself is 678 lines and is based on two EMA cross (of tick data, not OHLC), and using ATR and StdDev (of OHLC) for volatility calculations and risk assessments.

The necessary OHLC and tick data from the broker had already been download previously when I ran the test (from previous runs).

Those were my honest values I presented. I've have never had the MetaTester overwhelm my computer.

Also, I usually run the optimisations using only 4 out of 8 threads, so that I can continue doing other work.


PS! It was trading 4 symbols simultaneously, each one independently of each other in terms of strategy. My aim was to analyse if the parameters behaved well in such a scenario and if the gains of one symbol helped compensate with the drawdown of another symbol.
Reason: