[ARCHIVIO] Qualsiasi domanda da principiante, per non ingombrare il forum. Professionisti, non passate oltre. Da nessuna parte senza di te - 3. - pagina 51

 
valenok2003:

in realtà è così

la stampa dà _dif = 0,01, ma_Lot = 0;

Probabilmente impostato su

int _Lot; //allora taglierà tutto ciò che è inferiore a uno

e dovrebbe essere impostato su:

doppio _Lot;


 
forexnew:

Probabilmente impostato su

int _Lot; //allora taglierà tutto ciò che è inferiore a zero

e dovrebbe essere impostato su:

doppio _Lot;



doppio _Lot;
doppio _Lot_BUY = 0;
doppio _Lot_SELL = 0;
doppio _Lot_BUYSTOP = 0;
doppio _Lot_SELLSTOP = 0;
 

ecco un'altra costruzione

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

non funziona così, ma nell'esempio seguente sì

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

Nel registro appare il seguente messaggio

0.01000000 impostazione2 _Lot = 0.00000000_Lot_BUY = 0.03000000_Lot_BUYSTOP = 0.00000000_Lot_SELL = 0.00000000_Lot_SELLSTOP = 0.02000000
17:07:12 Expert_V3 GBPUSD,M1: importo lotti non valido per la funzione OrderSend

Tuttavia, mentre mancavano 3 SELLSTOP, ha impostato i primi due senza problemi, ma è inciampato sul terzo.

Cioè, perché non imposta il lotto a 0,01, anche se calcola correttamente la variabile _dif...

 
Roger:


È questa la tua idea?

Aprirà solo gli ordini del secondo. Nemmeno dal secondo, ma dal terzo.

Grazie
 
Potete per favore consigliarmi se è possibile determinare l'ora di inizio della sessione di trading (per esempio, per Mosca è 10-35, ecc.) o semplicemente creare una variabile e scriverci un valore? Questo è necessario per non piazzare ordini all'inizio della sessione, ma per determinare la direzione.
 
first_may:
Potete per favore consigliarmi se è possibile determinare l'ora di inizio della sessione di trading (per esempio, per Mosca è 10-35, ecc.) o semplicemente creare una variabile e scriverci un valore? Questo è necessario per non piazzare ordini all'inizio della sessione, ma per determinare la direzione.
Programma delle sessioni di trading sul Forex
 

Quindi si suggerisce di usare solo una variabile che memorizza l'inizio della sessione. Grazie.
 
Inoltre, il miglior indicatore di sessione che ho incontrato.
P.S.
L'ho trovato nel database. https://www.mql5.com/ru/code/9313
File:
 
C'è una funzione di esempio per lavorare con le date, cioè per determinare la differenza tra due date, è maggiore di zero o no?
Motivazione: