What could be a reason for high memory consumption?

 

Hi,
I see that in some cases a backtest requires a lot of time (1hr+) and memory.


Can anyone suggest what might be reason for this so I can try to resolve it?


Thank you very much!

 
Eugen Funk:I see that in some cases a backtest requires a lot of time (1hr+) and memory. Can anyone suggest what might be reason for this so I can try to resolve it? Thank you very much!
It is almost always due to the code being inefficient. Testing on every real tick is slower than other testing methods, however code quality and efficiency can have a huge impact on the consumption of resources, like memory and computation.
 
  1. EAs : Don't do per tick what you can do per bar, or on open.
    If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts, and you recalculate.)
    If you are waiting for an order to close, only look when OrdersTotal (or MT5 equivalent) has changed.
              How to get backtesting faster ? - MT4 - MQL4 programming forum (2017)

  2. Indicators: Code it properly so it only recomputes bar zero (after the initial run).
              How to do your lookbacks correctly. (2016)
              3 Methods of Indicators Acceleration by the Example of the Linear Regression - MQL5 Articles. (2011)
    Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)

 
thank you!
Reason: