[ARCHIVO] Cualquier pregunta de novato, para no saturar el foro. Profesionales, no pasen de largo. En ninguna parte sin ti - 3. - página 51

 
valenok2003:

en realidad es así

print da _dif = 0.01, pero_Lot = 0;

Probablemente, se ha ajustado a

int _Lot; //entonces cortará todo lo que sea inferior a uno

y debe ser ajustado:

doble _Lote;


 
forexnew:

Probablemente, se ha ajustado a

int _Lot; //entonces cortará todo lo que sea inferior a cero

y debe ser ajustado:

doble _Lote;



doble _Lote;
double _Lot_BUY = 0;
double _Lot_SELL = 0;
double _Lot_BUYSTOP = 0;
double _Lot_SELLSTOP = 0;
 

aquí hay otra construcción

   if(_Lot_BUY > _Lot_SELL+_Lot_SELLSTOP) {
       _dif = _Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP);
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >= 0.01) _Lot = 0.01;
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=  0.1) _Lot =  0.1; 
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=    1) _Lot =    1;   
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=   10) _Lot =   10; 

Print(_dif +" установка2 _Lot = "+_Lot+ "_Lot_BUY = "+_Lot_BUY+ "_Lot_BUYSTOP = "+_Lot_BUYSTOP+ "_Lot_SELL = "+_Lot_SELL+ "_Lot_SELLSTOP = "+_Lot_SELLSTOP);

      _Price = NormalizeDouble((Low [iLowest (Symbol(),TF_Cnt_Bar_for_Lock,MODE_LOW, _Bars_PP_OP_SELLSTOP,0)]- Dist_For_Boot*Point),Digits);
      if(Bid - _Price < Dist_For_Boot*Point) {
         _Bars_PP_OP_SELLSTOP *=2;
         _RESET_Bars_PP_OP_SELLSTOP = false;
      }
      if(set_order_sellstop(_Price, _Lot, _Txt_Lock+Comment_Order)!= -1) _RESET_Bars_PP_OP_SELLSTOP = true;
   }

no funciona así, pero en el siguiente ejemplo sí lo hace

   if(_Lot_BUY > _Lot_SELL+_Lot_SELLSTOP) {
       _dif = _Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP);
      //if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >= 0.01) 
      _Lot = 0.01;
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=  0.1) _Lot =  0.1; 
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=    1) _Lot =    1;   
      if(_Lot_BUY - (_Lot_SELL + _Lot_SELLSTOP) >=   10) _Lot =   10; 

Print(_dif +" установка2 _Lot = "+_Lot+ "_Lot_BUY = "+_Lot_BUY+ "_Lot_BUYSTOP = "+_Lot_BUYSTOP+ "_Lot_SELL = "+_Lot_SELL+ "_Lot_SELLSTOP = "+_Lot_SELLSTOP);

      _Price = NormalizeDouble((Low [iLowest (Symbol(),TF_Cnt_Bar_for_Lock,MODE_LOW, _Bars_PP_OP_SELLSTOP,0)]- Dist_For_Boot*Point),Digits);
      if(Bid - _Price < Dist_For_Boot*Point) {
         _Bars_PP_OP_SELLSTOP *=2;
         _RESET_Bars_PP_OP_SELLSTOP = false;
      }
      if(set_order_sellstop(_Price, _Lot, _Txt_Lock+Comment_Order)!= -1) _RESET_Bars_PP_OP_SELLSTOP = true;
   }
 

En el registro aparece el siguiente mensaje

0,01000000 ajuste2 _Lote = 0,00000000_Lote_BUY = 0,03000000_Lote_BUYSTOP = 0,00000000_Lote_SELL = 0,00000000_Lote_SELLSTOP = 0,02000000
17:07:12 Expert_V3 GBPUSD,M1: cantidad de lotes no válida para la función OrderSend

Sin embargo, mientras faltaban 3 SELLSTOP, fijó los dos primeros sin problemas, pero tropezó con el tercero.

Es decir, por qué no pone el lote a 0,01, aunque calcula la variable _dif correctamente...

 
Roger:


¿Es esa tu idea?

Sólo abrirá órdenes a partir del segundo. Ni siquiera del segundo, sino del tercero.

Gracias
 
¿Puede indicar si es posible determinar la hora de inicio de la sesión de negociación (por ejemplo, para Moscú es 10-35, etc.) o simplemente crear una variable y escribir un valor en ella? Esto es necesario para no colocar órdenes al principio de la sesión, sino para determinar la dirección.
 
first_may:
¿Puede indicar si es posible determinar la hora de inicio de la sesión de negociación (por ejemplo, para Moscú es 10-35, etc.) o simplemente crear una variable y escribir un valor en ella? Esto es necesario para no colocar órdenes al principio de la sesión, sino para determinar la dirección.
Horario de las sesiones de negociación en Forex
 

Por lo tanto, se sugiere utilizar simplemente una variable que almacene el inicio de la sesión. Gracias.
 
Además, el mejor indicador de sesión que he encontrado.
P.D.
Lo encontré en la base de datos. https://www.mql5.com/ru/code/9313
Archivos adjuntos:
 
¿Hay alguna función de ejemplo para trabajar con fechas, es decir, para determinar la diferencia entre dos fechas, si es mayor que cero o no?
Razón de la queja: