[¡Archivo!] Cualquier pregunta de novato, para no saturar el foro. Profesionales, no lo dejéis pasar. No podría ir a ningún sitio sin ti - 2. - página 405

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

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

Prueba StringConcatenate(...)

 
Dimka-novitsek:

Lo tengo, lo haré...

Además, la condición no funciona.

No "no funciona", simplemente no llega por la misma razón que para X

Esto puede verse claramente por el hecho de que no hay señales de i en Alert

 
ilunga:

no "no funciona", simplemente no llega a ella por la misma razón que X

esto se puede ver claramente por el hecho de que no hay señales de i en Alert


Sí, eso es...
 
¡¡¡¡¡¡Hurra, digo!!!!!!
//+------------------------------------------------------------------+
//|                                                    для лавин.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:

Bueno, la opción "sobre la marcha" funcionó:

Sí, así es como funciona. Gracias.
 
¡¡¡Uf!!! ¡Hurra! ¡¡¡Lo hicimos!!! ¡¡Muy bien!!
 

Buenas tardes. Esto es un problema, el Asesor Experto que escribí se cuelga después de una cierta cantidad de tiempo? Cuando lo desinstalo, dice que se apaga por tiempo de espera. ¿Cuál es la razón de esto?

//+------------------------------------------------------------------+
//|                                                      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);
  }
//+------------------------------------------------------------------+
 
Elimina el bucle while, es superfluo.
 
Muchas gracias. Otra pregunta, tengo un marco de tiempo de 15 minutos, digamos que una orden se cerró a las 18-38-55 ¿cómo debo hacer que mi EA no funcione hasta las 18-45-00, es decir, hasta la siguiente barra?
 
Mira en https://www.mql5.com/ru/forum/133552 y ve cómo se implementa la variable Timebar en tu caso (con algunas modificaciones).
Razón de la queja: