Qui peut aider avec le robot, pourquoi ne fonctionne-t-il pas ? - page 2

 
Alexey Volchanskiy:

Les règles linguistiques ne permettent pas d'avaler des paramètres avec des valeurs par défaut. Si vous devez définir la couleur des flèches, écrivez tous les paramètres à gauche de la couleur. B slippage 3 n'est pas suffisant, si c'est 5 chiffres, il y aura des requotes, j'ai écrit 50. Et SL et TP ne doivent pas être égaux à zéro,Aleksey Vakhrushev a déjà écrit à ce sujet.


C'est une erreur :

La valeur de retour de 'OrderSend' doit être vérifiée.
 
GIM:

Erreur :

La valeur de retour de 'OrderSend' doit être vérifiée.
C'est juste un avertissement. Le fichier sera compilé.
 

Bonjour, aidez-nous s'il vous plaît. EA n'ouvre que pour la vente.


extern double Lots=0.1 ;
extern int FastMAPeriod=14 ;
extern int FastMAMethod=0 ; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
external int FastMAPrice=0 ; // 0-Close, 1-Open, 2-High, 3-Low, 4-Median, 5-Typical, 6-Weighted
extern int SlowMAPeriod=42 ;
extern intn SlowMAMethod=0 ; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
extern int SlowMAPrice=0 ; // 0-Close, 1-Open, 2-High, 3-Low, 4-Median, 5-Typical, 6-Weighted
extern int TP=0 ; //takeprofit
extern int SL=0 ; //arrêt de la perte

int BuyTicket, SellTicket ;



int start(){

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){ //True si SellTicket n'est pas 0 ;

SellTicket=0 ;
}
if(BuyTicket==0){ //// Vrai si BuyTicket est 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){ //vrai si BuyTicket n'est pas 0 ;
BuyTicket=0 ;
}
if(SellTicket==0){ //True if(SellTicket égale 0
SellTicket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid-SL*Point,Bid+TP*Point,NULL,0,0,CLR_NONE) ;
}
}

retour(0) ;
}

 
Alexey Kozitsyn:
C'est juste un avertissement. Le fichier sera compilé.
Eh bien, ça n'ouvre toujours pas l'accord......
 
GIM:
Toujours pas d'ouverture de l'accord.....
Eh bien, je suppose que ce n'est pas le cas... Bien que cela puisse valoir la peine de jeter un coup d'oeil dans le journal de bord pour voir ce qu'il dit... Eh bien, c'est juste une option.
 
Alexey Kozitsyn:
Eh bien, je suppose que ce n'était pas censé être... Bien que cela puisse valoir la peine de jeter un coup d'oeil dans le magazine pour voir ce qu'il dit... Eh bien, c'est une option.
Merci ! (Rires) Je vais continuer à essayer))
 
AdikAmir:

Bonjour, aidez-nous s'il vous plaît. EA n'ouvre que pour la vente.


extern double Lots=0.1 ;
extern int FastMAPeriod=14 ;
extern int FastMAMethod=0 ; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
external int FastMAPrice=0 ; // 0-Close, 1-Open, 2-High, 3-Low, 4-Median, 5-Typical, 6-Weighted
extern int SlowMAPeriod=42 ;
extern intn SlowMAMethod=0 ; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
extern int SlowMAPrice=0 ; // 0-Close, 1-Open, 2-High, 3-Low, 4-Median, 5-Typical, 6-Weighted
extern int TP=0 ; //takeprofit
extern int SL=0 ; //arrêt de la perte

int BuyTicket, SellTicket ;



int start(){

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){ //True si SellTicket n'est pas 0 ;

SellTicket=0 ;
}
if(BuyTicket==0){ //// Vrai si BuyTicket est 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){ //vrai si BuyTicket n'est pas 0 ;
BuyTicket=0 ;
}
if(SellTicket==0){ //True if(SellTicket égale 0
SellTicket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid-SL*Point,Bid+TP*Point,NULL,0,0,CLR_NONE) ;
}
}

retour(0) ;
}

C'est un code étrange que je n'ai jamais vu auparavant.

Les variables BuyTicket et SellTicket seront égales à zéro ou incompréhensibles à chaque fois qu'un nouveau tick arrive car elles ne sont pas initialisées.

La construction if(fast_ma1>slow_ma1 && !(fast_ma2>slow_ma2)) n'est pas claire du tout lorsqu'elle est traduite en langage humain, cette condition ressemble à ceci

si fast_ma1 est supérieur à slow_ma1 ET si NOT fast_ma2 est supérieur à slow_ma2. L'opérateur ! signifie la négation de cette façon : if(fast_ma1>slow_ma1 && (fast_ma2<slow_ma2))

La condition est vérifiée lorsque fast_ma1>slow_ma1 = true (true) et fast_ma2>slow_ma2 = false (false).

....
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:

C'est un code étrange que je n'ai jamais vu auparavant.

Les variables BuyTicket et SellTicket seront égales à zéro ou incompréhensibles à chaque fois qu'un nouveau tick arrive car elles ne sont pas initialisées.

La construction if(fast_ma1>slow_ma1 && !(fast_ma2>slow_ma2)) n'est pas claire du tout lorsqu'elle est traduite en langage humain ; cette condition ressemble à ceci

si fast_ma1 est supérieur à slow_ma1 ET si NOT fast_ma2 est supérieur à slow_ma2. L'opérateur ! signifie la négation de cette façon : if(fast_ma1>slow_ma1 && (fast_ma2<slow_ma2))

Votre condition est valable lorsque fast_ma1>slow_ma1 = true (vrai) et fast_ma2>slow_ma2 = false (faux).

Je mets votre code de toute façon la position Sell n'est pas ouverte, c'est BUY seulement.
 
AdikAmir:
J'ai mis votre code qui n'ouvre toujours pas de position de vente, juste d'achat.

extern double Lots=0.1 ;
extern intnal double FastMAPeriod=5 ;
extern int FastMAMethod=0 ; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
external int FastMAPrice=0 ; // 0-Close, 1-Open, 2-High, 3-Low, 4-Median, 5-Typical, 6-Weighted
extern int SlowMAPeriod=75 ;
extern intn SlowMAMethod=3 ; // 0-SMA, 1-EMA, 2-SMMA, 4-LWMA
extern int SlowMAPrice=3 ; // 0-Close, 1-Open, 2-High, 3-Low, 4-Median, 5-Typical, 6-Weighted
Externe int TP=500 ; //Prise en charge
extern int SL=250 ; //arrêt de la perte
double ticet ;

int start(){

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) ;

si (OrdersTotal()==0)
{
si (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) ;
si (ticet==0) Print("ERROR") ;
}
si (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) ;
si (ticet==0) Print("ERROR") ;
}

}

retour(0) ;
}




 
Nous devons changer de signe pour calculer SL /TP.
ticet = OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+SL*Point,Bid-TP*Point,NULL,0,0,CLR_NONE) ;
Raison: