I’m trying to understand the philosophy of using the copybuffer() function in identifiers.
Here in the penultimate line is the code:
if(CopyBuffer(ma_handle,0,0,to_copy,MABuffer)<=0) return(0) |
I am interested in the general approach shown here.
As far as I understand, the red-highlighted 0 means that every time OnCalculate() is executed, the full data set is copied, starting from zero to the current bar.
In my opinion, this is a very expensive operation, i.e. instead of zero, you should specify something like prev_calculated, i.e. not copy the entire data set, but only one last bar. If the source indicator is redrawn, then only the area to be redrawn should be copied, but it is still only the last few bars.
The copybuffer() format allows this approach. However, 0 is specified. Why?
I guess I don’t know something or don’t take it into account. Please help me figure it out.
user_mt5
The question is removed..
It’s all backwards, it turns out. “Read the instructions..”