Please expose sample of code that generates runtime error
Please expose sample of code that generates runtime error
I can't reproduce the bug. Now it works but there's another problem. Each time after I call ArrayCopySeries I also call ArraySetAsSeries(closeBuffer, false) because I want to use it as a standard array (not series). The first time it works. After that, the array remains a series array in spite of the call.
Here is the code
#property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Yellow int Length = 50; int size; double closeBuffer[]; double iBuffer1[]; int init() { SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,iBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,closeBuffer); return(0); } int start() { if (Bars <= Length) return(0); int bar; int counted_bars = IndicatorCounted(); // initializing buffers with zeros if (counted_bars < 1) for (bar=Bars; bar>=Bars-Length-1; bar--) iBuffer1[bar] = 0.0; size = ArrayCopySeries(closeBuffer, MODE_CLOSE, NULL, 0); ArraySetAsSeries(closeBuffer, false); Print(closeBuffer[0], " ", closeBuffer[1]); return(0); }
ArraySetAsSeries cannot be applied to series arrays.
Use your own controlled array
Use your own controlled array
double closeBuffer[]; ... ArrayResize(closeBuffer,Bars); ArrayCopy(closeBuffer,Close); ...
ArraySetAsSeries cannot be applied to series arrays.
Use your own controlled array
Use your own controlled array
double closeBuffer[]; ... ArrayResize(closeBuffer,Bars); ArrayCopy(closeBuffer,Close); ...
Ok, Thanks. Everything works for me now.
Doji
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
"There is no real memory allocation for data array and nothing is copied. When such an array is called, the access is redirected. Excluded are arrays that are assigned as indexed ones in custom indicators. In this case, data are really copied."
Well, I try to use this function on an array "that is assigned as indexed one" but then I get this runtime error message: 'ArrayCopySeries function internal error', and no data is copied.
Is this a bug? If not what is wrong?
Thanks,
Doji