I thought I had read that the maximum umber of indicator buffers had changed in MQL5, but I can't find what I thought I read. Would someone please clarify what the maximum number of indicator buffers is?
See Technical indicators:
Custom Indicators can contain up to 512 indicator
buffers, and the buffer data also can be obtained by using the CopyBuffer()
function, with the handle returned by function iCustom().
Thank you Rosh.
I did search, but I missed this.
I built an custom indicator using 11 indicator buffers, but I just plot 2 (I mean, I'm using 2 buffers of type INDICATOR_DATA, 2 of type INDICATOR_COLOR_INDEX, and 7 of type INDICATOR_CALCULATIONS).
The problem is that I can just access 5 of my buffers, using CopyBuffer() function, the others 6 comes as arrays of zeroes.
It seems that besides the indicators of type INDICATOR_DATA and INDICATOR_COLOR_INDEX, I can just access one buffer of type INDICATOR_CALCULATIONS.
To work-around this, I had to have another version of my indicator, with all my buffers changed to the type INDICATOR_DATA, just to be able to access by CopyBuffer().
Is this a limitation of MQL5, or I am doing something wrong? Please, help me.
Even though a Custom Indicator can have up to 512 buffers, you cannot access all of them. It seems that you can access with CopyBuffer() only buffers of types INDICATOR_DATA and INDICATOR_COLOR_INDEX, plus just one buffer of type INDICATOR_CALCULATIONS.
To show this, I create a dummy indicator with 6 buffers: 2 INDICATOR_DATA, 1 INDICATOR_COLOR_INDEX, and 3 INDICATOR_CALCULATIONS. The CopyBuffer() could only access the first 4 buffers (only one of the three INDICATOR_CALCULATIONS could be returned by CopyBuffers).
To work-around this, you have to create another version of this indicator, with all my buffers of type INDICATOR_CALCULATIONS changed to the type INDICATOR_DATA, just to be able to access by CopyBuffer().
As I said, it's a word-around, not a desired solution to this limitation. It's very annoying to have to have always 2 versions of the same indicator just to be able to access all this buffers.
(I attach the dummy indicator and the dummy indicator reader)
Wow. This dates back to 2010. I could use the info too. Can someone shed light on this?
Currently there is no problem. Tested. You can see the image about dummy_indicator :