Script Low on Memory, and giving Error loading more than N Indicators - page 2

To add comments, please log in or register
Alain Verleyen
39019
Alain Verleyen  
Diogo Seca:

Indeed! Thank you Alain!

Using your code piece, the increase in indicator count was much slower, but the overall memory consumption was much higher (from under 800MB, now the memory consumption went up to 2.5GB!).
This time, I did get a Windows warning of memory over-consumption. 

So..  

Is there a limitation on the number of indicators which can be loaded onto a Symbol or accessed within a Script? 
Short answer: No.
Long answer: Depends on how much available memory you have.

I'm now wondering whether my PC is making full use of my 16GB RAM, since it starts panicking at close to 8GB of mem.consumption. Perhaps the other 8GB are not being used..
I'll update this post with more info if I find anything MT5\MQL5 related.

Thanks.

Maybe you could open a ticket to ServiceDesk ? Seems to me a lot of memory used for an handle.

quebralim
4951
quebralim  
Alain Verleyen:

Seems to me a lot of memory used for an handle.

I'm using up to 20MB per "Custom Moving Average" indicator, which I don't think it's much taking into account I'm analyzing M5 rates since 2000..!

A note I'd like to share:
I noticed that performance and memory efficiency greatly increases when you use iMA() instead of the respective iCustom() version. The same applies to the other native iINDICATORS.
I believe MetaQuotes has prioritized and optimized their native indicators to be really efficient. Something to take into account if you're running resource-intensive calculations. 

Alain Verleyen
39019
Alain Verleyen  
Diogo Seca:

I'm using up to 20MB per "Custom Moving Average" indicator, which I don't think it's much taking into account I'm analyzing M5 rates since 2000..!

Around 72,000 bars per year. 1,152,000 bars for 16 years. 1 buffer of double gives 9.2MB 

I am still wondering why it needs 20 MB.

A note I'd like to share:
I noticed that performance and memory efficiency greatly increases when you use iMA() instead of the respective iCustom() version. The same applies to the other native iINDICATORS.
I believe MetaQuotes has prioritized and optimized their native indicators to be really efficient. Something to take into account if you're running resource-intensive calculations. 

There is certainly maybe an optimization with Standard indicators (iMA,...) but in my opinion the performance with iCustom() is mainly due to poorly coded custom indicators. I don't know how you are evaluating "performance and memory efficiency". What is the difference if you compare iMA() and iCustom() with "Examples\Custom Moving Average.mq5" provided with MT5 ?
quebralim
4951
quebralim  
Alain Verleyen:

Around 72,000 bars per year. 1,152,000 bars for 16 years. 1 buffer of double gives 9.2MB 

I am still wondering why it needs 20 MB.

There is certainly maybe an optimization with Standard indicators (iMA,...) but in my opinion the performance with iCustom() is mainly due to poorly coded custom indicators. I don't know how you are evaluating "performance and memory efficiency". What is the difference if you compare iMA() and iCustom() with "Examples\Custom Moving Average.mq5" provided with MT5 ?

I'll redo the script so you can see hahahaha - I'm laughing cos the result is hilarious. "Examples\Custom Moving Average.mq5" is so inefficient.

Here you go:

Files:
quebralim
4951
quebralim  
Diogo Seca:
Correction (v1.05):
Files:
Alain Verleyen
39019
Alain Verleyen  
Diogo Seca:

I'll redo the script so you can see hahahaha - I'm laughing cos the result is hilarious. "Examples\Custom Moving Average.mq5" is so inefficient.

Here you go:

Yes, it confirms what I said. Custom indicator poorly coded
Alain Verleyen
39019
Alain Verleyen  
Diogo Seca:
Correction (v1.05):
Thanks :-)
quebralim
4951
quebralim  

You're most welcome!

I'll report it to ServiceDesk.

Also, once again, thank you for your guidance Alain! :) 

12
To add comments, please log in or register