[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 405

 
Некоторые ДЦ на реальных счетах именам символов присваивают всякие префиксы типа "." или "FXF".

Как мне подставлять эти префиксы?

Essayez la chaîne StringConcatenate(...)

 
Dimka-novitsek:

Je l'ai, je vais le faire...

De plus, la condition ne fonctionne pas.

Ce n'est pas que ça ne fonctionne pas, c'est juste que ça ne fonctionne pas pour les mêmes raisons que pour X.

Ceci est clairement visible par le fait qu'il n'y a pas de signaux de i dans Alert

 
ilunga:

il ne "ne fonctionne pas", il ne l'atteint simplement pas pour la même raison que X

ceci est clairement visible par le fait qu'il n'y a pas de signaux de i dans Alert


Oui, c'est ça...
 
Hourra, je dis !!!!!!
//+------------------------------------------------------------------+
//|                                                    для лавин.mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
extern double stoploss=0; extern double takeprofit=20;extern int otstup=20; extern datetime expiration=0;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
 int tiket,tikett;double volume=0.1;int i=0,R1=0,R2=0,A=1 ;double price=PRICE_OPEN;
   //  R1=((PRICE_OPEN- stoploss*Point)*stoploss)/stoploss;R2=((PRICE_OPEN+ stoploss*Point)*stoploss)/stoploss;
     
     
int start()
  {       int X,Y; double price=(Ask+Bid)/2;            
//----
       Alert ("OrdersTotal()",OrdersTotal());


 for(int i=OrdersTotal();i>0;i--){Alert ("i", i);if(OrderSymbol()==Symbol()&&OrderMagicNumber( )==1000){
OrderSelect(i,SELECT_BY_POS );if(OrderType( )==OP_BUYSTOP){X++;}}}Alert ("X", X);
if (X==0){


   tiket= OrderSend( Symbol(), OP_BUYSTOP,  volume*A, price +otstup*Point, Point* 3, R1, price+takeprofit*Point+otstup*Point, "OP_BUYSTOP", 1000,  expiration, Red); 
   Alert ("OP_BUYSTOP", GetLastError( )); }
   

 for ( i=OrdersTotal();i>0;i--){Alert ("i", i); OrderSelect(i,SELECT_BY_POS );if( OrderMagicNumber( )==2000 &&OrderSymbol()==Symbol()) { 
if(OrderType( ) ==OP_SELLSTOP) { Y++;}}}Alert ("Y", Y);
 if (Y==0){ 
   tikett= OrderSend( Symbol(), OP_SELLSTOP,  volume*A, price -otstup*Point, Point* 3,R2, price-takeprofit*Point-otstup*Point, "OP_SELLSTOP" , 2000,  expiration,C'0,128,255' );
    Alert ("OP_SELLSTOP", GetLastError( )); 
    }       
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
ilunga:

L'option "on the fly" a fonctionné :

Oui, c'est comme ça que ça marche. Merci !
 
Ouf ! !! Hourra ! !! On l'a fait ! !! Très bien ! !!
 

Bon après-midi. C'est un problème, le conseiller expert que j'ai écrit se bloque après un certain temps ? Quand je le désinstalle, il dit "arrêt par dépassement de délai". Quelle en est la raison ?

//+------------------------------------------------------------------+
//|                                                      RSITest.mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  int deal, cnt;
  double TotalProfit;
//----
   // Проверяем, сободен ли торговый поток
if (!IsTradeAllowed())
{
return(0);
}


if (OrdersTotal() == 0)
   {
      while(true)
      {
         //*********************************** Открываем Buy ордер  ***********************************
         if (iRSI(NULL,0,14,PRICE_CLOSE,0) > iRSI(NULL,0,14,PRICE_CLOSE,1))
         { 
            if (iRSI(NULL,0,14,PRICE_CLOSE,0) > 60 && iRSI(NULL,0,14,PRICE_CLOSE,1) < 60)
            {
               deal = OrderSend(Symbol(),OP_BUY,0.1,Ask,0,iLow(NULL,0,0)-20*Point,0,"Long EUR/USD",0,0,CLR_NONE);
               if (deal > 0) Print("Long");
               else Print(GetLastError());
               return(0);
            }
         }
         //*********************************** Открываем Sell ордер  **********************************
         if (iRSI(NULL,0,14,PRICE_CLOSE,0) < iRSI(NULL,0,14,PRICE_CLOSE,1))
         { 
            if (iRSI(NULL,0,14,PRICE_CLOSE,0) < 40 && iRSI(NULL,0,14,PRICE_CLOSE,1) > 40)
            {
               deal = OrderSend(Symbol(),OP_SELL,0.1,Bid,0,iHigh(NULL,0,0)+20*Point,0,"Short EUR/USD",0,0,CLR_NONE);
               if (deal > 0) Print("Short");
               else Print(GetLastError());
               return(0);
            }
         }
      }
   }      
//else
//if
   //{
   for (cnt=0;cnt<OrdersTotal();cnt++)
      {
      if (OrderSelect(cnt, SELECT_BY_POS)==true)
      {
         TotalProfit += OrderProfit();
         if (TotalProfit>=2 || iRSI(NULL,0,14,PRICE_CLOSE,0)<iRSI(NULL,0,14,PRICE_CLOSE,1))
         {
            if (OrderType()== OP_BUY)
            {         
               // Закрываем и отдыхаем 15 минут
               OrderClose(OrderTicket(),OrderLots(),Bid,0,CLR_NONE);
           //    Sleep(900000);
               return(0);
            }
         }
         if (TotalProfit>=2 || iRSI(NULL,0,14,PRICE_CLOSE,0)>iRSI(NULL,0,14,PRICE_CLOSE,1)) 
         {  
            if (OrderType()== OP_SELL)
            {     
               // Закрываем и отдыхаем 15 минут    
               OrderClose(OrderTicket(),OrderLots(),Ask,0,CLR_NONE);
           //    Sleep(900000);
               return(0);
            }
         }
      }
      }   
    //}


//----
   return(0);
  }
//+------------------------------------------------------------------+
 
Supprimez la boucle while, elle est superflue.
 
Merci beaucoup. Une autre question, j'ai un délai de 15 minutes, disons qu'un ordre a été fermé à 18-38-55 comment puis-je faire pour que mon EA ne fonctionne pas jusqu'à 18-45-00, c'est-à-dire jusqu'à la prochaine barre ?
 
Consultez le site https://www.mql5.com/ru/forum/133552 et voyez comment la variable Timebar est mise en œuvre dans votre cas (avec quelques modifications).
Raison: