Ayuda a la codificación - página 555

 
mntiwana:
Querido MLADEN,

Gracias jefe, entonces en este caso, el código podría ser así, por favor corrígeme,

saludos

===================================================================

código original "simple MA cross EA

//

#define _doNothing 0

#define _doBuy 1

#define _doSell 2

int inicio()

{

int doWhat = _doNothing

double diffc = iMA(NULL,0,Ma1Period,0,Ma1Method,Ma1Price,BarToUse) -iMA(NULL,0,Ma2Period,0,Ma2Method,Ma2Price,BarToUse);

double diffp = iMA(NULL,0,Ma1Period,0,Ma1Method,Ma1Price,BarToUse+1)-iMA(NULL,0,Ma2Period,0,Ma2Method,Ma2Price,BarToUse+1);

si ((diffc*diffp)<0)

si (diffc>0)

doWhat = _doBuy;

si no, doWhat = _doSell;

si (doWhat==_doNothing) return(0);

//

================================================

alterado de esta manera

#define _doNothing 0

#define _doBuy 1

#define _hacerVenta 2

int inicio()

{

int doWhat = _doNothing;

double diffc = iCustom(NULL,0, "Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse)

-iCustom(NULL,0, "Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse);

double diffp = iCustom(NULL,0, "Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse==2)

-iCustom(NULL,0, "Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse==2);

if ((diffc*diffp)<0)

si (diffc>0)

doWhat = _doBuy;

si no, doWhat = _doSell;

si (doWhat==_doNothing) return(0);

//

=====================================

mntiwana

Reemplaza esto :

double diffp = iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse==2)

-iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse==2);[/PHP]

with this :

[PHP]double diffp = iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse+1)

-iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse+1);
 

Ayuda para el filtro ADX

Hola Pro-Coders,

Me gustaría implementar un filtro ADX que filtre las condiciones de mercado lateral.

Si el ADX está por debajo de 25 no debería abrir operaciones, he codificado este sencillo filtro:

extern int ADXPeriod=14;

double CurrentADX = iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,0);

double PreviousADX = iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,1);

bool ADXfilter=false;

if(CurrentADX>25&&PreviousADX<25)

{

ADXfilter=true;

}

if(ADXfilter=true)

{

BUY();

.

.

SELL();

}

[/CODE]

For some reason the filer is not working. I have put the ADX filter before placing the buy / sell order.

Also putting it to the entry conditions signal is not working.

[CODE]

if(ADXfilter=true && MAFIB=="true" && BUY=="true")

¿Podría alguien aconsejarme? Gracias de antemano.

 
tfi_markets:
Hola Pro-Coders,

Me gustaría implementar un filtro ADX que filtre las condiciones de mercado lateral.

Si el ADX está por debajo de 25 no debería abrir operaciones, he codificado este sencillo filtro:

extern int ADXPeriod=14;

double CurrentADX = iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,0);

double PreviousADX = iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,1);

bool ADXfilter=false;

if(CurrentADX>25&&PreviousADX<25)

{

ADXfilter=true;

}

if(ADXfilter=true)

{

BUY();

.

.

SELL();

}

[/CODE]

For some reason the filer is not working. I have put the ADX filter before placing the buy / sell order.

Also putting it to the entry conditions signal is not working.

[CODE]

if(ADXfilter=true && MAFIB=="true" && BUY=="true")

¿Podría alguien aconsejarme? Gracias de antemano.

tfi_mercados

Su condición funcionará sólo cuando el ADX cruce el nivel 25 en una barra actual

Utilice simplemente esto en su lugar :

if(CurrentADX>25) ADXfilter=true;

 
mladen:
mntiwana

Reemplaza esto :

double diffp = iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse==2)

-iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse==2);[/PHP]

with this :

[PHP]double diffp = iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma1Period,Ma1Price,2,0 ,0,BarToUse+1)

-iCustom(NULL,0,"Hull parabolic 2.1",PERIOD_CURRENT,Ma2Period,Ma2Price,2,0 ,0,BarToUse+1);

Estimado MLADEN,

de nuevo gracias, esa parte se hace con su amable ayuda, puede usted por favor aconsejar lo que añadir / sustituir en EXTERN (MA1, MA2 método), señalé en la imagen.

saludos

Archivos adjuntos:
10.png  128 kb
 
mntiwana:
Estimado MLADEN,

de nuevo gracias, esa parte se hace con su amable ayuda, puede usted por favor aconsejar lo que añadir / reemplazar en EXTERN (MA1, MA2 método), señalé en la imagen.

saludos

mntiwana

Puedes eliminar los métodos ma de ahí. Ya no son necesarios en absoluto

 
mladen:
mntiwana Puedes eliminar los métodos ma de ahí. Ya no son necesarios en absoluto

Querido MLADEN,

muchas gracias BOSS, por la lección de hoy y la mejora es más que suficiente,

saludos

 

Queridos todos,

Estoy buscando la función sigmoide en mql4. Esto es lo que he encontrado hasta ahora:

//--------------------------- sigmoid() ---------------------------------

// 1/(1+exp(-x))

double sigmoid(double x)

{

si (x>50) devuelve (1);

si (x<-50) devuelve (0);

return (1.0/(1.0+MathExp(-x));

}//sigmoide()

https://www.mql5.com/en/code/9002 y este debate red neuronal - Algoritmo sigmoide rápido - Stack Overflow

¿Alguien puede ayudar? Gracias.

 
nevar:
Estimados todos,

Estoy buscando la función sigmoide en mql4.Esto es lo que he encontrado hasta ahora:

//--------------------------- sigmoid() ---------------------------------

// 1/(1+exp(-x))

double sigmoid(double x)

{

si (x>50) devuelve (1);

si (x<-50) devuelve (0);

return (1.0/(1.0+MathExp(-x));

}//sigmoide()

https://www.mql5.com/en/code/9002 y este debate red neuronal - Algoritmo sigmoide rápido - Stack Overflow

¿Alguien puede ayudar?

nevar

aquí se utilizó uno : https://www.mql5.com/en/forum/179686/page13

 

hola mladen ....wowww su mejor que mi indicador..... usted es el mejor..muchas gracias su ayuda.....muchas gracias mucho.....sinceramente...

 

HI mladen,

¿habéis encontrado el error en mi código?

Gracias