How can I release Indicator memory (RAM)? - page 3

 
So someone, any solution? 
 
The answer has been given.
 
Marco vd Heijden:
The answer has been given.

Sorry but how exactly? 

 

I've also met those kind of ram weakness, but in my case it was about calculation on about 30 pairs - I've found a way thru, so obviously there's a solution to your problem. A fact being we don't know what your routine looks like. 

Just in case here's some track you could look for : 

  • Perform calculation each new bar or each x (to define) minutes rather than on each tick 
  • An array even huge used to saved some data won't break your ram then you could free it as soon as the information is displayed on screen 
  • In your code, use the array only to stock the result of the calculation, and not to calculate from
  • etc etc ... 
Hope it helps.
 

While I believe that i can see your problem: eg ArrayResize, AND I agree with your assumption that it is the issue, AND I think it is obvious that you need to recode it so that you either do not use it, OR you devide your tool into more than 1 indicator or ea; I am 100% with Mladen: if you can not or will not post the code, everything we suggest can only be guesswork, and most probable that most of our suggestions will have nothing to do with the issue. I am also assuming this from your responses that this has already occured a few times. If you can not post the code in SRC, then, at least attach it as a file.

I am sure that you may have issue with posting your code either way, but if you want special assistance, as your problem obviously requires, then, you need to post your code, OR pay someone and sign a NDD with that coder.

By "recoding" I did mean like Icham has suggested in his post: Use arrays to store the result only.

 
Sharon Aharonov: All my bars are calculations are limited, this is not the problem.

To reduce CPU, you can limit the bars calculated. Or reduce Max bars in chart to something reasonable like 1K. Or, as a last resort, use my segmented OnCalculate include file.
          Your indicator is too slow... - Indices - MQL4 programming forum #1 № 6

All buffers are sized to the number of bars on the chart. Reduce reduce Tools → Options (control-O) → Charts → Max bars in chart to something reasonable (like 1K.)

Using arrays verses buffers will make no difference to RAM, unless your arrays are only accessed circularly, thus limiting them to small sizes.

 
Icham Aidibe:

I've also met those kind of ram weakness, but in my case it was about calculation on about 30 pairs - I've found a way thru, so obviously there's a solution to your problem. A fact being we don't know what your routine looks like. 

Just in case here's some track you could look for : 

  • Perform calculation each new bar or each x (to define) minutes rather than on each tick 
  • An array even huge used to saved some data won't break your ram then you could free it as soon as the information is displayed on screen 
  • In your code, use the array only to stock the result of the calculation, and not to calculate from
  • etc etc ... 
Hope it helps.

Yes it seems that there is no escape. I don't know why the ArrayFree or ArrayResize doesn't free the memory, so as you said, I need to get throgh the code and trying to optimze it. Thanks..

 
Revo Trades:

While I believe that i can see your problem: eg ArrayResize, AND I agree with your assumption that it is the issue, AND I think it is obvious that you need to recode it so that you either do not use it, OR you devide your tool into more than 1 indicator or ea; I am 100% with Mladen: if you can not or will not post the code, everything we suggest can only be guesswork, and most probable that most of our suggestions will have nothing to do with the issue. I am also assuming this from your responses that this has already occured a few times. If you can not post the code in SRC, then, at least attach it as a file.

I am sure that you may have issue with posting your code either way, but if you want special assistance, as your problem obviously requires, then, you need to post your code, OR pay someone and sign a NDD with that coder.

By "recoding" I did mean like Icham has suggested in his post: Use arrays to store the result only.

I will try to write a short example code that can display the problem (I need some time for that..)

 
William Roeder:

To reduce CPU, you can limit the bars calculated. Or reduce Max bars in chart to something reasonable like 1K. Or, as a last resort, use my segmented OnCalculate include file.
          Your indicator is too slow... - Indices - MQL4 programming forum #1 № 6

All buffers are sized to the number of bars on the chart. Reduce reduce Tools → Options (control-O) → Charts → Max bars in chart to something reasonable (like 1K.)

Using arrays verses buffers will make no difference to RAM, unless your arrays are only accessed circularly, thus limiting them to small sizes.

Will try. Thanks..

 

The soluction:


ArrayResize dosen't free the memory to the system. Its just chance the accessible size.

To free the memory to other aplications, need to use ArrayFree.


Keep in mind that ArrayResize is faster if you need to use the memory again after because the memory continue to be reserved to the array.


double x[];

ArrayResize(x,1000);

ArrayResize(x,5); //This is the same as "ArrayResize(x,5,1000);" 
                  //because the MT5 will keep the 1000 memory reserved for the array if you want to increase the size again
Reason: