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

 
-Aleks-:

I get it, the problem is made up.

When confronted with real indicator brakes in a real project, I will be ready to continue the discussion.

 
-Aleks-:

A sad fact for five, and the developers don't explain the sacred meaning of this?

Apparently, it's a matter of architecture. I wasn't interested.

There was a discussion on a related topic here - https://www.mql5.com/ru/forum/8278

Потребление памяти терминалом
Потребление памяти терминалом
  • www.mql5.com
Для чистоты эксперимента установил голый МТ5 в новую папку, открыл демо-счет на сервере MQ, закрыл все графики, установил "макс. - - Категория: общее обсуждение
 

The starter got into the thick of it, not having understood the basics of working with indicators ... but the information is publicly available (articles + Documentation).

Hence a lot of wrong questions and guesses...

Another link to the indicator created using OpenCL. The load is on the video card.

True, to get a comparative calculation speed, the task has to be really "heavy"...

 
komposter:

By the way, MT4 copes very well with calculation of only a part of history and does not consume memory for the whole buffer, if the loop goes through the last 1000 bars (even if there are 50000 bars "in the window").

However, I encountered this problem in MT5 - it allocates memory for all 50000 bars even if only the last 100 are counted.

Are you sure about that?

In both platforms the indicator buffers are allocated automatically and in the same way for all available bar history.

 
Renat:

Are you sure about this?

In both platforms indicator buffers are allocated automatically and equally for all available bar history.

I haven't checked it for the last half year, but the same indicator with 1000 bars in MT4 and MT5 used very different amount of memory (when displaying a large number of bars in the window).

I have doubts now. Maybe it's a problem with the object cache we discussed here -https://www.mql5.com/ru/forum/8278?

Потребление памяти терминалом
Потребление памяти терминалом
  • www.mql5.com
Для чистоты эксперимента установил голый МТ5 в новую папку, открыл демо-счет на сервере MQ, закрыл все графики, установил "макс. - - Категория: общее обсуждение
 
Renat Fatkhullin:

Are you sure about this?

In both platforms the indicator buffers are allocated automatically and the same for all available bar history.

I encountered a problem in MT4 - there is a script that has the task to overlay an indicator on a chart, collect data from its buffer and do the mathematical calculation and analysis.

The operation of the script with embedded indicators is perfect, but things are not so good with indicators called via iCustom - the memory, allocated for the terminal (maximum), finishes quickly, as a result the script starts getting zero values of the buffer from the indicator. Is there a possibility to forcibly clear the RAM at the moment of the indicator deletion from the chart or after its re-call, but with different parameters, through iCustom)?

 
-Aleks-:

I have faced a problem with MT4 - there is a script that implements an indicator on a chart, collects data from its buffer and performs mathematical calculation and analysis.

The operation of the script with embedded indicators is perfect, but things are not so good with indicators called via iCustom - the memory, allocated for the terminal (maximum), finishes quickly, as a result the script starts getting null values of the buffer from the indicator. Is there a possibility to forcibly clear the RAM at the moment of the indicator removal from the chart or after its re-call, but with different parameters, through iCustom)?

And exactly how many iCustoms with different parameters have you created?

If there are dozens and hundreds (it seems so), nothing can be done within the external indicators. You can only insert it inside your own EA as a calculation unit that does not consume memory.

In MetaTrader 5 there is a full control over all of the requested indicators, but even there the game "I create and delete hundreds of indicators" is fraught with serious costs.

 
Renat Fatkhullin:

And exactly how many iCustoms with different parameters have you created?

If there are dozens and hundreds (it seems to be so), nothing can be done within external indicators. The only thing you can do is to embed it inside your EA as a calculation unit that does not consume memory.

In MetaTrader 5 there is a full control over all of the requested indicators, but the game "I create and delete hundreds of indicators" is fraught with serious costs.

You create a single indicator, then you change its parameters. The iCustom function is used in the indicator itself with requesting data for another indicator - it was easier to do this way.
If we count all the requests in this bunch, we will get approximately 7 buffers.
Other indicators with the iCustom function, but simpler ones, the script crunches... total overlaps in the vicinity of ten thousand. The current indicator crunches on the sixth dozen passes.
I understand that I'm running out of memory, but if we're not using old data, why isn't the new data filling in correctly?

Why in MT4 there is no function to delete the indicator from the memory, it is very difficult to implement?

 
If the number of indicator copies is high, integrate into the EA. There is no other way out.
 
Renat Fatkhullin:
If the number of copies of indicators is large, then integrate them in the Expert Advisor. There is no other solution.

We are not talking about an EA here, we are talking about a script! The script analyses the indicator. Is there a memory freeing solution in this regard? If we teach the script to close and open the chart after several passes (changing indicator parameters and their analysis), will this allow to clear the memory?

Alexander Laur:

Why create an indicator in your Expert Advisor that must be deleted later, especially not once?

Include in the code of the Expert Advisor a function that performs a calculation similar to the calculation of the indicator. In this function, you can easily change the parameters for the calculation and there will be no memory overrun. In addition, the calculation on all bars, which, as I understand it, you don't need, can be avoided. And you won't need iCustom() function.

I just need all the bars for a period. The script works - it is universal for analysis of indicators of a certain type - it is expensive to write a script for each indicator. If only the compiler would insert indicators (according to a certain command) into advisors/scripts/indicators, then life would be different! Ah, the dreams...