English Русский 中文 Español 日本語 Português
preview
PrintFormat() studieren und vorgefertigte Beispiele anwenden

PrintFormat() studieren und vorgefertigte Beispiele anwenden

MetaTrader 5Beispiele | 23 November 2023, 10:02
310 0
Artyom Trishkin
Artyom Trishkin

Die Anzeige von Werten im Protokoll oder auf dem Bildschirm ist ein einfacher und vertrauter Vorgang, bis Sie etwas Komplexeres als „Hallo, Welt“ anzeigen müssen. Früher oder später tritt jedoch eine Situation ein, in der Sie eine formatierte Ausgabe eines Wertes oder einer Eigenschaft benötigen, die nicht sehr häufig nachgefragt wird. Natürlich können Sie auch in der MQL5-Hilfe nachsehen.

Aber manchmal möchte man eine fertige Sammlung von Rezepten für die Anzeige aller Arten von Informationen haben, die das MetaTrader 5-Terminal bietet. In diesem Artikel werden wir versuchen, die Feinheiten des Aufrufs der Funktion PrintFormat zu verstehen und fertige Vorlagen zu schreiben, die Sie einfach in Ihren Code einfügen können.


Inhalt


Einführung

Jede Anwendung, die auf dem Terminal läuft, sollte in der Lage sein, die Nutzer über ihren Zustand und den Zustand ihrer Umgebung zu informieren. Solche Daten werden immer im Programmprotokoll ausgedruckt, das Sie auf der Registerkarte Experts des Handelsterminals finden. Beim Parsen und Analysieren von Programmprotokollen ist es wichtig, dass alle Einträge in einer leicht lesbaren Form vorliegen, denn davon hängt die Leichtigkeit des Lesens und der Suche nach Informationen ab.

Die Sprache MQL5 verfügt über die Funktion Print(), die Zeilen oder in eine Zeile umgewandelte Daten in das Protokoll druckt. Dies ist für kurze Aufzeichnungen völlig ausreichend. Wenn wir jedoch große Datenmengen an das Protokoll senden, ist es wünschenswert, dass sie in einer leicht verständlichen Form formatiert werden.

Wenn der Datenkopf (Beschreibung) und der zugehörige Wert ohne Formatierung in eine Zeile geschrieben werden, bereitet das Lesen solcher Daten in einer kurzen Liste keine Schwierigkeiten. Wenn es jedoch viele Daten gibt, die alle aufeinander folgen und unterschiedlich lange Beschreibungen und Bedeutungen haben, dann wird das Ganze zu einem langen Strom von Informationen. Es ist ratsam, solche Daten zu formatieren und in eine einzige tabellarische Form zu bringen, bei der alle Überschriften die gleiche Breite haben (Kopfspalte) und die den Überschriften entsprechenden Daten im gleichen Abstand von der Überschrift angeordnet sind (Datenspalte). Die Funktion PrintFormat() ermöglicht genau das. Es formatiert und druckt Zeichensätze und Werte in das EA-Journal gemäß dem angegebenen Format.


PrintFormat(). Wie es funktioniert.

Die Funktion PrintFormat() verfügt über einen Formatierungszeichenkette, die die Form beschreibt, in der die Daten angezeigt werden sollen, und eine Reihe von Daten, die der Formatierung entsprechen und die in dem resultierenden Zeichenkette so angeordnet werden sollen, wie sie im Protokoll angezeigt werden. Sie können für jeden Wert Ihr eigenes Ausgabeformat festlegen. In einfacher Form sieht das so aus:

("%Value1 is to be displayed like this%Value2 is to be displayed like this%Value3 is to be displayed like this ... ... %ValueN is to be displayed like this some text", Value1, Value2, Value3, ... ..., ValueN)

Wie Sie sehen, sollten an der Stelle, an der bestimmte Daten im Text angezeigt werden müssen, Formatzeilen stehen, die die Methode zur Anzeige der Werte der Ausgabedaten beschreiben. Jeder Formatierung ist ein % vorangestellt, das angibt, dass es sich bei dem Folgenden um eine Beschreibung des Ausgabeformats handelt. Sie können einen beliebigen Text zwischen die Formatbeschreibungen schreiben („some text“ am Ende im obigen Beispiel). Nach Abschluss der Eingabe einer Zeile mit Formatzeichen und Text werden die Daten in der Reihenfolge, in der das Ausgabeformat für sie in der Formatzeile beschrieben ist, durch Kommata getrennt. Im obigen Beispiel sind jede Formatbeschreibung und der zugehörige Wert mit der gleichen Farbe markiert.

Zunächst schreiben wir den Text, der im Protokoll angezeigt werden soll. Geben Sie dann innerhalb des Textes die Symbole des Datenausgabeformats ein, wenn sich die Daten an dieser Stelle befinden sollen.

Zum Beispiel: ("%Dieser Text wird in der 50 Zeichen breiten Spalte stehen%Diese reellen Werte werden in der nächsten Spalte stehen und links ausgerichtet sein", string_variable_mit_Text_der_ersten_Spalte, double Wert_der_zweiten_Spalte);

Natürlich brauchen Sie keinen Text, um dies alles zu beschreiben, da es spezielle Formatierungszeichen gibt. Sie sollten in einer genau festgelegten Reihenfolge stehen, aber nicht alle sollten in der Formatzeile vorhanden sein.

Die Formatierung wird von links nach rechts gelesen. Wenn die erste Formatangabe (falls vorhanden) angetroffen wird, wird der Wert des ersten Parameters nach der Formatzeichenkette entsprechend der angegebenen Spezifikation umgewandelt und angezeigt. Die zweite Formatangabe bewirkt, dass der zweite Parameter umgewandelt und angezeigt wird, und so weiter, bis zum Ende der Formatzeichenkette.

Eine Formatangabe hat die folgende Form:

         %[Flags][Breite][.Genauigkeit][{h | l | ll | I32 | I64}]Typ

Schauen wir uns an, was in der Hilfe für jedes Element in der Formatzeichenfolge geschrieben steht, und beschreiben wir es genauer.

Prozentzeichen (%) — Beginn einer neuen Formatzeichenfolge. Nach diesem Zeichen muss mindestens ein Spezifizierer angegeben werden, und es ist wichtig zu verstehen, dass der Typspezifizierer(type) das einzige erforderliche Feld für die formatierte Ausgabe ist. Das heißt, wenn das „%“-Zeichen in der Zeile steht, muss die Art der Daten, die an dieser Stelle angezeigt werden, dahinter angegeben werden. Oder ein anderes Prozentzeichen, um so das „%“-Zeichen in den Text zu schreiben. Um zu zeigen, dass es sich nicht um den Beginn einer neuen Formatzeile handelt, sondern einfach um ein in den Text eingeschriebenes Prozentzeichen, müssen wir also die Kombination „%%“ schreiben.

Die Flags (flags):

  • „-“ (Minuszeichen). Der Zeilentext wird innerhalb der angegebenen Breite linksbündig ausgerichtet. Die Breite wird durch die Angabe der Breite nach dem Flag angegeben: „%-10“ bedeutet, dass der Text am linken Rand des Feldes ausgerichtet wird, was einer Breite von 10 Zeichen entspricht. Der nächste Text in dieser Zeile wird vom rechten Rand desselben Feldes mit 10 Zeichen beginnend eingefügt. Wenn der in diesem 10-Zeichen-Feld angezeigte Text länger als 10 Zeichen ist, befindet sich der folgende Text am Ende des Textes und nicht des Feldes. Mit anderen Worten, die Breite des Feldes wird auf die Größe des darin enthaltenen Textes erweitert. Der Text wird nicht über die Breite des Feldes abgeschnitten. Im Gegenteil, das Feld dehnt sich auf die gesamte Länge des Textes aus.
    void OnStart()
      {
    //--- Declare the variables to be printed
       string   header="";  // Data header
       double   value1=0;   // First value
       double   value2=0;   // Second value
       
    //--- First line with a header of less than 10 characters and data in 20-character fields
    //--- The header and data are pressed to the left edge of their field
       header="10characters";
       value1=10000000;
       value2=20000000;
       PrintFormat("%-10s%-20ld%-20lld",header,(int)value1,(long)value2);
       
    //--- Second line with a header of more than 10 characters and data in 20-character fields
    //--- The header and data are pressed to the left edge of their field
       header="Over10characters";
       value1=10000000;
       value2=20000000;
       PrintFormat("%-10s%-20ld%-20lld",header,(int)value1,(long)value2);
    
       /* Sample output:
          10characters10000000            20000000            
          Over10characters10000000            20000000            
       */
      }
    
    


  • „+“ (Pluszeichen). Bei Typen mit Vorzeichen wird je nach Wert der Ausgabedaten immer ein + oder - Vorzeichen angezeigt. Zum Beispiel: +222 oder -12,35. Wenn zwei Zeilen formatierten Textes aufeinander folgen, während in der obersten Zeile in derselben Datenspalte der Wert der Ausgabedaten positiv und in der untersten Zeile negativ ist, dann werden die Werte optisch um ein Zeichen (um das '-'-Zeichen) gegeneinander verschoben. Im Folgenden werden wir uns mit einem Flag befassen, die diese visuelle Unannehmlichkeit beseitigt.
    void OnStart()
      {
    //--- Declare the variables to be printed
       string   header="";  // Data header
       double   value1=0;   // First value
       double   value2=0;   // Second value
       
    //--- The first line with a header in a 16-character field and data in 20-character fields
    //--- The header and data are pressed to the left edge.
    //--- Data values of the second field are displayed with +/- signs
       header="Header1";
       value1=-10000000;
       value2=20000000;
       PrintFormat("%-16s%-+20ld%-20lld",header,(int)value1,(long)value2);
       
    //--- The second line with a header in a 16-character field and data in 20-character fields
    //--- The header and data are pressed to the left edge.
    //--- Data values of the second field are displayed with +/- signs
       header="Header2";
       value1=10000000;
       value2=-20000000;
       PrintFormat("%-16s%-+20ld%-20lld",header,(int)value1,(long)value2);
       
       /* Sample output:
          Header1      -10000000           20000000            
          Header2      +10000000           -20000000           
       */
      }
    
    


  • „0“ (Null). Innerhalb der angegebenen Feldbreite werden vor dem Ausgabewert Nullen hinzugefügt. Wenn Flag 0 mit einem Ganzzahlformat (i, u, x, X, o, d) angegeben wird und eine Präzisionsangabe gesetzt ist (z. B. %04.d), wird 0 ignoriert. Mit anderen Worten: Bei Ganzzahltypen, die ein Präzisionsformat erhalten (Ausgabe von mindestens so vielen Zeichen), haben führende Nullen dieses Formats (Format 0) keine Priorität, da sie das gesamte Feld ausfüllen, was dem Präzisionsformat widerspricht.
    void OnStart()
      {
    //--- Declare the variables to be printed
       string   header="";  // Data header
       double   value1=0;   // First value
       double   value2=0;   // Second value
       
    //--- The first line with a header in a 16-character field and data in 20-character fields
    //--- The header and data are pressed to the left edge.
    //--- Data values of the second field are displayed with +/- signs
    //--- The data values of the third field are pressed to the right edge with leading zeros added.
       header="Header1";
       value1=-10000000;
       value2=20000000;
       PrintFormat("%-16s%-+20ld%020lld",header,(int)value1,(long)value2);
       
    //--- The second line with a header in a 16-character field and data in 20-character fields
    //--- The header and data of the second field are pressed to the left edge.
    //--- Data values of the second field are displayed with +/- signs
    //--- The data values of the third field are pressed to the right edge with leading zeros added.
       header="Header2";
       value1=10000000;
       value2=-20000000;
       PrintFormat("%-16s%-+20ld%020lld",header,(int)value1,(long)value2);
       
       /* Sample output:
          Header1      -10000000           00000000000020000000
          Header2      +10000000           -0000000000020000000
       */
      }
    
    


  • „ “ (Leerzeichen). Dem Ausgabewert wird ein Leerzeichen vorangestellt, wenn der Wert vorzeichenbehaftet und positiv ist. Jeder positive Datenwert eines Feldes mit diesem Kennzeichen wird um ein Zeichen nach rechts verschoben. Auf diese Weise können wir die Werte visuell angleichen, wenn sich positive und negative Werte in verschiedenen Zeilen derselben Spalte befinden. Das Leerzeichen wird anstelle von „-“ für negative Daten verwendet.
    void OnStart()
      {
    //--- Declare the variables to be printed
       string   header="";  // Data header
       double   value1=0;   // First value
       double   value2=0;   // Second value
       
    //--- The first line with a header in a 16-character field and data in 20-character fields
    //--- The header and data of the second field are pressed to the left edge.
    //--- Data values of the third field are pressed to the right edge
    //--- For the second and third fields from the left, a space is added for positive values.
       header="Header1";
       value1=-10000000;
       value2=20000000;
       PrintFormat("%-16s%- 20ld% 20lld",header,(int)value1,(long)value2);
       
    //--- The second line with a header in a 16-character field and data in 20-character fields
    //--- The header and data of the second field are pressed to the left edge.
    //--- Data values of the third field are pressed to the right edge
    //--- For the second and third fields from the left, a space is added for positive values.
       header="Header2";
       value1=10000000;
       value2=-20000000;
       PrintFormat("%-16s%- 20ld% 20lld",header,(int)value1,(long)value2);
       
       /* Sample output:
          Header1      -10000000                       20000000
          Header2       10000000                      -20000000
       */
      }
    
    


  • „#“ Raute.

    1. In Verbindung mit dem o-, x- oder X-Format wird dem Ausgabewert jeweils 0, 0x oder 0X vorangestellt.
    void OnStart()
      {
    //--- Declare the variables to be printed
       string   header="";  // Data header
       double   value1=0;   // First value
       double   value2=0;   // Second value
       
    //--- First line with a header and data in 16-character fields
    //--- The header and data of all fields are pressed to the left edge.
    //--- Data values of the second field are displayed in decimal format
    //--- Data values of the third field are displayed in octal format with 0 added before the value
       header="Header1";
       value1=10000;
       value2=10000;
       PrintFormat("%-16s(DEC) %-16ld(OCT) %-#16lo",header,(uint)value1,(uint)value2);
       
    //--- Second line with header and data in 16-character fields
    //--- The header and data of all fields are pressed to the left edge.
    //--- Data values of the second field are displayed in hexadecimal format with 0x added before the value
    //--- Data values of the third field are displayed in hexadecimal format with 0X added before the value
       header="Header2";
       value1=10000;
       value2=10000;
       PrintFormat("%-16s(hex) %-#16lx(HEX) %-#16lX",header,(uint)value1,(uint)value2);
       
       /* Sample output:
          Header1      (DEC) 10000           (OCT) 023420          
          Header2      (hex) 0x2710          (HEX) 0X2710          
       */
      }
    
    


    2. In Verbindung mit dem Format e, E, a oder A wird der Wert immer mit einem Dezimalpunkt ausgegeben.

    void OnStart()
      {
    //--- Declare the variables to be printed
       string   header="";  // Data header
       double   value1=0;   // First value
       double   value2=0;   // Second value
       
    //--- The first line with a header in a 16-character field and data in 22-character fields
    //--- The header and data of all fields are pressed to the left edge.
    //--- Data values of the second field are displayed together with the 'e' format
    //--- Data values of the third field are displayed together with the 'E' format
       header="Header1";
       value1=255;
       value2=1024;
       PrintFormat("%-16s(e) %-22e(E) %-#22E",header,(double)value1,(double)value2);
       
    //--- The second line with a header in a 16-character field and data in 22-character fields
    //--- The header and data of all fields are pressed to the left edge.
    //--- Data values of the second field are displayed together with the 'a' format
    //--- Data values of the third field are displayed together with the 'A' format
       header="Header2";
       value1=255;
       value2=1024;
       PrintFormat("%-16s(a) %-#22a(A) %-#22A",header,(double)value1,(double)value2);
       
       /* Sample output:
          Header1      (e) 2.550000e+02          (E) 1.024000E+03          
          Header2      (a) 0x1.fe00000000000p+7  (A) 0X1.0000000000000P+10 
       */
      }
    
    


    3. Bei Verwendung in Verbindung mit dem Format g oder G bestimmt das Flag das Vorhandensein eines Dezimalpunkts im Ausgabewert und verhindert das Abschneiden führender Nullen. Das Format g wählt die kompakteste Darstellungsart f oder e, und zeigt den Eintrag im gewählten Format an. Das Format G ist identisch mit dem Format g, aber man hat die Wahl zwischen dem f- und dem E-Format.

    void OnStart()
      {
    //--- Declare the variables to be printed
       string   header="";  // Data header
       double   value1=0;   // First value
       double   value2=0;   // Second value
       
    //--- The first line with a header in a 16-character field and data in 22-character fields
    //--- The header and data of all fields are pressed to the left edge.
    //--- Data values of the second field are displayed together with the 'f' format with default precision
    //--- Data values of the third field are displayed together with the 'g' format
       header="Header1";
       value1=Point();
       value2=DBL_MAX;
       PrintFormat("%-16s(f) %-22f(g) %-#22g",header,(double)value1,(double)value2);
       
    //--- The second line with a header in a 16-character field and data in 22-character fields
    //--- The header and data of all fields are pressed to the left edge.
    //--- Data values of the second field are displayed together with the 'f' format with 5-character precision
    //--- Data values of the third field are displayed together with the 'G' format
       header="Header2";
       value1=Point();
       value2=EMPTY_VALUE;
       PrintFormat("%-16s(f) %-#22.5f(G) %-#22G",header,(double)value1,(double)value2);
       
       /* Sample output:
          Header1      (f) 0.000010              (g) 1.79769e+308          
          Header2      (f) 0.00001               (G) 1.79769E+308          
       */
      }
    
    

    Das Flag # wird ignoriert, wenn es in Verbindung mit den Formaten c, d, i, u und s verwendet wird.


    Die Angabe der Breite (width). Die Mindestanzahl der zu druckenden Zeichen des formatierten Wertes. Wir haben die Arbeit des Spezifizierers zusammen mit den oben genannten Flags diskutiert. Es gibt eine interessante Nuance: Wenn Sie einem Asterisk (*-Zeichen) als Breitenwert angeben, dann sollte der in der Liste zusammen mit den Daten angegebene Wert das Sternchen ersetzen:

    void OnStart()
      {
    //--- Declare the variables to be printed
       string   header="";  // Data header
       double   value1=0;   // First value
       double   value2=0;   // Second value
       
    //--- The first line with a header in a *-character field (16) and data in *-character fields (22)
    //--- The header and data of all fields are pressed to the left edge.
    //--- Data values of the second field are displayed together with the 'f' format with default precision
    //--- Data values of the third field are displayed together with the 'g' format
       header="Header1";
       value1=Point();
       value2=DBL_MAX;
       PrintFormat("%-*s(f) %-*f(g) %-#*g",16,header,22,(double)value1,22,(double)value2);
       
    //--- The second line with a header in a *-character field (16) and data in *-character fields (22)
    //--- The header and data of all fields are pressed to the left edge.
    //--- Data values of the second field are displayed together with the 'f' format with 5-character precision
    //--- Data values of the third field are displayed together with the 'G' format
       header="Header2";
       value1=Point();
       value2=EMPTY_VALUE;
       PrintFormat("%-*s(f) %-#*.5f(G) %-#*G",16,header,22,(double)value1,22,(double)value2);
       
       /* Sample output:
          Header1      (f) 0.000010              (g) 1.79769e+308          
          Header2      (f) 0.00001               (G) 1.79769E+308          
       */
      }
    
    

    In diesem Beispiel unterscheidet sich die Ausgabe nicht von der vorherigen, aber hier geben wir die Breite jedes Feldes als numerischen Parameter in der Liste der Werte an. Dies ist praktisch, wenn die Tabelle innerhalb einer Funktion angezeigt wird, in die wir die Breitenwerte für jede Spalte der Tabelle übergeben können. Sie werden durch die Asterisks in der Formatzeichenfolge ersetzt.


    Angabe zur Genauigkeit (.Präzision). Anzahl der Nachkommastellen. Die Präzisionsangabe kann einen Teil des Nachkommawertes mit oder ohne Rundung abschneiden.

    Für verschiedene Formattypen (Typ) wird die Präzisionsangabe auf unterschiedliche Weise angewendet:

    • a, A.  Gibt die Anzahl der Ziffern nach dem Dezimalpunkt an.
      void OnStart()
        {
      //--- Declare the variables to be printed
         string   header="";  // Data header
         double   value1=0;   // First value
         double   value2=0;   // Second value
         
      //--- The first line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'a' format with default precision
      //--- Data values of the third field are displayed together with the 'A' format with default precision
         header="Header1";
         value1=Point();
         value2=DBL_MAX;
         PrintFormat("%-16s(a) %-22a(A) %-#22A",header,(double)value1,(double)value2);
         
      //--- The second line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'a' format with 5-character precision
      //--- Data values of the third field are displayed together with the 'A' format with 7-character precision
         header="Header2";
         value1=Point();
         value2=EMPTY_VALUE;
         PrintFormat("%-16s(a) %-#22.5a(A) %-#22.7A",header,(double)value1,(double)value2);
         
         /* Sample output:
            Header1      (a) 0x1.4f8b588e368f1p-17 (A ) 0X1.FFFFFFFFFFFFFP+1023
            Header2      (a) 0x1.4f8b6p-17         (A) 0X2.0000000P+1023     
         */
        }
      
      


    • d, i, u, o, x, X. Gibt die Mindestanzahl der angezeigten Ziffern an. Ist die Anzahl der Ziffern des entsprechenden Parameters kleiner als die angegebene Genauigkeit, wird der Ausgabewert links mit Nullen aufgefüllt. Der angezeigte Wert wird nicht abgeschnitten, wenn die Anzahl der ausgegebenen Ziffern größer ist als die angegebene Genauigkeit.
      void OnStart()
        {
      //--- Declare the variables to be printed
         string   header="";  // Data header
         double   value1=0;   // First value
         double   value2=0;   // Second value
         
      //--- The first line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'd' format with 4-character precision
      //--- Data values of the third field are displayed together with the 'i' format with 11-character precision
         header="Header1";
         value1=INT_MAX;
         value2=INT_MAX;
         PrintFormat("%-16s(d) %-22.4d(i) %-#22.11i",header,(int)value1,(int)value2);
         
      //--- The second line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'u' format with 4-character precision
      //--- Data values of the third field are displayed together with the 'o' format with 11-character precision
         header="Header2";
         value1=INT_MAX;
         value2=INT_MAX;
         PrintFormat("%-16s(u) %-#22.4u(o) %-#22.11o",header,(double)value1,(double)value2);
         
      //--- The third line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'x' format with 4-character precision
      //--- Data values of the third field are displayed together with the 'X' format with 11-character precision
         header="Header3";
         value1=INT_MAX;
         value2=INT_MAX;
         PrintFormat("%-16s(x) %-#22.4x(X) %-#22.11X",header,(double)value1,(double)value2);
         
         /* Sample output:
            Header1      (d) 2147483647            (i) 02147483647           
            Header2      (u) 4290772992            (o) 037760000000          
            Header3      (x) 0xffc00000            (X) 0X000FFC00000         
         */
        }
      
      


    • e, E, f. Gibt die Anzahl der angezeigten Stellen nach dem Dezimalpunkt an. Die letzte angezeigte Ziffer wird gerundet.
      void OnStart()
        {
      //--- Declare the variables to be printed
         string   header="";  // Data header
         double   value1=0;   // First value
         double   value2=0;   // Second value
         
      //--- The first line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'e' format with 4-character precision
      //--- Data values of the third field are displayed together with the 'E' format with 11-character precision
         header="Header1";
         value1=DBL_MAX;
         value2=DBL_MAX;
         PrintFormat("%-16s(e) %-22.4e(E) %-#22.11E",header,(double)value1,(double)value2);
         
      //--- The second line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'f' format with 4-character precision
      //--- Data values of the third field are displayed together with the 'f' format with 11-character precision
         header="Header2";
         value1=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
         value2=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
         PrintFormat("%-16s(f) %-#22.4f(f) %-#22.11f",header,(double)value1,(double)value2);
         
         /* Sample output:
            Header1      (e) 1.7977e+308           (E) 1.79769313486E+308    
            Header2      (f) 1.2729                (f) 1.27286000000         
         */
        }
      
      

    • g, G. Gibt die maximale Anzahl signifikanter Ziffern an
      void OnStart()
        {
      //--- Declare the variables to be printed
         string   header="";  // Data header
         double   value1=0;   // First value
         double   value2=0;   // Second value
         
      //--- The first line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'g' format with 4-character precision
      //--- Data values of the third field are displayed together with the 'G' format with 11-character precision
         header="Header1";
         value1=DBL_MAX;
         value2=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
         PrintFormat("%-16s(g) %-22.4g(G) %-#22.11G",header,(double)value1,(double)value2);
         
      //--- The second line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'g' format with 4-character precision
      //--- Data values of the third field are displayed together with the 'G' format with 11-character precision
         header="Header2";
         value1=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
         value2=DBL_MAX;
         PrintFormat("%-16s(g) %-#22.4g(G) %-#22.11G",header,(double)value1,(double)value2);
         
         /* Sample output:
            Header1      (g) 1.798e+308            (G) 1.2731600000          
            Header2      (g) 1.273                 (G) 1.7976931349E+308     
      
         */
        }
      
      
      Beachten Sie, dass die maximale Anzahl signifikanter Ziffern nicht die Anzahl der Dezimalstellen bedeutet. Dabei werden alle Ziffern der Zahl berücksichtigt. Wenn die angegebene Bittiefe 4 Ziffern beträgt, werden bei einem Digits()-Wert von fünf keine vier Nachkommastellen im Preiswert angezeigt. In diesem Beispiel sehen wir nur drei Dezimalstellen(1,273), da die vierte Stelle der Zahl hier die Stelle vor dem Dezimalpunkt ist.


    • s. Die Anzahl der angezeigten Zeichen der Zeile. Wenn die Zeilenlänge den Präzisionswert überschreitet, wird die Zeile bei der Ausgabe abgeschnitten.
      void OnStart()
        {
      //---
      
      //--- Declare the variables to be printed
         string   header="";  // Data header
         double   value1=0;   // First value
         double   value2=0;   // Second value
         
      //--- The first line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'g' format with 4-character precision
      //--- Data values of the third field are displayed together with the 's' format with 11-character precision
         header="Header1";
         value1=DBL_MAX;
         value2=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
         PrintFormat("%-16s(g) %-22.4g(s) %-#22.11s",header,(double)value1,(string)value2);
         
      //--- The second line with a header in a 16-character field and data in 22-character fields
      //--- The header and data of all fields are pressed to the left edge.
      //--- Data values of the second field are displayed together with the 'g' format with 5-character precision
      //--- Data values of the third field are displayed together with the 's' format with 4-character precision
         header="Header2";
         value1=DBL_MAX;
         value2=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
         PrintFormat("%-16s(g) %-#22.5g(s) %-#22.4s",header,(double)value1,(string)value2);
         
         /* Sample output:
            Header1      (g) 1.798e+308            (s) 1.2872                
            Header2      (g) 1.7977e+308           (s) 1.28                  
      
         */
        }
      
      

        Angabe zur Datengröße (h | l | ll | I32 | I64). Es gibt die Größe der als Parameter übergebenen Integer-Zahlen an. Wir können die Größe dieser Daten (int, uint, short, ushort, long, ulong) angeben, indem wir eine ganze Zahl als Parameter übergeben. Nachstehend finden Sie eine Tabelle mit der Kompatibilität zwischen Größenangaben und Datentypen:

        Größe der Daten
        Größenangaben
         Typenbezeichner
          short   h
          d, i, o, x, X
          ushort   h
          u, o, x, X
          int
          l (kleines L), I32
          d, i, o, x, X
          uint
          l (kleines L), I32
          u, o, x, X
          long
          ll (zwei kleine LL), I64
          d, i, o, x, X
          ulong
          I64
          u, o, x, X


        Datentyp-Spezifizierer (Typ). Das einzige erforderliche Feld für die formatierte Ausgabe. 

        Symbol
         Typ Format
        c
        int
        Zeichentyp short (Unicode)
        C
        int
        Zeichentyp char (ANSI)
        d
        int
        Dezimalzahl mit Vorzeichen
        i
        int
        Dezimalzahl mit Vorzeichen
        o
        int
        Oktal-Ganzzahl ohne Vorzeichen
        u
        int
        Dezimale Ganzzahl ohne Vorzeichen
        x
        int
        Hexadezimale Ganzzahl ohne Vorzeichen aus „abcdef“
        X
        int
        Hexadezimale Ganzzahl ohne Vorzeichen aus „ABCDEF“
        e
        double
        Ein reeller Wert im Format [ – ]d.dddd e [sign]ddd, wobei d eine Dezimalstelle, dddd eine oder mehrere Dezimalstellen und ddd eine dreistellige Zahl ist, die die Größe des Exponenten angibt, während „sign“ ein Plus- oder Minuszeichen ist
        E
        double
        Identisch mit dem Format e, mit dem Unterschied, dass das Exponentenzeichen groß geschrieben wird (E statt e)
        f
        double
        Ein reeller Wert im Format [ – ]dddd.dddd, wobei dddd eine oder mehrere Dezimalstellen sein kann. Die Anzahl der vor dem Dezimalpunkt angezeigten Ziffern hängt vom Wert der Zahl ab. Die Anzahl der Nachkommastellen hängt von der gewünschten Genauigkeit ab.
        g
        double
        Ausgabe eines reellen Wertes im f- oder e-Format, je nachdem, welche Ausgabe kompakter ist.
        G
        double
        Ausgabe eines reellen Wertes im Format f oder E, je nachdem, welche Ausgabe kompakter ist.
        a
        double
        Ein reeller Wert im Format [-]0xh.hhhh p±dd, wobei h.hhhh die Mantisse in hexadezimalen Ziffern unter Verwendung von „abcdef“ ist, dd eine oder mehrere Exponenten-Ziffern ist. Die Anzahl der Dezimalstellen wird durch die Präzisionsangabe bestimmt
        A
        double
        Ein reeller Wert im Format [-]0xh.hhhh P±dd, wobei h.hhhh die Mantisse in hexadezimalen Ziffern unter Verwendung von „ABCDEF“ ist, dd eine oder mehrere Exponenten-Ziffern ist. Die Anzahl der Dezimalstellen wird durch die Präzisionsangabe bestimmt
        s
        string
        Ausgabe der ganzen Zeile


        Mit dem Datentyp können wir angeben, in welcher Form wir einen Eintrag im Terminalprotokoll erhalten möchten. Bei den Typen „c“ oder „C“ ist die Ausgabe beispielsweise ein Zeichen. Der von Parametern übergebene Wert gibt den Unicode- oder ANSI-Tabellencode für dieses Zeichen an, während die Verwendung desselben Wertes mit anderen Typangaben den Parameterwert selbst im gewählten Format anzeigt, nicht aber das Zeichen:

        void OnStart()
          {
        //--- Declare the variables to be printed
           string   header="";  // Data header
           char     value1=0;   // First value
           char     value2=0;   // Second value
           
        //--- The first line with a header in a 16-character field and data in 10-character fields
        //--- The header and data of all fields are pressed to the left edge.
        //--- Data values of the second field are displayed together with the 'c' format
        //--- Data values of the third field are displayed together with the 'C' format
           header="Header1";
           value1=65;
           value2=66;
           PrintFormat("%-16s(c) %-10c(C) %-10C",header,(char)value1,(char)value2);
           
        //--- The second line with a header in a 16-character field and data in 10-character fields
        //--- The header and data of all fields are pressed to the left edge.
        //--- Data values of the second field are displayed together with the 'c' format
        //--- Data values of the third field are displayed together with the 'C' format
           header="Header2";
           value1=67;
           value2=68;
           PrintFormat("%-16s(c) %-10c(C) %-10C",header,(char)value1,(char)value2);
           
        //--- The third line with a header in a 16-character field and data in 10-character fields
        //--- The header and data of all fields are pressed to the left edge.
        //--- Data values of the second field are displayed together with the 'd' format
        //--- Data values of the third field are displayed together with the 'i' format
           header="Header3";
           value1=65;
           value2=66;
           PrintFormat("%-16s(d) %-10d(i) %-10i",header,(int)value1,(int)value2);
           
           /* Sample output:
              Header1      (c) A         (C) B         
              Header2      (c) C         (C) D         
              Header3      (d) 65        (i) 66        
           */
          }
        
        

        Wir haben uns kurz alle Formatierungsangaben für einen im Protokoll angezeigten Text angesehen. Schauen wir uns an, wie dies anhand konkreter Beispiele für die Anzeige der Eigenschaften eines Handelskontos aussieht.


        Formatierte Anzeige der Kontoeigenschaften

        Mit den Funktionen AccountInfoInteger(), AccountInfoDouble() und AccountInfoString() können wir ganzzahlige, reelle Eigenschaften oder Zeichenketten erhalten.

        Es ist nicht immer notwendig, eine vollständige Liste aller Eigenschaften anzuzeigen. Daher werden wir für jede Eigenschaft eine Funktion erstellen, die eine Beschreibung dieser Eigenschaft im Protokoll ausgibt. Danach wird es möglich sein, aus den vorgefertigten Funktionen eine beliebige Funktion zusammenzustellen, die die gewünschten Eigenschaften (entweder alle oder ausgewählte) an das Protokoll sendet.

        Wir übergeben der Funktion zwei Parameter — die Breite des Kopfzeilenfelds und den Einzug des Kopfzeilenfelds vom linken Rand. Beginnen wir in der folgenden Reihenfolge: Integer-, Reel- und schließlich die Eigenschaften als Zeichenketten.


        Funktionen zum Drucken der ganzzahligen Kontoeigenschaften.

        Kontonummer:

        //+------------------------------------------------------------------+
        //| Print a description of the account number into the journal       |
        //+------------------------------------------------------------------+
        void AccountLoginPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Login:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,(string)AccountInfoInteger(ACCOUNT_LOGIN));
           /* Sample output:
              Login: 68008618
           */
          }
        
        

        In der Formatzeichenfolge geben wir zunächst die Größe des Zeileneinzugs vom linken Rand mit einem Asterisk an. In den Zeilenparametern übergeben wir die Größe des Einrückungsfeldes (anstelle des Asterisks) und den Wert der Zeichenkette — eine leere Zeichenkette (anstelle des Zeichens s ).
        Das Format „%*s“ ergänzt die in den Parametern übergebene leere Zeichenkette mit Leerzeichen entsprechend dem ebenfalls in den String-Parametern übergebenen Einrückungswert. Daher ist es zweckmäßig, alle leeren Felder aus Leerzeichen in einer Zeile der gewünschten Größe zu machen. Dann geben wir in der Formatzeile auch die Größe des Header-Feldes mit einem Asterisk an, wobei wir den Wert der Variablen w an ihrer Stelle und die Header-Zeile in der Variablen header übergeben. Der letzte Parameter ist der Kontoindexwert aus AccountInfoInteger() als Zeile.


        Art des Handelskontos:

        //+------------------------------------------------------------------+
        //| Print a trading account type into the journal                    |
        //+------------------------------------------------------------------+
        void AccountTradeModePrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the value of the trading account type
           ENUM_ACCOUNT_TRADE_MODE trade_mode=(ENUM_ACCOUNT_TRADE_MODE)AccountInfoInteger(ACCOUNT_TRADE_MODE);
        //--- "Cut out" the name of the trading account type from the line obtained from enum
           string mode=StringSubstr(EnumToString(trade_mode),19);
        //--- Convert the characters of the resulting line to lower case and replace the first letter from small to capital
           if(mode.Lower())
              mode.SetChar(0,ushort(mode.GetChar(0)-0x20));
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Trade mode:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,mode);
           /* Sample output:
              Trade mode: Demo
           */
          }
        
        


        Größe der Hebels:

        //+------------------------------------------------------------------+
        //| Print a description of the provided leverage size in the journal |
        //+------------------------------------------------------------------+
        void AccountLeveragePrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Leverage:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s1:%-s",indent,"",w,header,(string)AccountInfoInteger(ACCOUNT_LEVERAGE));
           /* Sample output:
              Leverage: 1:100
           */
          }
        
        


        Maximale Anzahl von Aufträgen:

        //+------------------------------------------------------------------+
        //| Print a description of the maximum allowed                       |
        //| number of active pending orders                                  |
        //+------------------------------------------------------------------+
        void AccountLimitOrdersPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Limit orders:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,(string)AccountInfoInteger(ACCOUNT_LIMIT_ORDERS));
           /* Sample output:
              Limit orders: 200
           */
          }
        
        


        Modus für Mindestsicherheiten:

        //+------------------------------------------------------------------+
        //| Print a description of the mode for setting a minimal            |
        //| accepted level of collateral in the journal                      |
        //+------------------------------------------------------------------+
        void AccountMarginSOModePrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the value of the mode for setting the minimum available collateral
           ENUM_ACCOUNT_STOPOUT_MODE so_mode=(ENUM_ACCOUNT_STOPOUT_MODE)AccountInfoInteger(ACCOUNT_MARGIN_SO_MODE);
        //--- "Cut out" the mode name from the line obtained from enum 
           string mode=StringSubstr(EnumToString(so_mode),21);
        //--- Convert the characters of the resulting line to lower case and replace the first letter from small to capital
           if(mode.Lower())
              mode.SetChar(0,ushort(mode.GetChar(0)-0x20));
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="StopOut mode:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,mode);
           /* Sample output:
              StopOut mode: Percent
           */
          }
        
        


        Handelserlaubnis für das Konto:

        //+------------------------------------------------------------------+
        //| Print a description                                              |
        //| of allowing trading for the current account in the journal       |
        //+------------------------------------------------------------------+
        void AccountTradeAllowedPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Trade allowed:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- Depending on the bool value of the property, pass the "Yes" or "No" line as a parameter
           PrintFormat("%*s%-*s%-s",indent,"",w,header,((bool)AccountInfoInteger(ACCOUNT_TRADE_ALLOWED) ? "Yes" : "No"));
           /* Sample output:
              Trade allowed: Yes
           */
          }
        
        


        Handelserlaubnis für einen EA:

        //+------------------------------------------------------------------+
        //| Print a description                                              |
        //| allowing trading for an EA                                       |
        //+------------------------------------------------------------------+
        void AccountTradeExpertPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Trade expert:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- Depending on the bool value of the property, pass the "Yes" or "No" line as a parameter
           PrintFormat("%*s%-*s%-s",indent,"",w,header,((bool)AccountInfoInteger(ACCOUNT_TRADE_EXPERT) ? "Yes" : "No"));
           /* Sample output:
              Trade expert: Yes
           */
          }
        
        


        Modus der Margenberechnung:

        //+------------------------------------------------------------------+
        //| Print a description of the margin calculation mode in the journal|
        //+------------------------------------------------------------------+
        void AccountMarginModePrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the value of the margin calculation mode
           ENUM_ACCOUNT_MARGIN_MODE  margin_mode=(ENUM_ACCOUNT_MARGIN_MODE)AccountInfoInteger(ACCOUNT_MARGIN_MODE);
        //--- "Cut out" the mode name from the line obtained from enum 
           string mode=StringSubstr(EnumToString(margin_mode),20);
        //--- Convert the characters of the resulting line to lower case and replace the first letter from small to capital
           if(mode.Lower())
              mode.SetChar(0,ushort(mode.GetChar(0)-0x20));
        //--- Replace all underscore characters with space in the resulting line
           StringReplace(mode,"_"," ");
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Margin mode:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,mode);
           /* Sample output:
              Margin mode: Retail hedging
           */
          }
        
        


        Anzahl der Dezimalstellen der Kontowährung:

        //+------------------------------------------------------------------+
        //| Print a description of the number of                             |
        //| decimal places for an account currency                           |
        //+------------------------------------------------------------------+
        void AccountCurrencyDigitsPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Currency digits:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,(string)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS));
           /* Sample output:
              Currency digits: 2
           */
          }
        
        


        Flag der Positionsschließung durch FIFO-Regel:

        //+------------------------------------------------------------------+
        //| Print a description of the flag indicating                       |
        //| that positions can only be closed using the FIFO rule            |
        //+------------------------------------------------------------------+
        void AccountFIFOClosePrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="FIFO close:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- Depending on the bool value of the property, pass the "Yes" or "No" line as a parameter
           PrintFormat("%*s%-*s%-s",indent,"",w,header,((bool)AccountInfoInteger(ACCOUNT_FIFO_CLOSE) ? "Yes" : "No"));
           /* Sample output:
              FIFO close: No
           */
          }
        
        


        Gegensätzliche Positionen eines Symbols zulassen:

        //+------------------------------------------------------------------+
        //| Print a description of the flag indicating                       |
        //| opposite positions are allowed on a single symbol                |
        //+------------------------------------------------------------------+
        void AccountHedgeAllowedPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Hedge allowed:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- Depending on the bool value of the property, pass the "Yes" or "No" line as a parameter
           PrintFormat("%*s%-*s%-s",indent,"",w,header,((bool)AccountInfoInteger(ACCOUNT_HEDGE_ALLOWED) ? "Yes" : "No"));
           /* Sample output:
              Hedge allowed: Yes
           */
          }
        
        


        Funktionen zum Drucken der reellen Eigenschaften.

        Kontostand:

        //+------------------------------------------------------------------------------------+
        //| Print a description of the account balance in the deposit currency in the journal  |
        //+------------------------------------------------------------------------------------+
        void AccountBalancePrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the balance, the number of decimal places for the symbol and its name
           double ballance=AccountInfoDouble(ACCOUNT_BALANCE);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Balance:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,ballance,currency);
           /* Sample output:
              Balance: 10015.00 USD
           */
          }
        
        


        Kontokredit:

        //+------------------------------------------------------------------+
        //| Print a description of account credit size                       |
        //| in a deposit currency                                            |
        //+------------------------------------------------------------------+
        void AccountCreditPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the credit, the number of decimal places for the symbol and its name
           double credit=AccountInfoDouble(ACCOUNT_CREDIT);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Credit:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,credit,currency);
           /* Sample output:
              Credit: 0.00 USD
           */
          }
        
        


        Laufender Gewinn auf dem Konto :

        //+------------------------------------------------------------------+
        //| Print a description                                              |
        //| of the current profit in the deposit currency                    |
        //+------------------------------------------------------------------+
        void AccountProfitPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the current profit, the number of decimal places for the symbol and its name
           double profit=AccountInfoDouble(ACCOUNT_PROFIT);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Profit:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,profit,currency);
           /* Sample output:
              Profit: 0.00 USD
           */
          }
        
        


        Kapital auf dem Konto:

        //+------------------------------------------------------------------+
        //| Print a description of the value of                              |
        //| equity on an account in a deposit currency                       |
        //+------------------------------------------------------------------+
        void AccountEquityPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the equity, the number of decimal places for the symbol and its name
           double equity=AccountInfoDouble(ACCOUNT_EQUITY);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Equity:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,equity,currency);
           /* Sample output:
              Equity: 10015.00 USD
           */
          }
        
        


        Reservierte Sicherheiten:

        //+------------------------------------------------------------------+
        //| Print a description of                                           |
        //| reserved collateral funds on the account in a deposit currency   |
        //+------------------------------------------------------------------+
        void AccountMarginPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the reserved collateral, the number of decimal places for the symbol and its name
           double margin=AccountInfoDouble(ACCOUNT_MARGIN);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Margin:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,margin,currency);
           /* Sample output:
              Margin: 0.00 USD
           */
          }
        
        


        Verfügbare freie Mittel zur Eröffnung einer Position:

        //+--------------------------------------------------------------------------------------+
        //| Print a description of the free funds,                                               |
        //| available for opening a position on an account in a deposit currency, in the journal |
        //+--------------------------------------------------------------------------------------+
        void AccountMarginFreePrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the reserved collateral, the number of decimal places for the symbol and its name
           double margin_free=AccountInfoDouble(ACCOUNT_MARGIN_FREE);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Margin free:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,margin_free,currency);
           /* Sample output:
              Margin free: 10015.00 USD
           */
          }
        
        


        Höhe der Sicherheiten für ein Konto in %:

        //+------------------------------------------------------------------+
        //| Print a description                                              |
        //| of the collateral level on an account in %                       |
        //+------------------------------------------------------------------+
        void AccountMarginLevelPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Margin level:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- The value is set with 'digits' equal to 2 and the fact that the property is displayed in % is specified
           PrintFormat("%*s%-*s%-.2f %%",indent,"",w,header,AccountInfoDouble(ACCOUNT_MARGIN_LEVEL));
           /* Sample output:
              Margin level: 0.00 %
           */
          }
        
        


        Sicherheitenlevel für einen Margin-Call:

        //+----------------------------------------------------------------------------+
        //| Print a description of the collateral level,                               |
        //| at which a deposit to an account is required (Margin Call), in the journal |
        //+----------------------------------------------------------------------------+
        void AccountMarginSOCallPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the MarginCall level values, the number of decimal places for the symbol and its name
           double margin_so_call=AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- If the level of collateral for MarginCall is calculated as %,
        //--- specify 'currency' in % rather than in account currency, while 'digits' will be equal to 2
           if(AccountInfoInteger(ACCOUNT_MARGIN_SO_MODE)==ACCOUNT_STOPOUT_MODE_PERCENT)
             {
              currency="%";
              digits=2;
             }
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Margin Call:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value obtained above
           PrintFormat("%*s%-*s%-.*f %s",indent,"",w,header,digits,margin_so_call,currency);
           /* Sample output:
              Margin Call: 50.00 %
           */
          }
        
        


        Stop Out Level durch die Marge:

        //+------------------------------------------------------------------+
        //| Print a description of the collateral level,                     |
        //| upon reaching which                                              |
        //| the most loss-making position is forcefully closed (Stop Out)    |
        //+------------------------------------------------------------------+
        void AccountMarginStopOutPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the StopOut level values, the number of decimal places for the symbol and its name
           double margin_so_so=AccountInfoDouble(ACCOUNT_MARGIN_SO_SO);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- If the level of collateral for StopOut is calculated as %,
        //--- specify 'currency' in % rather than in account currency, while 'digits' will be equal to 2
           if(AccountInfoInteger(ACCOUNT_MARGIN_SO_MODE)==ACCOUNT_STOPOUT_MODE_PERCENT)
             {
              currency="%";
              digits=2;
             }
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Margin Stop Out:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value obtained above
           PrintFormat("%*s%-*s%-.*f %s",indent,"",w,header,digits,margin_so_so,currency);
           /* Sample output:
              Margin Stop Out: 30.00 %
           */
          }
        
        


        Auf dem Konto reservierter Betrag zur Deckung der Marge für alle ausstehenden Aufträge:

        //+------------------------------------------------------------------+
        //| Print a description of the funds                                 |
        //| reserved on the account for security                             |
        //| of a guarantee amount for all pending orders                     |
        //+------------------------------------------------------------------+
        void AccountMarginInitialPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the amount of the reserved funds, the number of decimal places for the symbol and its name
           double margin_initial=AccountInfoDouble(ACCOUNT_MARGIN_INITIAL);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Margin initial:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,margin_initial,currency);
           /* Sample output:
              Margin initial: 0.00 USD
           */
          }
        
        


        Mindestkapital, das auf dem Konto reserviert ist, um den Mindestbetrag der offenen Positionen zu decken:

        //+------------------------------------------------------------------+
        //| Print a description of the funds                                 |
        //| reserved on the account for security                             |
        //| of the min amount of all open positions                          |
        //+------------------------------------------------------------------+
        void AccountMarginMaintenancePrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the amount of the reserved funds, the number of decimal places for the symbol and its name
           double margin_maintenance=AccountInfoDouble(ACCOUNT_MARGIN_MAINTENANCE);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Margin maintenance:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,margin_maintenance,currency);
           /* Sample output:
              Margin maintenance: 0.00 USD
           */
          }
        
        


        Höhe der Vermögenswerte:

        //+----------------------------------------------------------------------------+
        //| Print a description of the current asset size on the account in the journal|
        //+----------------------------------------------------------------------------+
        void AccountAssetsPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the current asset size on the account, the number of decimal places for the symbol and its name
           double assets=AccountInfoDouble(ACCOUNT_ASSETS);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Assets:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,assets,currency);
           /* Sample output:
              Assets: 0.00 USD
           */
          }
        
        


        Höhe der Verbindlichkeiten:

        //+------------------------------------------------------------------+
        //| Print a description                                              |
        //| of the current liabilities on the account                        |
        //+------------------------------------------------------------------+
        void AccountLiabilitiesPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the current liabilities on the account, the number of decimal places for the symbol and its name
           double liabilities=AccountInfoDouble(ACCOUNT_LIABILITIES);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Liabilities:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,liabilities,currency);
           /* Sample output:
              Liabilities: 0.00 USD
           */
          }
        
        


        Gesperrte Kommissionen:

        //+------------------------------------------------------------------+
        //| Print a description                                              |
        //| of the current sum of blocked commissions on an account          |
        //+------------------------------------------------------------------+
        void AccountComissionBlockedPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Get the current blocked commissions on the account, the number of decimal places for the symbol and its name
           double commission_blocked=AccountInfoDouble(ACCOUNT_COMMISSION_BLOCKED);
           int digits=(int)AccountInfoInteger(ACCOUNT_CURRENCY_DIGITS);
           string currency=AccountInfoString(ACCOUNT_CURRENCY);
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Comission blocked:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
        //--- To display the value correctly, replace the asterisk in the format line with the digits value for the symbol
           PrintFormat("%*s%-*s%-.*f %-s",indent,"",w,header,digits,commission_blocked,currency);
           /* Sample output:
              Comission blocked: 0.00 USD
           */
          }
        
        


        Funktionen zum Drucken der Kontoeigenschaften in Form von Zeichenketten.

        Name des Kunden:

        //+------------------------------------------------------------------+
        //| Print a description of the client name into the journal          |
        //+------------------------------------------------------------------+
        void AccountNamePrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Name:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,AccountInfoString(ACCOUNT_NAME));
           /* Sample output:
              Name: Artem
           */
          }
        
        


        Name des Handelsservers:

        //+------------------------------------------------------------------+
        //| Print a description of the trade server name into the journal    |
        //+------------------------------------------------------------------+
        void AccountServerPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Server:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,AccountInfoString(ACCOUNT_SERVER));
           /* Sample output:
              Server: MetaQuotes-Demo
           */
          }
        //+------------------------------------------------------------------+
        
        


        Name der Einzahlungswährung:

        //+------------------------------------------------------------------+
        //| Print a description of a deposit currency name                   |
        //+------------------------------------------------------------------+
        void AccountCurrencyPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Currency:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,AccountInfoString(ACCOUNT_CURRENCY));
           /* Sample output:
              Currency: USD
           */
          }
        
        


        Name des kontoführenden Unternehmens:

        //+------------------------------------------------------------------+
        //| Print a description of the company name,                         |
        //| serving an account, into the journal                             |
        //+------------------------------------------------------------------+
        void AccountCompanyPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Company:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the property value in the log with a header with the required width and indentation
           PrintFormat("%*s%-*s%-s",indent,"",w,header,AccountInfoString(ACCOUNT_COMPANY));
           /* Sample output:
              Company: MetaQuotes Software Corp.
           */
          }
        
        

        Alle oben vorgestellten Funktionen sind fast identisch miteinander. Sie haben die Möglichkeit, den Zeileneinzug vom linken Rand und die Breite des Kopffelds festzulegen. Der Standardwert Null, der an die Funktion übergeben wird, bedeutet, dass es keinen Einzug gibt und die Randbreite der Größe der Kopfzeile + 1 Zeichen entspricht. Daher können diese Funktionen unverändert verwendet werden, um die erforderlichen Kontoeigenschaften anzuzeigen. Wenn Sie jedoch eine Funktion zur Anzeige einer Gruppe von Eigenschaften erstellen müssen, benötigen Sie die Einrückung und die Breite des Kopffelds für eine übersichtliche und leicht lesbare Ausgabe der Werte im Journal.

        Lassen Sie uns ein Beispiel für eine solche Funktion erstellen, die alle Kontoeigenschaften im Journal anzeigt.

        Die Funktion, die alle Kontodaten in das Journal druckt:

        //+------------------------------------------------------------------+
        //| Print account data into the journal                              |
        //+------------------------------------------------------------------+
        void AccountInfoPrint(const uint header_width=0,const uint indent=0)
          {
        //--- Display descriptions of integer properties according to their location in ENUM_ACCOUNT_INFO_INTEGER
           Print("AccountInfoInteger properties:");
           AccountLoginPrint(header_width,indent);
           AccountTradeModePrint(header_width,indent);
           AccountLeveragePrint(header_width,indent);
           AccountLimitOrdersPrint(header_width,indent);
           AccountMarginSOModePrint(header_width,indent);
           AccountTradeAllowedPrint(header_width,indent);
           AccountTradeExpertPrint(header_width,indent);
           AccountMarginModePrint(header_width,indent);
           AccountCurrencyDigitsPrint(header_width,indent);
           AccountFIFOClosePrint(header_width,indent);
           AccountHedgeAllowedPrint(header_width,indent);
        //--- Display descriptions of real properties according to their location in ENUM_ACCOUNT_INFO_DOUBLE
           Print("AccountInfoDouble properties:");
           AccountBalancePrint(header_width,indent);
           AccountCreditPrint(header_width,indent);
           AccountProfitPrint(header_width,indent);
           AccountEquityPrint(header_width,indent);
           AccountMarginPrint(header_width,indent);
           AccountMarginFreePrint(header_width,indent);
           AccountMarginLevelPrint(header_width,indent);
           AccountMarginSOCallPrint(header_width,indent);
           AccountMarginStopOutPrint(header_width,indent);
           AccountMarginInitialPrint(header_width,indent);
           AccountMarginMaintenancePrint(header_width,indent);
           AccountAssetsPrint(header_width,indent);
           AccountLiabilitiesPrint(header_width,indent);
           AccountComissionBlockedPrint(header_width,indent);
        //--- Display descriptions of string properties according to their location in ENUM_ACCOUNT_INFO_STRING
           Print("AccountInfoString properties:");
           AccountNamePrint(header_width,indent);
           AccountServerPrint(header_width,indent);
           AccountCurrencyPrint(header_width,indent);
           AccountCompanyPrint(header_width,indent);
          }
        
        

        Die Funktion ruft nacheinander alle Funktionen auf, die die Kontoeigenschaftsdaten ausgeben, und zwar in der Reihenfolge der Enumeration ENUM_ACCOUNT_INFO_INTEGER, ENUM_ACCOUNT_INFO_DOUBLE und ENUM_ACCOUNT_INFO_STRING.

        Das Ergebnis des Funktionsaufrufs aus dem Skript mit einer Kopfzeilenfeldbreite von 20 Zeichen und einer Einrückung von 2 Zeichen:

        void OnStart()
          {
        //--- Print trading account properties in the journal
           AccountInfoPrint(20,2);
           /* Sample output:
              AccountInfoInteger properties:
                Login:              68008618
                Trade mode:         Demo
                Leverage:           1:100
                Limit orders:       200
                StopOut mode:       Percent
                Trade allowed:      Yes
                Trade expert:       Yes
                Margin mode:        Retail hedging
                Currency digits:    2
                FIFO close:         No
                Hedge allowed:      Yes
              AccountInfoDouble properties:
                Balance:            10015.00 USD
                Credit:             0.00 USD
                Profit:             2.11 USD
                Equity:             10017.11 USD
                Margin:             25.61 USD
                Margin free:        9991.50 USD
                Margin level:       39114.06 %
                Margin Call:        50.00 %
                Margin Stop Out:    30.00 %
                Margin initial:     0.00 USD
                Margin maintenance: 0.00 USD
                Assets:             0.00 USD
                Liabilities:        0.00 USD
                Comission blocked:  0.00 USD
              AccountInfoString properties:
                Name:               Artem
                Server:             MetaQuotes-Demo
                Currency:           USD
                Company:            MetaQuotes Software Corp.
           */
          }
        
        


        Zeit mit Millisekunden aus den Eigenschaften der Ticks

        Die MqlTick-Struktur wurde entwickelt, um die am meisten benötigten Daten über die aktuellen Preise zeitnah zu erhalten.

        Eine Variable vom Typ MqlTick ermöglicht es, Ask-, Bid-, Last- und Volume-Werte mit einem Aufruf der Funktion SymbolInfoTick() zu erhalten. Darüber hinaus enthält die Struktur die Tick-Zeit in Millisekunden. Der Zeitwert wird in einer Variablen vom Typ long angegeben. Mit anderen Worten: Wenn wir diese Daten im Protokoll ausdrucken, erhalten wir einfach eine bestimmte Zahl — die Anzahl der Millisekunden, die seit dem 01.01.1970 vergangen sind. Um diese Daten in einem für Menschen lesbaren Zeitformat anzuzeigen, müssen Sie diese Zahl in ein Datum umwandeln und Millisekunden zu dem resultierenden Datum hinzufügen.

        Um ein Datum mit Sekunden zu erhalten, müssen wir die Anzahl der Millisekunden durch 1000 teilen, und um Millisekunden der Zeit zu erhalten, müssen Sie den Rest der Anzahl der Millisekunden des Datums geteilt durch 1000 nehmen.

        Im Allgemeinen sieht es folgendermaßen aus:

        void OnStart()
          {
        //---
           MqlTick tick;
           if(SymbolInfoTick(Symbol(),tick))
             {
              string time_str=string((datetime)tick.time_msc / 1000)+"."+string(tick.time_msc % 1000);
              Print("time_str=",time_str);
             }
           /* Sample output:
              time_str=2023.07.10 18:49:36.463
           */
          }  
        
        


        Schreiben wir die Funktion, die die Zeit in Millisekunden empfängt und die Zeit im Format Tag Zeit.Msc anzeigt:

        //+------------------------------------------------------------------+
        //| Print the time in the Date Time.Msc format in the journal        |
        //+------------------------------------------------------------------+
        void TimeMSCPrint(const long time_msc,const uint header_width=0,const uint indent=0)
          {
        //--- Define the header text and the width of the header field
        //--- If the header width is passed to the function equal to zero, then the width will be the size of the header line + 1
           string header="Time msc:";
           uint w=(header_width==0 ? header.Length()+1 : header_width);
        //--- Print the date and time in the journal with a header with the required width and indentation, milliseconds with 3 digit precision 
           PrintFormat("%*s%-*s%-s.%.3lu",indent,"",w,header,string((datetime)time_msc / 1000),time_msc % 1000);
           /* Sample output:
              Time msc: 2023.07.10 19:49:05.233
           */
          }
        
        


        Um das Datum und die Uhrzeit in Millisekunden direkt zu erhalten und im Journal anzuzeigen, können Sie die folgende Funktion verwenden:

        //+------------------------------------------------------------------+
        //| Print the time in the Date Time.Msc format for a symbol          |
        //+------------------------------------------------------------------+
        void TimeMSCPrint(const string symbol,const uint header_width=0,const uint indent=0)
          {
        //--- Get time from the tick
           MqlTick tick;
           if(!SymbolInfoTick(symbol,tick))
             {
              Print(__FUNCTION__,": SymbolInfoTick error: ",(string)GetLastError());
              return;
             }
        //--- Print the time in milliseconds using the first version of the function
           TimeMSCPrint(tick.time_msc,header_width,indent);
           /* Sample output:
              Time msc: 2023.07.10 20:07:08.202
           */
          }
        
        


        Schlussfolgerung

        In diesem Artikel haben wir uns die Fähigkeit von PrintFormat() angesehen, eine formatierte Zeile zu drucken, und Beispielfunktionen für das Drucken von Kontoeigenschaften erstellt, die Sie in Ihren Programmen verwenden können. Es gibt aber noch eine andere Möglichkeit, eine formatierte Ausgabe zu erzeugen — die Funktion StringFormat(). Im Gegensatz zu PrintFormat(), das eine Zeile im gewünschten Format in das Journal druckt, wird hier eine formatierte Zeile im angegebenen Format zurückgegeben. Ich halte sie für die Anzeige von formatiertem Text für geeigneter, da sie die gewünschte Zeile aus Formatzeilen erzeugt. Diese Zeile kann dann an verschiedenen Stellen im Programm verwendet werden und wird nicht nur in das Journal ausgegeben. Im nächsten Artikel werde ich mich mit StringFormat() befassen und seine Eigenschaften untersuchen.


        Übersetzt aus dem Russischen von MetaQuotes Ltd.
        Originalartikel: https://www.mql5.com/ru/articles/12905

        Neuronale Netze leicht gemacht (Teil 49): Soft Actor-Critic Neuronale Netze leicht gemacht (Teil 49): Soft Actor-Critic
        Wir setzen unsere Diskussion über Algorithmen des Verstärkungslernens zur Lösung von Problemen im kontinuierlichen Aktionsraum fort. In diesem Artikel werde ich den Soft Actor-Critic (SAC) Algorithmus vorstellen. Der Hauptvorteil von SAC ist die Fähigkeit, optimale Strategien zu finden, die nicht nur die erwartete Belohnung maximieren, sondern auch eine maximale Entropie (Vielfalt) von Aktionen aufweisen.
        Strukturen in MQL5 und Methoden zum Drucken deren Daten Strukturen in MQL5 und Methoden zum Drucken deren Daten
        In diesem Artikel werden wir uns die Strukturen von MqlDateTime, MqlTick, MqlRates und MqlBookInfo ansehen sowie die Methoden zum Drucken von deren Daten. Um alle Felder einer Struktur auszudrucken, gibt es die Standardfunktion ArrayPrint(), die die im Array enthaltenen Daten mit dem Typ der behandelten Struktur in einem praktischen Tabellenformat anzeigt.
        StringFormat(). Inspektion und vorgefertigte Beispiele StringFormat(). Inspektion und vorgefertigte Beispiele
        In diesem Artikel wird die Inspektion der Funktion PrintFormat() fortgesetzt. Wir werden uns kurz mit der Formatierung von Zeichenketten mit StringFormat() und ihrer weiteren Verwendung im Programm beschäftigen. Wir werden auch Vorlagen für die Anzeige von Symboldaten im Terminaljournal schreiben. Der Artikel ist sowohl für Anfänger als auch für erfahrene Entwickler nützlich.
        Entwicklung eines Replay-Systems — Marktsimulation (Teil 12): Die Geburt des SIMULATORS (II) Entwicklung eines Replay-Systems — Marktsimulation (Teil 12): Die Geburt des SIMULATORS (II)
        Die Entwicklung eines Simulators kann viel interessanter sein, als es scheint. Heute gehen wir ein paar Schritte weiter in diese Richtung, denn die Dinge werden immer interessanter.