Está perdiendo oportunidades comerciales:
- Aplicaciones de trading gratuitas
- 8 000+ señales para copiar
- Noticias económicas para analizar los mercados financieros
Registro
Entrada
Usted acepta la política del sitio web y las condiciones de uso
Si no tiene cuenta de usuario, regístrese
¡Hola Malden!
Gracias por tu apoyo ;-)
Incluso, cuando escriba el código como me dijiste:
(creo que sí...)
#property indicator_chart_window
double buffer[];
double mom1[];
int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
mom1 = iCustom(NULL,0,"custom name",0,i);
buffer = (
Mom(mom1,10,Bars,i);
//doesn't work - no value in indi
// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed
// mom1 // this works
);
}
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);Entonces, cuando uso la "Primera" versión, no obtengo ningún valor..
Cuando uso la segunda versión, obtengo el error... hmmm.
Solo funciona la llamada al mom1... pero este no es el valor correcto...
¡Gracias por tu ayuda!
Adiós, ATSustituya el "nombre personalizado" por el nombre de su indicador (indicador existente), añada parámetros a la llamada iCustom(), y funcionará. Ese nombre fue colocado allí sólo como un ejemplo
También, usted no definió el número de buffers (no usando la propiedad # indicator_buffers ni usando la función IndicatorBuffers()) El indicador "piensa" que hay 0 buffers y nunca inicializará esos bichos al tamaño real. Defina el número de buffers que va a utilizar
_______________________
¡Hola Mladen!
Gracias por tu información... Ya lo he hecho... El código se ve así:
#property indicator_separate_window
#property indicator_color3 Red
#property indicator_width1 3
#property indicator_buffers 3
#property indicator_color1 LawnGreen
#property indicator_color2 Red
#include // here the mom() function is incl.
double buffer[];
double mom1[];
int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
mom1 = iCustom(NULL,0,"myIndi",0,i);
buffer = (
Mom(mom1,10,Bars,i); //doesn't work - no value in indi
// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed
// mom1 // this works, but no subfunction incl.
);
}
return(0);
}
//normaly in mqh incl.
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);
El error de la conversación sigue ahí...
¡Gracias por tu ayuda!
Adiós, AT
¡Hola Mladen!
Gracias por la información... Ya lo he hecho... El código se ve así:
#property indicator_separate_window
#property indicator_color3 Red
#property indicator_width1 3
#property indicator_buffers 3
#property indicator_color1 LawnGreen
#property indicator_color2 Red
#include // here the mom() function is incl.
double buffer[];
double mom1[];
int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
mom1 = iCustom(NULL,0,"myIndi",0,i);
buffer = (
Mom(mom1,10,Bars,i); //doesn't work - no value in indi
// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed
// mom1 // this works, but no subfunction incl.
);
}
return(0);
}
//normaly in mqh incl.
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);
El error de la conversación sigue ahí...
¡Gracias por tu ayuda!
Adiós, ATAquí hay una versión sin errores de compilación : _test.mq4
No tengo ni idea de lo que es "myIndi" por lo que no pude probar si iCustom() devuelve los valores de su indicador "myIndi
¡Hola Mladen!
Mi indi es una salida normal del JMA.mq4 / JMA Indi.
También podría ser una salida de MA o cualquier otra cosa. "myIndi" no es un indi especial.
Y la llamada del indi funciona en la ventana normal del indi...
Mi código se ve así:
#property indicator_separate_window
#property indicator_color3 Red
#property indicator_width1 3
#property indicator_buffers 3
#property indicator_color1 LawnGreen
#property indicator_color2 Red
#include // here the mom() function is incl.
double buffer[];
double mom1[];
int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
mom1 = iCustom(NULL,0,"JMA",0,i); //normal JMA / MA output
// I get this out put, and it's ok, but the second output (buffer) is zero...
buffer = (
Mom(mom1,10,Bars,i); //no compiler error, but doesn't work - no value in indi window
// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed
// mom1 // this works, but it's the value i want
);
}
return(0);
}
//normaly in mqh incl.
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);
No me sale el fallo que hice....
¡¡Muchas gracias por tu ayuda!!
Adiós, AT
¡Hola Mladen!
Cuando escribo o lo cambio así...
También me sale el error de la conversación... ¿alguna idea...?
¡Muchas gracias!
Adiós, AT
#property indicator_separate_window
#property indicator_color3 Red
#property indicator_width1 3
#property indicator_buffers 3
#property indicator_color1 LawnGreen
#property indicator_color2 Red
//#include // here the mom() function is incl.
double buffer[];
double mom1[];
int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }
//normaly in mqh incl.
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
mom1 = iMA(Symbol(),Period(),13,8,MODE_SMMA,PRICE_MEDIAN,i); //normal JMA / MA output
// I get this out put, and it's ok, but the second output (buffer) is zero...
buffer = (
// Mom(mom1,10,Bars,i) //no compiler error, but doesn't work - no value in indi window
Mom(mom1,10,Bars,i) //error: parameter conversation not allowed
// mom1 // this works, but it is NOT the value i want
);
}
return(0);
}
¡Hola Mladen!
Cuando escribo o lo cambio así...
También me sale el error de la conversación... ¿alguna idea...?
¡Muchas gracias!
Adiós, AT
#property indicator_separate_window
#property indicator_color3 Red
#property indicator_width1 3
#property indicator_buffers 3
#property indicator_color1 LawnGreen
#property indicator_color2 Red
//#include // here the mom() function is incl.
double buffer[];
double mom1[];
int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }
//normaly in mqh incl.
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
mom1 = iMA(Symbol(),Period(),13,8,MODE_SMMA,PRICE_MEDIAN,i); //normal JMA / MA output
// I get this out put, and it's ok, but the second output (buffer) is zero...
buffer = (
// Mom(mom1,10,Bars,i) //no compiler error, but doesn't work - no value in indi window
Mom(mom1,10,Bars,i) //error: parameter conversation not allowed
// mom1 // this works, but it is NOT the value i want
);
}
return(0);
}
at120
No puedes usar un elemento que evolucione a doble cuando el parámetro esperado se supone que es const double[]. En vez de usar "mom1" usa "mom1".
¡Hola Mladen!
Gracias por la respuesta, así que mi pregunta ahora es, cómo "convertir" mi doble a mi serie const double[]
porque cuando uso el mom1 solo obtengo un "0" como salida...
Entonces, ¿cómo puedo hacer que el mom1 se "parezca", por ejemplo, al Close. ¿Hay algún código de ejemplo para ello?
Muchas gracias y adiós, AT
¡Hola Mladen!
Gracias por la respuesta, así que mi pregunta ahora es, cómo "convertir" mi doble a mi serie const double[]
porque cuando uso el mom1 solo obtengo un "0" como salida...
Entonces, ¿cómo puedo hacer que el mom1 se "parezca", por ejemplo, al Close. ¿Hay algún código de ejemplo para ello?
Muchas gracias y adiós, ATNo es necesario "convertir" nada. En el momento en que se elimina la parte "" se "convierte" en el parámetro adecuado
Así es como se ve en el gráfico:
Y aquí está el código : prueba_2.mq4
¡Hola Mladen!
Ahora me funciona, parece que me olvidé del IndicatorBuffers(2);
¡Ahora parece que me sale el valor correcto!
¡Muchas gracias por tu ayuda!
Adiós, AT
¿Qué arrays deben declararse como const en los parámetros de las funciones?