Adjusting buffer sizes to minimise RAM usage

 
For the MQL5 veterans out there - I have a multi-currency EA and I'd like to minimise the buffer length to reduce resources in order to make the EA test much more efficiently. I know there is a lot of fat to be trimmed here, as I have already leaned out my code. My EA uses 1 custom indicator and a 6 indicators (including the same ones on 2 timeframes) per pair. I don't need a buffer size of more than 500 or so and I'm virtually certain that the actual buffer length is far higher. Could someone guide me towards how I can loop through the handles and reduce each of the buffers for each handle down to a fixed value that I can enter? 
 
Peat Walker: For the MQL5 veterans out there - I have a multi-currency EA and I'd like to minimise the buffer length to reduce resources in order to make the EA test much more efficiently. I know there is a lot of fat to be trimmed here, as I have already leaned out my code. My EA uses 1 custom indicator and a 6 indicators (including the same ones on 2 timeframes) per pair. I don't need a buffer size of more than 500 or so and I'm virtually certain that the actual buffer length is far higher. Could someone guide me towards how I can loop through the handles and reduce each of the buffers for each handle down to a fixed value that I can enter? 

As far as I know the Strategy Tester uses the same buffer size as the default bar count for charts as defined by the Options. So, maybe you can just reduce that bar count for Charts. I've never tried, so I cannot confirm this.

In my own coding, I try to not to depend on Indicators and instead transfer the calculations to the EA itself, and reduce them to incremental calculations, so as not to depend on any buffer at all. Obviously, this will depend on the type of indicators required.

 
Fernando Carreiro #:

As far as I know the Strategy Tester uses the same buffer size as the default bar count for charts as defined by the Options. So, maybe you can just reduce that bar count for Charts. I've never tried, so I cannot confirm this.

In my own coding, I try to not to depend on Indicators and instead transfer the calculations to the EA itself, and reduce them to incremental calculations, so as not to depend on any buffer at all. Obviously, this will depend on the type of indicators required.

Thanks. Yes, I have already done some of this. I am curious on another note, how resizing buffers can be done. I came across some threads where MQL5's built-in buffer resizing function didn't actually work as it should. For my information, is there a functional way that this can be done? 

 
Peat Walker #: Thanks. Yes, I have already done some of this. I am curious on another note, how resizing buffers can be done. I came across some threads where MQL5's built-in buffer resizing function didn't actually work as it should. For my information, is there a functional way that this can be done? 

What exactly have you already done? It is unclear. From the rest of the post, it does not seem that you have changed the maximum number of bars for charts, which will indirectly set the maximum size of the buffers.

You cannot resize the Indicator buffers in code. All you can do is not use Indicators at all and do internal calculations instead.

 
Fernando Carreiro #:

What exactly have you already done? It is unclear. From the rest of the post, it does not seem that you have changed the maximum number of bars for charts, which will indirectly set the maximum size of the buffers.

You cannot resize the Indicator buffers in code. All you can do is not use Indicators at all and do internal calculations instead.

Sorry, I did both. Reduced the number of bars on chart and also transferred some indicator calculations to my EA. I haven't measured the memory usage before and after, I assume it can only have decreased, but I was just curious after reading this thread whether buffer resizing was a viable solution: https://www.mql5.com/en/forum/21639

BufferResize and BufferSize for TimeSeries Classes - please help
BufferResize and BufferSize for TimeSeries Classes - please help
  • 2014.03.05
  • www.mql5.com
Hi alltogether, I'm grateful that there are people always who are willing to help and are giving competent answers to all my questions...
 
Peat Walker #: ... but I was just curious after reading this thread whether buffer resizing was a viable solution: https://www.mql5.com/en/forum/21639

That forum thread has nothing to do with Indicator buffers.

Unfortunately, due to lack of better naming abilities, MetaQuotes often refer to different things by the same name, which ends up confusing users.

So I will repeat, true Indicator buffers cannot be resized by code.