Array of Buffers? (2d)

 

Hi, can you suggest how to make an array of indicator buffers? The following did not work (SetIndexBuffer not seeing param2 as an array)...

double buffer[][5];
...
for(int i = 0; i<5; i++) {
SetIndexBuffer(i,buffer[,i]);
}


Thanks,
Bob

 
rlevy1234 wrote >>

Hi, can you suggest how to make an array of indicator buffers? The following did not work (SetIndexBuffer not seeing param2 as an array)...

double buffer[][5];
...
for(int i = 0; i<5; i++) {
SetIndexBuffer(i,buffer[,i]);
}


Thanks,
Bob

I don't think you can leave the first subscript blank...

SetIndexBuffer(i,buffer[,i]);

has to be:

SetIndexBuffer(i,buffer[ SomeVariableHere ,i]);

How are you Bob? are you Sr. or Jr.? I live in Mentor...

 
Thanks Peter. Unfortunately SetIndexBuffer seems to accept only a 1d array as input (buffer[] is a common example seen in sample code).

For cleaner code, I would like to create a 2d array, buffer[][n], and then loop through the second index on each SetIndexBuffer call (rather than write the same line of code n times).

Any ideas of valid syntax to achieve this?

Thanks,
Bob
 

May I do it with class in MQL5.

It can be compiled.
0 error(s), 0 warning(s),
but, 0 indicator(s).

look my code:

https://www.mql5.com/en/forum/121672

Reason: