¿Quién puede ayudar con el robot, por qué no funciona? - página 2

 
Alexey Volchanskiy:

Las reglas del lenguaje no permiten que los parámetros con valores por defecto sean ingeridos. Si tiene que ajustar el color de las flechas, escriba todos los parámetros a la izquierda del color. B deslizamiento 3 no es suficiente, si es de 5 dígitos, habrá requotes, escribí 50. Y SL y TP no deberían ser iguales a cero,Aleksey Vakhrushev ya ha escrito sobre ello.


Es un error:

El valor de retorno de 'OrderSend' debe ser comprobado
 
GIM:

Error:

El valor de retorno de 'OrderSend' debe ser comprobado
Esto es sólo una advertencia. El archivo se compilará.
 

Buenas tardes por favor ayuda.EA solo abre para la venta.


extern double Lots=0.1;
extern int FastMAPeriod=14;
extern int FastMAMethod=0; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
extern int FastMAPrice=0; // 0-Cerrado, 1-Abierto, 2-Alto, 3-Bajo, 4-Media, 5-Típico, 6-Ponderado
extern int SlowMAPeriod=42;
extern intn SlowMAMethod=0; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
extern int SlowMAPrice=0; // 0-Cerrado, 1-Abierto, 2-Alto, 3-Bajo, 4-Media, 5-Típico, 6-Ponderado
extern int TP=0; //takeprofit
extern int SL=0; //parar la pérdida

int ComprarBillete,VenderBillete;



int inicio(){

double fast_ma1=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,1);
double slow_ma1=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,1);
double fast_ma2=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,2);
double slow_ma2=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,2);


if(fast_ma1>slow_ma1 && !(fast_ma2>slow_ma2)){
if(SellTicket!=0){ /Verdadero si SellTicket no es 0 ;

SellTicket=0;
}
if(BuyTicket==0){ //// Verdadero si BuyTicket es 0;
BuyTicket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,SL=Ask-SL*Point,Ask+TP*Point,NULL,0,0,CLR_NONE);
}
}
if(fast_ma1<slow_ma1 && !(fast_ma2<slow_ma2)){
if(BuyTicket!=0){ //true si BuyTicket no es 0 ;
BuyTicket=0;
}
if(SellTicket==0){ /True if(SellTicket es igual a 0
SellTicket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid-SL*Point,Bid+TP*Point,NULL,0,0,CLR_NONE);
}
}

return(0);
}

 
Alexey Kozitsyn:
Esto es sólo una advertencia. El archivo se compilará.
Bueno, todavía no se abre el trato.....
 
GIM:
Sigue sin abrirse el trato.....
Bueno, supongo que no es el caso... Aunque podría valer la pena echar un vistazo al cuaderno de bitácora para ver qué dice... Bueno, eso es sólo una opción.
 
Alexey Kozitsyn:
Bueno, supongo que no estaba destinado a ser... Aunque podría valer la pena echar un vistazo a la revista para ver qué dice... Bueno, es una opción.
¡Gracias! Seguiré intentándolo))
 
AdikAmir:

Buenas tardes por favor ayuda.EA solo abre para la venta.


extern double Lots=0.1;
extern int FastMAPeriod=14;
extern int FastMAMethod=0; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
extern int FastMAPrice=0; // 0-Cerrado, 1-Abierto, 2-Alto, 3-Bajo, 4-Media, 5-Típico, 6-Ponderado
extern int SlowMAPeriod=42;
extern intn SlowMAMethod=0; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
extern int SlowMAPrice=0; // 0-Cerrado, 1-Abierto, 2-Alto, 3-Bajo, 4-Media, 5-Típico, 6-Ponderado
extern int TP=0; //takeprofit
extern int SL=0; //parar la pérdida

int ComprarBillete,VenderBillete;



int inicio(){

double fast_ma1=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,1);
double slow_ma1=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,1);
double fast_ma2=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,2);
double slow_ma2=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,2);


