This line isn't necessary :
if (cantidad==0) cantidad= ArraySize(arValores);
You can also put the following line in OnInit() (if your array is declared globally), or before you call to cargeDesdeBuffer()
ArraySetAsSeries(arValores, true); //ojo, para que responda ArraySetAsSeries, arValores[] debe ser dinámico
Don't know if that help, as you published only this snippet of code.

- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
This line isn't necessary :
You can also put the following line in OnInit() (if your array is declared globally), or before you call to cargeDesdeBuffer()
Don't know if that help, as you published only this snippet of code.
//--------------------------------- CARGA DATOS DESDE BUFFER INDICADOR ------------------------------- bool cargaDesdeBuffer( int puntero, // puntero del indicador double &arCopiaInv[], // array donde descargar los valores del indicador int cantidad= 0, //número de valores a copiar int velaIni= 0, //vela inicial de la descarga int indBuffer= 0) //índice del buffer del indicador a descargar { double arValores[]; bool correcto= _No, arDinam= ArrayIsDynamic(arCopiaInv); int copiados= -1; if (arDinam) ArrayResize(arCopiaInv, cantidad); else if(cantidad==0) cantidad= ArraySize(arCopiaInv); //asumimos que el array pasado es estático ArrayResize(arValores, cantidad); ResetLastError(); copiados= CopyBuffer(puntero, indBuffer, velaIni, cantidad, arValores); if(copiados>0) { correcto= true; if (arDinam) ArraySetAsSeries(arCopiaInv, true); //esta función sólo funciona sobre arrays dinámicos else invierteArray(arValores, arCopiaInv); } else infoError(_LastError, __FUNCTION__); return(correcto); } //------------------------- FUNCION INVIERTE ARRAY ------------------------------------ bool invierteArray(double &arDer[], double &arInv[]) { //arInv[] debe ser dinámico bool resp; int dim= ArraySize(arDer); ResetLastError(); for(int k=dim-1; k>=0; k--) arInv[(dim-1)-k]= arDer[k]; resp= _LastError==0; return(resp); }
Seeking solution to the problem, which is, I modified the function as above.
The variable "pointer" to charge with iCustom in OnInit () is forced to do so because otherwise during execution each call to buffer an indicator I load indicator on screen to saturate the RAM.
The following statement does not allow me to specify the size of the array which introduced the function call, but knowing that I have removed the problem does not affect
if (cantidad==0) cantidad= ArraySize(arValores);
The fact is that I still have the same problem: The algorithm works in the first iterations and then the light starts to return zero values. I can apply the algorithm directly indicator EA code but not solve a problem that can give me in the future with other personal indicators that use other strategies.
There is a error. The function must be...
//--------------------------------- CARGA DATOS DESDE BUFFER INDICADOR ------------------------------- bool cargaDesdeBuffer( int puntero, // puntero del indicador double &arCopiaInv[], // array donde descargar los valores del indicador int cantidad= 0, //número de valores a copiar int velaIni= 0, //vela inicial de la descarga int indBuffer= 0) //índice del buffer del indicador a descargar { double arValores[]; bool correcto= _No, arDinam= ArrayIsDynamic(arCopiaInv); int copiados= -1; if (arDinam) ArrayResize(arCopiaInv, cantidad); else if(cantidad==0) cantidad= ArraySize(arCopiaInv); //asumimos que el array pasado es estático ArrayResize(arValores, cantidad); ResetLastError(); copiados= CopyBuffer(puntero, indBuffer, velaIni, cantidad, arValores); if(copiados>0) { correcto= true; if (arDinam) { ArrayCopy(arCopiaInv, arValores); ArraySetAsSeries(arCopiaInv, true); //esta función sólo funciona sobre arrays dinámicos } else invierteArray(arValores, arCopiaInv); } else infoError(_LastError, __FUNCTION__); return(correcto); }
Seeking solution to the problem, which is, I modified the function as above.
The variable "pointer" to charge with iCustom in OnInit () is forced to do so because otherwise during execution each call to buffer an indicator I load indicator on screen to saturate the RAM.
As I already said you only show one function and not the main code of your indicator. Maybe someone can help you with this, but personally I can't.
I introduced the indicator algorithm in the EA indicator directly and the program works as expected ... as has worked in MQL4. Introduce the indicator in OnInit () with ChartIndicatorADD () and the problem persists: the indicator provides zero values to the graph.
If not I have an error in your code indicator, the problem must be in the internal management makes mql5 with buffers. Unless someone inform me of any errors that I see, for now I miss custom indicators in MQL5.
Attached indicator file...

- 2010.03.03
- Nikolay Kositsin
- www.mql5.com
Attached indicator file...
Your code doesn't compile. Maybe as I don't have #include <include MovingAverages.mqh>
I introduced the indicator algorithm in the EA indicator directly and the program works as expected ... as has worked in MQL4. Introduce the indicator in OnInit () with ChartIndicatorADD () and the problem persists: the indicator provides zero values to the graph.
If not I have an error in your code indicator, the problem must be in the internal management makes mql5 with buffers. Unless someone inform me of any errors that I see, for now I miss custom indicators in MQL5.
Attached include and indicator files with a little error corrected...
I introduced the indicator algorithm in the EA indicator directly and the program works as expected ... as has worked in MQL4. Introduce the indicator in OnInit () with ChartIndicatorADD () and the problem persists: the indicator provides zero values to the graph.
If not I have an error in your code indicator, the problem must be in the internal management makes mql5 with buffers. Unless someone inform me of any errors that I see, for now I miss custom indicators in MQL5.
Attached include and indicator files with a little error corrected...
Ok, now it miss include_Base.mqh to compile :-) Once I can compile your code, then I will checked and help you (if I can).
Ok, now it miss include_Base.mqh to compile :-) Once I can compile your code, then I will checked and help you (if I can).

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
load function values has no secrets and I call on each sail within the signal algorithm, is ...
Gracias... perdón, Thank you.