Theory of EA acceleration when using a custom indicator (function - iCustom) - page 5

 
Alexander Laur:
Can you describe the task. What should the script do with all the bars? I think you are trying to solve the problem head on. It's hard to give advice without seeing the problem to be solved.

I have the script, here is the ToRhttps://www.mql5.com/p/21/234411 , but there are difficulties in operation due to lack of memory.... or rather it runs out after a short run of the script.

 
Alexander Laur:
The page is banned. That you have a script is fine, but it doesn't solve the problem. What does the script do?
The script analyzes the location of the indicator relative to price. There are many criteria - the purpose is to find the optimal settings for the indicator, in which the indicator is a support or resistance zone. The script allows to connect any indicators similar to the moving average and perform the enumeration of parameters.
 
Alexander Laur:

Renat has already answered that there is only one way - to transfer an indicator calculation to a script.

I get that, but it makes the job more complicated and increases my costs considerably. Makes the tool (script) not versatile.

Alexander Laur:

You can also perform masochism and break the calculated range of parameters into subranges. And run the script changing parameters in each subrange. It is time consuming, I know, but what can we do?

Now I think the solution may be to automate the process of opening a chart by the script, calculate some indicators on it, close the chart by the script and open a new one - this will allow to clear the memory?

Alexander Laur:

The second option is to switch to 5. I.e. we should search for the optimum parameters on the 5th indicator and then substitute the optimum parameters in the 4th indicator. In the 5, it is possible to manage the loading and unloading of indicators. But the loading/unloading operations are quite resource intensive.

I think it's better to have costly operations than not, and I understand that more memory can be used in 5, but I need indicators that were written for 4, because I trade on 4...

My calculations are based on the first one and I don't know how to convert indicator to 5, but it's possible to make indicators compatible with each other, at least after compiling ...

 
Alexander Laur:

The command to add an indicator to the chart has not been found. By deleting the chart, you will, of course, free up memory. But when you close the chart, all of the indicators on the chart will be closed.

There is a command to open new charts, but there is no command to attach the indicator to the newly opened chart. This is why the real automation will not work in this case either.

What about iCustom, we should call the indicator through it - it is tantamount to adding a chart - in fact, I do not put the chart on the chart.
 
Alexander Laur:

Calling an indicator via iCustom() is not adding a chart to the chart.

If you don't put the chart on the chart, then what chart are you going to kill in order to free up memory?

Don't waste your time, trust Renate.

Perhaps I am mistaken. Let's go over it again:

1. There is a script that calls the iCustom indicator function and saves the chart buffers in memory.

2. The iCustom function call is multiple - as a result the RAM is filled and the indicator returns zeros.

The terminal must be able to work with memory, right? To clear the cache, as I understand it, it is possible if the data are not necessary, and they are not necessary if the chart with data is removed.

4. Delete the chart and free up RAM for further calculations in point 1.

Where am I wrong?


P.S. As I understand it, the data is all tied to the chart on which the calculation is done - no matter what quotes are used for it.

 
-Aleks-:

Perhaps I am mistaken. Let's go over it again:

1. There is a script that calls the iCustom indicator function and stores the graphic buffers in memory.

2. The iCustom function call is multiple - as a result the RAM is filled and the indicator returns zeros.

The terminal must be able to work with memory, right? To clear the cache, as I understand it, it is possible if the data are not necessary, and they are not necessary if the chart with data is removed.

4. Delete the chart and free up RAM for further calculations in point 1.

Where am I wrong?


P.S. As I understand it, the data is tied to the chart on which the calculation is performed - it does not matter what quotes are used for this.

In point 3.

The terminal stores the cache of timeseries and indicators built on them for some time after closing, in order not to recalculate everything at once at next call.

 
Andrey Khatimlianskii:

In point 3.

The terminal stores the cache of timeseries and indicators based on them for some time after closing, so that it doesn't recalculate everything at once when you access it again.

But what is "some" time? Maybe there are other criteria/methods of releasing resources (deleting the cache from memory)?
 
-Aleks-:
But what is "some" time? Maybe there are other criteria/methods for releasing resources (removing the cache from memory)?

No, Renat has already replied.

In MT5 the cache is cleared if the Expert Advisor that uses indicators as resources is unloaded. I.e. you can load a chart with an Expert Advisor, read a part of it, and close the chart. But it is not very fast anyway.

I do not know about it in MT4.

 
Andrey Khatimlianskii:

No, Renat has already replied.

In MT5 the cache is cleared if the Expert Advisor that uses indicators as resources is unloaded. I.e. you can load a chart with an Expert Advisor, read a part of it, and close the chart. But it is not very fast anyway.

I do not know about it in MT4.

The memory is released after the operation of the script. So, the memory for the calculation of the data obtained from the indicator is released, but it does not concern the chart buffers, right?

And if we translate data not through the graphical buffer, but otherwise - through global variables, for example (I do not know if a buffer can be created there), then the effect of memory shortage can be overcome?

 
Here's an experiment.
1. open chart and "task manager" - used memory 215692 kb
2. I apply indicator - occupied memory 219612 kb (increase 3920 kb)
3. Removing indicator - used memory 217984 kb (released 1628 kb)
And the remaining 2292kb of unreleased memory, as I understand it, went into the cache?
Isn't the buffer taking up too much data - history from February 2013 on the Sentry.