if(fast_ma1>slow_ma1 && !(fast_ma2>slow_ma2)){
if(SellTicket!=0){ /Verdadero si SellTicket no es 0 ;

SellTicket=0;
}
if(BuyTicket==0){ //// Verdadero si BuyTicket es 0;
BuyTicket=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,SL=Ask-SL*Point,Ask+TP*Point,NULL,0,0,CLR_NONE);
}
}
if(fast_ma1<slow_ma1 && !(fast_ma2<slow_ma2)){
if(BuyTicket!=0){ //true si BuyTicket no es 0 ;
BuyTicket=0;
}
if(SellTicket==0){ /True if(SellTicket es igual a 0
SellTicket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid-SL*Point,Bid+TP*Point,NULL,0,0,CLR_NONE);
}
}

return(0);
}

Es un código extraño que no había visto antes.

Las variables BuyTicket y SellTicket serán iguales a cero o incomprensibles cada vez que llegue un nuevo tick porque no están inicializadas.

La construcción if(fast_ma1>slow_ma1 && !(fast_ma2>slow_ma2)) no es nada clara cuando se traduce al lenguaje humano esta condición se ve así

si fast_ma1 es mayor que slow_ma1 Y NOT fast_ma2 es mayor que slow_ma2. El operador ! significa la negación de esta manera: if(fast_ma1>slow_ma1 && (fast_ma2<slow_ma2))

Su condición se cumple cuando fast_ma1>slow_ma1 = true (verdadero) y fast_ma2>slow_ma2 = false (falso)

....
if (OrdersTotal()==0)
{
  if (условие на покупку)
  {
    ticet = OrderSend(Symbol(),OP_BUY,.....);
    if (ticet==0) Print("ERROR");
  }
  if (условие на продажу)
  {
    ticet = OrderSend(Symbol(),OP_SELL,.....);    
    if (ticet==0) Print("ERROR");
  }

}
//Простейший код для примера.
 
Vitalii Ananev:

Este es un código extraño que no había visto antes.

Las variables BuyTicket y SellTicket serán iguales a cero o incomprensibles cada vez que llegue un nuevo tick porque no están inicializadas.

La construcción if(fast_ma1>slow_ma1 && !(fast_ma2>slow_ma2)) no es nada clara cuando se traduce al lenguaje humano esta condición se ve así

si fast_ma1 es mayor que slow_ma1 Y NOT fast_ma2 es mayor que slow_ma2. El operador ! significa la negación de esta manera: if(fast_ma1>slow_ma1 && (fast_ma2<slow_ma2))

Su condición se cumple cuando fast_ma1>slow_ma1 = true (verdadero) y fast_ma2>slow_ma2 = false (falso)

Puse su código de todos modos La posición de venta no se abre, su COMPRA solamente.
 
AdikAmir:
Puse su código todavía no abre la posición de venta, sólo compra.

extern double Lots=0.1;
extern intnal double FastMAPeriod=5;
extern int FastMAMethod=0; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
extern int FastMAPrice=0; // 0-Cerrado, 1-Abierto, 2-Alto, 3-Bajo, 4-Media, 5-Típico, 6-Ponderado
extern int SlowMAPeriod=75;
extern intn SlowMAMethod=3; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
extern int SlowMAPrice=3; // 0-Cerrado, 1-Abierto, 2-Alto, 3-Bajo, 4-Media, 5-Típico, 6-Ponderado
extern int TP=500; //sin ánimo de lucro
extern int SL=250; //parar la pérdida
doble ticet;

int inicio(){

double fast_ma1=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,1);
double slow_ma1=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,1);
double fast_ma2=iMA(NULL,0,FastMAPeriod,0,FastMAMethod,FastMAPrice,2);
double slow_ma2=iMA(NULL,0,SlowMAPeriod,0,SlowMAMethod,SlowMAPrice,2);

if (OrdersTotal()==0)
{
if (fast_ma1>slow_ma1 && (fast_ma2<slow_ma2))
{ ticet = OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Ask-SL*Point,Ask+TP*Point,NULL,0,0,CLR_NONE);
if (ticet==0) Print("ERROR");
}
if (slow_ma1>fast_ma1 && (slow_ma2<fast_ma2))
{
ticet = OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid-SL*Point,Bid+TP*Point,NULL,0,0,CLR_NONE);
if (ticet==0) Print("ERROR");
}

}

return(0);
}




 
Hay que cambiar los signos al calcular SL /TP
ticet = OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+SL*Point,Bid-TP*Point,NULL,0,0,CLR_NONE);
Razón de la queja: