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

 
komposter:

And if the indicator is 5-buffer, then the first call of iCustom will calculate all buffers, the subsequent calls and requests for other buffers will only read the ready information (up to the appearance of new data for calculation).

I.e., if the indicator has been called at least once, it has received the information not only about the requested buffer, but about all the buffers included in the indicator? Or, it means that the calculation of other buffers will be found in memory and there will be no recalculation due to it - the data will be taken from RAM, if it hasn't been called explicitly before (the program (EA) hasn't allocated memory explicitly for the storage of indicator data). I read before that every time the indicator is called, it is recalculated - is it not so?

komposter:

If you have a really heavy indicator, think over your own cache system, so that at first call the data is calculated and written to the file, and at next call it is read only. I've done it this way, it's much faster.

But in 95% of cases there's no need for all that, the tester is fast enough as it is, and in 5 you can also connect the cloud.

Good luck!

Would reading from a hard drive be faster, or did you make a virtual drive in memory with the calculated indicator data?

Well, I'm only dreaming about the five, for now I only implement custom ideas on the four.

Thanks for wishing me luck!

 
komposter:

If you have a really heavy indicator, devise your own cache system, so that on the first run the data is calculated and written to the file, and on subsequent runs it is read only. I've done it this way, it's much faster.

But in 95% of cases there's no need for all that, the tester is fast enough as it is, and in 5 you can also connect the cloud.

Good luck!

I am not talking about an indicator, but about an Expert Advisor, but the subject is close. My scalper counts quite a lot, all sorts of filters, conversions. I cached my model in Matlab and first calculated all mathematics and fed it into a .mat file, and then used that data to run a strategy. Now I'm itching to do the same for MQL4 Strategy Tester, because the optimization is simply unreal.
 
-Aleks-:

I.e. if the indicator is at least once called by the program, it has received information not only about the requested buffer, but also about all those included in the indicator? Or, it means that the calculation of other buffers will be found in memory and there will be no recalculation due to it - the data will be taken from RAM, if it hasn't been called explicitly before (the program (Expert Advisor) hasn't allocated memory explicitly for the storage of indicator data). I read before that every time the indicator is called, it is recalculated - is it not so?

The indicator can not calculate only one buffer, it considers everything that is inside it at any call. Unless you can limit the calculation using parameters, but that's another issue.

Recalculation takes place at each call, but usually only the 0th bar is recalculated. And if an EA is written intelligently, these calls do not occur on every tick.

-Aleks-:

Would reading from a hard drive be faster or have you created a virtual disk in the memory with calculated indicator data?

I read from a normal disk, but not the indicator values on each bar, but the "time;signal" string; such data are much less necessary.

It is unlikely there is a universal solution for any indicator, you should rely on the global problem.

-Aleks-:

I have only dreamt about the five indicator, I have only realized my ideas on the four indicator.

The only difference is in trading part and working with time-series (including indicators).

And the cloud is a really powerful thing.

 
VDev:
I am not talking about the indicator but about the Expert Advisor, but the subject is close. I have a scalper that calculates quite a lot, all sorts of filters and transformations. I cached the model in Matlab and first calculated all mathematics and fed it into a .mat file and then used that data to run a strategy. Now I'm itching to do the same for MQL4 Strategy Tester, because the optimization is simply unreal.

There is hardly any point in having a cache for a separate indicator, I also started from the data needed in the EA.

Roughly speaking, ready signals were recorded, and then they were only read and performed entries and position support.

 
komposter:

The indicator cannot calculate just one buffer, it calculates everything inside it at any call. Unless the calculation can be limited by the parameters, but that is another topic.

Recalculation takes place at each call, but usually only the 0th bar is recalculated. And if an EA is written intelligently, then these calls do not occur on every tick.

So it turns out that if we address one indicator with a lot of buffers and receive information about all of them from one of them, then it will be faster and more economical in terms of memory than to calculate as many times as the information from its different buffers is needed for this indicator?


Still, maybe someone could do an experiment, because the idea is keeping me busy! Or is innovation research interesting only for a fee?

 
The indicator's OnCalculate() is only called the first time iCustom() is called at a new price. Subsequent calls to iCustom() only receive data without starting OnCalculate(). Let's say, the price changes, the next iCustom() callstarts onCalculate(), the next calls only receive data and so on, until the price changes, etc. (tested experimentally right now).
 
-Aleks-:

So in the end it turns out that if you address one indicator with many buffers and get information from one of them about all of them, it will be faster and more economical in memory than calculating as many times this indicator needs information from its different buffers?

1 indicator for 5 buffers or 5 indicators for 1 buffer is approximately the same.
If you only need information from 2 buffers, it will be more profitable to call 2 indicators with 1 buffer than one indicator with 5 buffers. But not more profitable than one indicator with 2 buffers.


-Aleks-:

Still, maybe someone could do an experiment, because the idea is keeping me busy! Or is innovation research interesting only for a fee?

komposter:

This approach will reduce the memory consumption of the indicator (roughly a multiple of the difference in the number of buffers before and after), but will increase the load on the processor (and "build" and "decompose" have to be done constantly).

If you don't run into memory limit (which is unlikely with current volumes), it will only slow down.

 

I feel like I'm being misunderstood! :)

But I understand that most likely it's me who doesn't understand.

Suppose we call the custom indicator in the code - we need to specify the buffer of this indicator and then, following the code, we call the custom indicator again with the same name as the first time but with a different buffer.

Question: will the indicator be calculated twice or only once?

 
-Aleks-:

...

Question will the indicator be calculated twice or only once?

Once.
 
Integer:
One time.
So a hodgepodge of the right indicators will work faster than using the indicators individually - so there will be fewer requests for quote information?
Reason: