- ludo31:You must handle the extra arrays yourself.
I don't know if you understand my problem but sometimes I have the similar problem . I have 8 buffers ExtMapBuffer but the code need to use another array (2 arrays) here tableau1 and tableau2
as you an see how to use the 2 arrays (tableau1 and tableau2) may be the problem is those are not declared as a buffer ( and I can't becaue there are already 8 buffers )double tableau1[]; double tableau2[]; : int start() { if (!ResizeBuffer(tableau1, Bars)) return; if (!ResizeBuffer(tableau2, Bars)) return; : /////////////////////////////////////////////////////////////////////////////// bool ResizeBuffer(double& buffer[], int size){ if (ArraySize(buffer) != size){ ArraySetAsSeries(buffer, false); // Shift values B[2]=B[1]; B[1]=B[0] if (ArrayResize(buffer, size) <= 0){ Alert("ArrayResize [1] failed: ", GetLastError()); return(false); } ArraySetAsSeries(buffer, true); } return(true); }

yes, use more then 8 buffers, you should 1) resize it to allocate its buffer size, 2) set it as series in time order. before use it.
No you cant do dimensional arrays because it is not the amount of arrays that is limited, it is the amount of lines that can be drawn. As SetIndexBuffer(n, buffer)
If you want to use more than 8 drawing buffers to make more than 8 lines you have to make 2 indicators, but if you need extra buffers for calculations such as holding values to be used in iMAOnArray() you then do like WHR said and use regular arrays, with some modificatons so they act like buffers would.
This means to reindex the array every time a new bar starts, so move each value up one index in the array and to resize it accordingly, and to set the array as series.
yes, use more then 8 buffers, you should 1) resize it to allocate its buffer size, 2) set it as series in time order. before use it.
This means to reindex the array every time a new bar starts, so move each value up one index in the array and to resize it accordingly, and to set the array as series.
Resize adds elements to the end. When false you're adding elements to the end, then setting it true the new elements are now at zero - no move necessary.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello ;
I don't know if you understand my problem but sometimes I have the similar problem . I have 8 buffers ExtMapBuffer but the code need to use another array (2 arrays) here tableau1 and tableau2
here i the code (simple)
double tableau1[]; double tableau2[]; int ExtCountedBars=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //|------------------------------------------------------------------| int init() { IndicatorBuffers(8); //---- indicators SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, color1); SetIndexBuffer(0, ExtMapBuffer1); SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, color2); SetIndexBuffer(1, ExtMapBuffer2); SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, color3); SetIndexBuffer(2, ExtMapBuffer3); SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, color4); SetIndexBuffer(3, ExtMapBuffer4); //---- SetIndexDrawBegin(0,10); SetIndexDrawBegin(1,10); SetIndexDrawBegin(2,10); SetIndexDrawBegin(3,10); //---- indicator buffers mapping SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexBuffer(2,ExtMapBuffer3); SetIndexBuffer(3,ExtMapBuffer4); //---- initialization done SetIndexBuffer(4,ExtMapBuffer5); SetIndexBuffer(5,ExtMapBuffer6); SetIndexBuffer(6,ExtMapBuffer7); SetIndexBuffer(7,ExtMapBuffer8); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double haOpen, haHigh, haLow, haClose; // ca commence caclcul int limit ; int counted_bars=IndicatorCounted(); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; // ici commence for(int i=0; i<limit; i++) { if(Close[i]>=Open[i]) { tableau1[i] = (Open[i]-Low[i]); tableau2[i]= (High[i]-Open[i]); } if(Close[i]<Open[i]) { tableau1[i] = (Open[i]-Low[i])); tableau2[i] = (High[i]-Open[i]); } // may be the problem is here // may be it can 't affect the value of tableau1 for(i=0; i<limit; i++) { ExtMapBuffer8[i] = iMAOnArray(tableau1,0,period1,0,MODE_LWMA,i); ExtMapBuffer5[i] = iMAOnArray(tableau2,0,period1,0,MODE_LWMA,i); } for(i=0; i<limit; i++) { ExtMapBuffer6[i] = iMAOnArray(ExtMapBuffer5,0,7,0,MODE_LWMA,i)-iMAOnArray(ExtMapBuffer8,0,7,0,MODE_LWMA,i); } for(i=0; i<limit; i++) { ExtMapBuffer7[i] = iMAOnArray(ExtMapBuffer6,0,7,0,MODE_LWMA,i); // ExtMapBuffer7[i] = Close[i]; } /************************************************************** / ************************************************************ etc .......................... I use all ExtMapBuffer****as you an see how to use the 2 arrays (tableau1 and tableau2) may be the problem is those are not declared as a buffer ( and I can't becaue there are already 8 buffers )
do you have an idea ??
the problem is may be here :
thanks