Using Custom Indicator buffer without declaration?

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
157
cashcube 2016.08.12 16:19 #
 
WHRoeder:
Perhaps you should read the manual. SetIndexBuffer - Custom Indicators - MQL4 Reference The very first line:

That's bad. I required I need two dimensional buffers for custom indicator. I guess then I have to use normal graphical object. Which will of course make the indicator heavy load.

 

 

avatar
108
eddie 2016.08.13 01:52 #
 
What can you do with a two dimensional array, what you can't do with a set of arrays and a bit of workaround?
avatar
157
cashcube 2016.08.13 04:15 #
 
eddie:
What can you do with a two dimensional array, what you can't do with a set of arrays and a bit of workaround?

I have 2 loop inside the main function. 1st loop counts the daily bar index or any bar index. Second loop counts the number of buffer segment. (For Each daily bar there can be n number of buffer which I called buffer scale).

These buffer scale I can not predict early as it get calculated. So no fix data to initialize with double data type.

This is the reason why I required two dimensional array.

If you check my  post   I already mentioned that in terms of allocating buffer, I need buffer double datatype in such format like M1[],M2[] upto N number. Where N = the maximum number of buffer required.

Double M[];
//--- indicator buffers mapping
  for(int sc = 0; sc <= buffscale; sc++ )
  {
   //---- 1st Indicator
   SetIndexBuffer(sc,M); 
   SetIndexStyle(sc,DRAW_SECTION,STYLE_SOLID,1,Col1);
   SetIndexLabel(sc,"IndicatorOne");
  }

 At the set indicator buffer section, I am allocating buffer size properly but with same array. How can I allocate it with different name? M1[],M2[] ...upto Msc[]

 

 

 

 

avatar
108
eddie 2016.08.13 13:42 #
 

You don't understand how a buffer for indicators work. One array is bound to a single line.

If you need other buffers to calculate your values you can use multi-dimensional arrays and then assign the calculated values to the indicator buffers to show them on the chart.

But you have to do the array resizing yourself.



avatar
157
cashcube 2016.08.16 07:20 #
 
eddie:

You don't understand how a buffer for indicators work. One array is bound to a single line.

If you need other buffers to calculate your values you can use multi-dimensional arrays and then assign the calculated values to the indicator buffers to show them on the chart.

But you have to do the array resizing yourself.



I do understand that one array is bound to a single line. That's why I asked at 1st post on this thread " Custom Indicator buffer without declaration", cause I didn't know how many buffer I would required, as program calculate itself. But as other member suggested I used the maximum supported number 512. 

If i use multi dimensional arrays then I need to resize its both dimension. As fas As I know with array resize, we only resize 1st dimension. So it simply not going to work for me. 

I coded to my indicator with objects but that took 7300 ms too load. lol.

So I figure somehow my indi cannot be coded under these condition.

But thank you for your input. 

 

 

 

Back to topics list   | 1 2  

To add comments, please log in or register