Why the CopyBuffer step will take a lot of time?

 
I tested my EA system and found that when calling the system indicator, the CopyBuffer step will take a lot of time, and the time for calling the number of 1000 and 10 is the same. Does anyone know what causes this problem?
 
Blur Darkness :
I tested my EA system and found that when calling the system indicator, the CopyBuffer step will take a lot of time, and the time for calling the number of 1000 and 10 is the same. Does anyone know what causes this problem?
Call the indicator as EMA
 
Blur Darkness #: I tested my EA system and found that when calling the system indicator, the CopyBuffer step will take a lot of time, and the time for calling the number of 1000 and 10 is the same. Does anyone know what causes this problem? Call the indicator as EMA

Your first call to copy buffer contents, will require the indicator to do its first major total calculations on all the bars. This first call takes time, irrespective of if you need 1000 bars or only 10.

In subsequent calls, it only needs to do the incremental calculations so it is much faster,. So write your code to take this into consideration.

 
Fernando Carreiro #:

Your first call to copy buffer contents, will require the indicator to do its first major total calculations on all the bars. This first call takes time, irrespective of if you need 1000 bars or only 10.

In subsequent calls, it only needs to do the incremental calculations so it is much faster,. So write your code to take this into consideration.

Thank you!

Reason: