[ARCHIV] Alle Fragen von Anfängern, um das Forum nicht zu überladen. Fachleute, gehen Sie nicht vorbei. Nirgendwo ohne dich - 3. - Seite 51

 
valenok2003:

Eigentlich ist es so

print ergibt _dif = 0,01, aber_Lot = 0;

Wahrscheinlich eingestellt auf

int _Lot; //dann wird alles, was kleiner als eine
ist
, abgeschnitten.

und sollte auf gesetzt werden:

doppelt _Lot;


 
forexnew:

Wahrscheinlich eingestellt auf

int _Lot; //dann wird alles, was kleiner als Null ist, abgeschnitten

und sollte auf gesetzt werden:

doppelt _Lot;



doppelt _Lot;
double _Lot_BUY = 0;
double _Lot_SELL = 0;
double _Lot_BUYSTOP = 0;
double _Lot_SELLSTOP = 0;
 

hier eine weitere Konstruktion

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

funktioniert nicht auf diese Weise, aber im folgenden Beispiel funktioniert es

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

Im Protokoll erscheint die folgende Meldung

0,01000000 Einstellung2 _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: Ungültige Losgröße für OrderSend-Funktion

Es fehlten jedoch 3 SELLSTOPs, wobei die ersten beiden ohne Probleme gesetzt wurden, der dritte jedoch nicht mehr.

D.h., warum es Lot nicht auf 0,01 setzt, obwohl es die _dif-Variable korrekt berechnet...

 
Roger:


Ist das Ihre Idee?

Es werden nur Aufträge ab dem zweiten geöffnet. Nicht einmal von der zweiten, sondern von der dritten.

Dankeschön
 
Können Sie bitte mitteilen, ob es möglich ist, die Uhrzeit des Beginns der Handelssitzung zu bestimmen (z. B. für Moskau ist es 10-35 Uhr usw.) oder einfach eine Variable zu erstellen und einen Wert hineinzuschreiben? Dies ist notwendig, um nicht zu Beginn der Sitzung Aufträge zu erteilen, sondern um die Richtung zu bestimmen.
 
first_may:
Können Sie bitte mitteilen, ob es möglich ist, die Uhrzeit des Beginns der Handelssitzung zu bestimmen (z. B. für Moskau ist es 10-35 Uhr usw.) oder einfach eine Variable zu erstellen und einen Wert hineinzuschreiben? Dies ist notwendig, um nicht zu Beginn der Sitzung Aufträge zu erteilen, sondern um die Richtung zu bestimmen.
Zeitplan der Forex-Handelssitzungen
 

Es wird daher vorgeschlagen, eine Variable zu verwenden, die den Beginn der Sitzung speichert. Ich danke Ihnen.
 
Außerdem ist es der beste Sitzungsanzeiger, den ich kenne.
P.S.
Ich habe es in der Datenbank gefunden. https://www.mql5.com/ru/code/9313
Dateien:
 
Gibt es eine Beispielfunktion für die Arbeit mit Datumsangaben, z.B. um die Differenz zwischen zwei Datumsangaben zu bestimmen, ist sie größer als Null oder nicht?