[Archive] Toute question de débutant, afin de ne pas encombrer le forum. Professionnels, ne passez pas à côté. Je ne peux aller nulle part sans toi - 2. - page 229

 
Sh.ProTrader:

Bonjour à tous !

Pouvez-vous m'aider à répondre à cette question ?

J'essaie d'obtenir la valeur exacte de l'ouverture(Open[i]) ou de la fermeture(Close[i]) de la paire de devises EURUSD avec une valeur à cinq chiffres après zéro, mais en réponse, j'obtiens toujours une valeur arrondie !


utiliser la fonction DoubleToStr(value, Digits) lors de l'affichage de la valeur ;
 

Bonjour.

J'ai une question en tant que débutant :

comment obtenir des données dans MQL4 sur le "Profit" actuel par positions ouvertes et total ; comment obtenir des données sur le solde actuel.

 

La documentation comporte un élément d'information sur le compte. S'il n'y a pas de fonction pour les informations sur les commandes, vous devez passer en revue toutes les commandes et obtenir les bonnes informations pour les bonnes.

 

Pouvez-vous me dire comment déterminer si une bougie a clôturé en dessous ou au-dessus d'un certain niveau de Fibonacci ?

Close[i] est clair, mais comment savoir où se trouve le niveau par rapport au prix ?

 
alsu:
utiliser DoubleToStr(value, Digits) lors de l'affichage de la valeur ;

Merci beaucoup !

J'ai déjà trouvé la solution, j'ai cherché sur tout le forum, sur ce sujet, mais personne n'a répondu clairement, c'est en fait assez simple.

Il s'avère que la valeur est arrondie à 4 chiffres uniquement lorsqu'on essaie de l'imprimer en utilisant Alert(), Comment() ou Print() sans DoubleToStr(value, Digits).

Et pour calculer le programme utilise les valeurs sans arrondir au 4ème signe, si vous voulez arrondir doit utiliser la fonction

NormaliserDouble( valeur, Dijist).

Vous devriez donc simplement lire l'aide plus attentivement et tout ira bien ;)

 
fury2006:

Pouvez-vous me dire comment déterminer si une bougie a clôturé en dessous ou au-dessus d'un certain niveau de Fan de Fibonacci ?

Close[i] est clair mais comment savoir où se trouve le niveau par rapport au prix ?


Le prix du niveau doit être demandé par voie programmatique. Pour ce faire, vous devez avoir préalablement placé et configuré (tout cela de manière programmatique) l'objet "Fibo" sur le graphique. Ce n'est pas aussi facile qu'il n'y paraît à première vue. Cependant, les Dieux ne brûlent pas la marmite. J'ai dû une fois jouer avec les niveaux Fibo. Et maintenant je travaille avec le traitement de ces niveaux. En général, si vous voulez, vous pouvez vous débrouiller.

Voici un exemple de code pour créer un Fibo sur un graphique.

if(Ind1>Ind2 && Ind2!=0){//индикатор прорисовался вверх, рисуем фибо вверх
      IndUp=true;IndDown=false;
      fff=ObjectFind("FiboLewels");
      if(fff==-1){
        if(!ObjectCreate("FiboLewels",OBJ_FIBO,0,Time[Maximum(Ind1)],Ind1,Time[Minimum(Ind2)],Ind2)){
          GeneralError();
        }
        if(!ObjectSet("FiboLewels",OBJPROP_COLOR,Red)||!ObjectSet("FiboLewels",OBJPROP_LEVELCOLOR,Blue)){
          GeneralError();
        }
        // ------ Устанавливаем количество уровней фибо ----------
                                if(!ObjectSet("FiboLewels",OBJPROP_FIBOLEVELS,22)){
                                        GeneralError();
                                }
                                // ------- Устанавливаем свойства фибоуровней ------------
                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+0,0)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 0,"0.0     %$")){GeneralError();}
   
                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+1,0.118)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 1,"11.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+2,0.236)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 2,"23.6     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+3,0.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 3,"38.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+4,0.5)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 4,"50.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+5,0.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 5,"61.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+6,0.764)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 6,"76.4     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+7,0.882)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 7,"88.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+8,1)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 8,"100.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+9,1.118)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 9,"111.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+10,1.236)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 10,"123.6     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+11,1.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 11,"138.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+12,1.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 12,"161.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+13,2)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 13,"200.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+14,2.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 14,"238.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+15,2.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 15,"261.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+16,3)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 16,"300.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+17,3.382)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 17,"338.2     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+18,3.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 18,"361.8     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+19,4)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 19,"400.0     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+20,4.236)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 20,"423.6     %$")){GeneralError();}

                                if(!ObjectSet("FiboLewels",OBJPROP_FIRSTLEVEL+21,4.618)){GeneralError();}
                                if(!ObjectSetFiboDescription("FiboLewels", 21,"461.8     %$")){GeneralError();}
      } 
    }

J'ai dû faire une sous-routine pour demander le prix du niveau. Le voici (vous pouvez le comprendre si vous le souhaitez)

// ------------- PriceSignLevelUp() -----------------------------------------------
// функция возвращает цену сигнального уровня при прорисовке индикатора вверх
//---------------------------------------------------------------------------------
double PriceSignLevelUp(double Level,double Ind1,double Ind2){
  double Fibo0=0,Fibo100=0,Rst=0;
  Fibo0=Ind2;
  Fibo100=Ind1;
  Rst=Ind1-Ind2;
  switch(Level){
    case 0:          Level=NormalizeDouble(Fibo0,digits); break;
    case 11.8:       Level=NormalizeDouble(Fibo0+Rst*0.118,digits); break;
    case 23.6:       Level=NormalizeDouble(Fibo0+Rst*0.236,digits); break;
    case 38.2:       Level=NormalizeDouble(Fibo0+Rst*0.382,digits); break;
    case 50:         Level=NormalizeDouble(Fibo0+Rst*0.5,digits); break;
    case 61.8:       Level=NormalizeDouble(Fibo0+Rst*0.618,digits); break;
    case 76.4:       Level=NormalizeDouble(Fibo0+Rst*0.764,digits); break;
    case 88.2:       Level=NormalizeDouble(Fibo0+Rst*0.882,digits); break;
    case 100:        Level=NormalizeDouble(Fibo100,digits); break;
    case 111.8:      Level=NormalizeDouble(Fibo0+Rst*1.118,digits); break;
    case 123.6:      Level=NormalizeDouble(Fibo0+Rst*1.236,digits); break;
    case 138.2:      Level=NormalizeDouble(Fibo0+Rst*1.382,digits); break;
    case 161.8:      Level=NormalizeDouble(Fibo0+Rst*1.618,digits); break;
    case 200:        Level=NormalizeDouble(Fibo0+Rst*2,digits); break;
    case 238.2:      Level=NormalizeDouble(Fibo0+Rst*2.382,digits); break;
    case 261.8:      Level=NormalizeDouble(Fibo0+Rst*2.618,digits); break;
    case 300:        Level=NormalizeDouble(Fibo0+Rst*3,digits); break;
    case 338.2:      Level=NormalizeDouble(Fibo0+Rst*3.382,digits); break;
    case 361.8:      Level=NormalizeDouble(Fibo0+Rst*3.618,digits); break;
    case 400:        Level=NormalizeDouble(Fibo0+Rst*4,digits); break;
    case 423.6:      Level=NormalizeDouble(Fibo0+Rst*4.236,digits); break;
    case 461.8:      Level=NormalizeDouble(Fibo0+Rst*4.618,digits); break;
  }         
  return(Level);
}
 

Bonsoir ! J'ai moi-même revu hier soir le livre, nouvelles dimensions du trading, Williams, hier à 30, aujourd'hui à 50 pages.

J'ai un robot, mais il ne fonctionne pas du tout, aucune transaction dans le testeur, et Alert("buy",GetLastError()) ne dit rien.

J'aimerais recevoir des conseils avisés, s'il vous plaît.

//+------------------------------------------------------------------+
//| Aligator.mq4 |
//| Droits d'auteur © 2011, MetaQuotes Software Corp.
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp.
#lien de propriété "http://www.metaquotes.net"
extern int jaw_period=13,teeth_period=8,jaw_shift=8,tteeth_period=5,teeth_shift=5,lips_period=3,lips_shift=3 ;
extern double volume=0.1,stoploss=20,takeprofit=50 ;
//+------------------------------------------------------------------+
//| fonction d'initialisation de l'expert |
//+------------------------------------------------------------------+
int init()
{
//----

//----
retour(0) ;
}
//+------------------------------------------------------------------+
//| fonction de désinitialisation des experts |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
retour(0) ;
}
//+------------------------------------------------------------------+
//| fonction de démarrage de l'expert |
//+------------------------------------------------------------------+
int tiket ;
int start()
{double blu,red,grin ;
//----
blu= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORJAW, 0) ;
red= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATOREETH, 0) ;
grin= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORLIPS, 0) ;
//----


double Fractalu,Fractall;Fractalu=iFractals( 0, 0, MODE_UPPER, 0) ;Fractall=iFractals( 0, 0,MODE_LOWER, 0) ;


si (Fractalu>0&&Fractalu>blu&&Fractalu>rouge&&Fractalu>grin)
{ tiket= OrderSend( 0, OP_BUY, volume, Bid, Point*3, Bid- stoploss*Point, Bid+ takeprofit*Point, "Pose66", 1234567890, 0, Red);Alert("buy",GetLastError());}

si (Fractall>0&&Fractalu<blu&&Fractalu<rouge&&Fractalu<grin)


{ tiket= OrderSend( 0, OP_SELL, volume, Ask, Point*3, Ask+ stoploss*Point, Ask- takeprofit*Point, "Pose66", 1234567890, 0, Blue);Alert("sell",GetLastError());}




retour(0) ;
}
//+------------------------------------------------------------------+

 
Dimka-novitsek:

Bonsoir ! J'ai moi-même revu hier soir le livre, nouvelles dimensions du trading, Williams, hier à 30, aujourd'hui à 50 pages.

J'ai un robot, mais il ne fonctionne pas du tout, aucune transaction dans le testeur, et Alert("buy",GetLastError()) ne dit rien.

J'aimerais avoir des conseils avisés, s'il vous plaît.

//+------------------------------------------------------------------+
//| Aligatorny.mq4 |
//| Droits d'auteur © 2011, MetaQuotes Software Corp.
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#lien de propriété "http://www.metaquotes.net"
extern int jaw_period=13,teeth_period=8,jaw_shift=8,tteeth_period=5,teeth_shift=5,lips_period=3,lips_shift=3 ;
extern double volume=0.1,stoploss=20,takeprofit=50 ;
//+------------------------------------------------------------------+
//| fonction d'initialisation de l'expert |
//+------------------------------------------------------------------+
int init()
{
//----

//----
retour(0) ;
}
//+------------------------------------------------------------------+
//| fonction de désinitialisation des experts |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
retour(0) ;
}
//+------------------------------------------------------------------+
//| fonction de démarrage de l'expert |
//+------------------------------------------------------------------+
int tiket ;
int start()
{double blu,red,grin ;
//----
blu= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORJAW, 0) ;
red= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATOREETH, 0) ;
grin= iAlligator( 0, 0, jaw_period, jaw_shift, tteeth_period, teeth_shift, lips_period, lips_shift, MODE_SMA,PRICE_CLOSE,MODE_GATORLIPS, 0) ;
//----


double Fractalu,Fractall;Fractalu=iFractals( 0, 0, MODE_UPPER, 0) ;Fractall=iFractals( 0, 0,MODE_LOWER, 0) ;


si (Fractalu>0&&Fractalu>blu&&Fractalu>rouge&&Fractalu>grin)
{ tiket= OrderSend( 0, OP_BUY, volume, Bid, Point*3, Bid- stoploss*Point, Bid+ takeprofit*Point, "Pose66", 1234567890, 0, Red);Alert("buy",GetLastError());}

si (Fractall>0&&Fractalu<blu&&Fractalu<rouge&&Fractalu<grin)


{ tiket= OrderSend( 0, OP_SELL, volume, Ask, Point*3, Ask+ stoploss*Point, Ask- takeprofit*Point, "Pose66", 1234567890, 0, Blue);Alert("sell",GetLastError());}




retour(0) ;
}
//+------------------------------------------------------------------+


"Tout a déjà été volé avant vous", ainsi que "Vos chevaux galopent tranquillement"... :-)))

Voir ici.

 

Merci ! !!

Mais je voulais aussi apprendre à coder, donc je voulais comprendre ce qui ne va pas.

 

Quelle pourrait être la cause de l'erreur (prix erroné) ?