MT5 und Geschwindigkeit in Aktion - Seite 63

 
fxsaber:

Liebe Entwickler, könnten Sie mir bitte mitteilen, wie MQL_MEMORY_USED berechnet wird?

Ich habe eine Berechnung des Speichers durchgeführt, den alle EA-Variablen belegen.

Sie beträgt weniger als 10 %. Wenn ich es richtig verstehe, umfasst MQL_MEMORY_USED den History-Cache und den CopyTicks-Cache. Aber es ist immer noch viel weniger.

Gleichzeitig verbraucht der parallele Expert Advisor ein Vielfaches weniger. Aber das Prinzip ist das gleiche.

Was ist im Allgemeinen in diesem Wert enthalten?


Ich habe eine Vorlage mit Expert Advisor gespeichert und sie auf dasselbe Diagramm angewendet, indem ich ein Neuladen veranlasste. Ich habe es so gesehen.

Die Speichernutzung hat sich um fast eine Größenordnung verändert. Bislang ist es schwierig zu erklären, was das bedeutet.

Viele Programme haben einen kumulativen Effekt bei der Speichernutzung. Dies ist eine Sünde von Browsern und manchmal sogar von Word. Auch das Terminal kann daran schuld sein. Außerdem werden alle Protokolle standardmäßig geschrieben, und es kann leicht eine Woche dauern, wenn man zu viele Aktionen in einer Giga hat. Dies ist ein Übel, das bewältigt werden muss. Aber es ist nicht klar, wie.

 
Vladimir Pastushak:

Vielleicht wissen Sie, wie man programmatisch ein Finanzinstrument auswählt und nicht ewig hängen bleibt?

Durch einen Indikator

Особенности языка mql5, тонкости и приёмы работы
Особенности языка mql5, тонкости и приёмы работы
  • 2020.10.22
  • www.mql5.com
В данной теме будут обсуждаться недокументированные приёмы работы с языком mql5, примеры решения тех, или иных задач...
 

Forum zum Thema Handel, automatisierte Handelssysteme und Testen von Handelsstrategien

MT5 und Geschwindigkeit in Aktion

Renat Fatkhullin, 2020.10.14 04:15

Für das Massenticken ist mehr Speicher erforderlich.

4 GB (Preis 20 €) sind im Jahr 2020 für Analysen und Forschung nicht mehr von Nutzen.

Für Market Products ist dieser Ansatz nirgendwo gut. Wir müssen die 10-Sekunden-Speicherung von unnötigen Daten durch eine solche Krücke umgehen.

      while (!IsStopped() && ::TerminalInfoInteger(TERMINAL_MEMORY_USED) > inMaxMemory)
      {
        Alert("::TerminalInfoInteger(TERMINAL_MEMORY_USED) = " + (string)::TerminalInfoInteger(TERMINAL_MEMORY_USED));
        
        Sleep(1000);
      }

Ein triviales Marktprodukt in Form eines Market Screeners zu erstellen, ist für MT5 aufgrund des zu hohen Speicherverbrauchs eigentlich nicht machbar.

 
fxsaber:

Ein triviales Marktprodukt in Form eines Market Screeners zu erstellen, ist für den MT5 aufgrund des hohen Speicherverbrauchs eigentlich nicht machbar.

Das Terminal verbraucht nach dem Start sehr viel Speicher.

Nach der Ausführung des Screeners begann er 2 Gigabyte zu verbrauchen (TERMINAL_MEMORY_USED und nahm mit der Zeit nicht ab). Dies ist mit nur einem offenen Chart für 5000 M1-Balken.


Ich habe keinen Screenshot gespeichert. Aber beschlossen, in einem Beispiel, das zeigt, Speicher essen Terminal nicht an sich, wo es nur dumm ist zu werfen.

// Создание копий оригинальных символов из Обзора рынка в виде пользовательских.
#property script_show_inputs

input datetime inStartTime = D'2020.06.01'; // С какого времени закачивать тики

void OnStart()
{
  for (int i = SymbolsTotal(true) - 1; !IsStopped() && (i >= 0); i--)
  {
    const string Symb = SymbolName(i, true);
    
    if (!SymbolInfoInteger(Symb, SYMBOL_CUSTOM)) // Если символ не кастомный.
    {
      Alert(Symb + " - Start.");
      
      MqlTick Ticks[];
      
      if (CopyTicksRange(Symb, Ticks, COPY_TICKS_ALL, (long)inStartTime * 1000) > 0) // Взяли с него тики.
      {
        const string CustomSymb = "CUSTOM_" + Symb;
      
        if (SymbolInfoInteger(CustomSymb, SYMBOL_EXIST) || CustomSymbolCreate(CustomSymb, AccountInfoString(ACCOUNT_SERVER), Symb)) // Содали кастомный.
        {
          Alert((string)i + ": " + Symb + " - " + (string)CustomTicksReplace(CustomSymb, 0, LONG_MAX, Ticks)); // Поместили в него тики.
          
          SymbolSelect(CustomSymb, true);
        }
       }
    }
  }
}


Das Skript erstellt einfach Kopien der Originalsymbole aus dem Market Watch. Ich sollte alle Symbole in MQ-Demo hinzufügen und dieses Skript zuerst im kalten und dann im heißen Zustand ausführen.

Und nach dem Hot Run (wenn die Ticks bereits in Form von tkc-Dateien auf der SSD liegen) werde ich einen enormen Speicherverbrauch feststellen, wo er bei einer ordnungsgemäßen Implementierung nicht benötigt wird.


Beim Ausführen des Skripts habe ich jedoch festgestellt, dass es sich bei MQ-Demo aufhängt. Es kann nur durch Abnormales Beenden entladen werden, woraufhin das Terminal nicht mehr als 1 GB Speicher freigibt.


Es ist einfach, diesen Screenshot mit dem zu Beginn zu vergleichen.

 

Ich bin mir nicht sicher, ob dies ein Fehler oder eine Funktion ist. Ich habe selbst noch keine Antwort gefunden. Aber die Frage bezieht sich auf die Leistung, und ich denke, es ist besser, sie hier zu stellen.

Wenn wir zum Beispiel 22 Puffer des Typs DRAW_SECTION zu einem leeren Indikator hinzufügen, dann verzögert sich das Terminal beim Start eines solchen Indikators für ein Diagramm mit 1000000 Balken oder mehr erheblich (es verursacht eine beträchtliche CPU-Last) und verbraucht erhebliche Mengen an Speicher, selbst wenn der Indikator nichts berechnet.

Mein Interesse wurde durch die Tatsache geweckt, dass bei der Verwendung von Puffern mit anderen Typen alles problemlos funktioniert und eine solche Verlangsamung nicht zu beobachten ist.

Ich habe zum Beispiel den folgenden Code auf einem einzelnen Diagramm mit 1000000 Balken ausgeführt, und er verbrauchte etwa 500 MBytes und verzögert sich, insbesondere das Diagramm selbst.

#property indicator_chart_window

#property indicator_buffers   22
#property indicator_plots     22

#property indicator_type1     DRAW_SECTION
#property indicator_type2     DRAW_SECTION
#property indicator_type3     DRAW_SECTION
#property indicator_type4     DRAW_SECTION
#property indicator_type5     DRAW_SECTION
#property indicator_type6     DRAW_SECTION
#property indicator_type7     DRAW_SECTION
#property indicator_type8     DRAW_SECTION
#property indicator_type9     DRAW_SECTION
#property indicator_type10     DRAW_SECTION
#property indicator_type11     DRAW_SECTION
#property indicator_type12     DRAW_SECTION
#property indicator_type13     DRAW_SECTION
#property indicator_type14     DRAW_SECTION
#property indicator_type15     DRAW_SECTION
#property indicator_type16     DRAW_SECTION
#property  indicator_type17     DRAW_SECTION
#property  indicator_type18     DRAW_SECTION
#property  indicator_type19     DRAW_SECTION
#property  indicator_type20     DRAW_SECTION
#property  indicator_type21     DRAW_SECTION
#property  indicator_type22     DRAW_SECTION

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
{  
   return INIT_SUCCEEDED;   
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   return rates_total;
}

Ändere ich jedoch den Puffertyp in, sagen wir, DRAW_LINE, wird die Belastung des Prozessors drastisch reduziert, Verzögerungen werden nicht beobachtet, und der Speicherverbrauch ist fünfmal geringer (etwa 100 MByte).

#property indicator_chart_window

#property indicator_buffers   22
#property indicator_plots     22

#property indicator_type1     DRAW_LINE
#property indicator_type2     DRAW_LINE
#property indicator_type3     DRAW_LINE
#property indicator_type4     DRAW_LINE
#property indicator_type5     DRAW_LINE
#property indicator_type6     DRAW_LINE
#property indicator_type7     DRAW_LINE
#property indicator_type8     DRAW_LINE
#property indicator_type9     DRAW_LINE
#property indicator_type10     DRAW_LINE
#property indicator_type11     DRAW_LINE
#property indicator_type12     DRAW_LINE
#property indicator_type13     DRAW_LINE
#property indicator_type14     DRAW_LINE
#property indicator_type15     DRAW_LINE
#property indicator_type16     DRAW_LINE
#property  indicator_type17     DRAW_LINE
#property  indicator_type18     DRAW_LINE
#property  indicator_type19     DRAW_LINE
#property  indicator_type20     DRAW_LINE
#property  indicator_type21     DRAW_LINE
#property  indicator_type22     DRAW_LINE

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
{  
   return INIT_SUCCEEDED;   
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   return rates_total;
}   

Ähnliche Tests wurden mit verschiedenen Builds durchgeführt, bis hin zu 2019er Builds, und die Situation ist die gleiche.

Ich würde gerne wissen, woran das liegt und ob das grundsätzlich normal ist?
 
fxsaber:

Ein einzelner Bürger zogein Duplikat einer unschätzbaren Ladung MQL-Code aus seiner weiten Hose hervor, das zeigte, dass die Krücke unter den gleichen Bedingungen schneller arbeitete als die reguläre Funktion.

Ein sehr einfacher Test:

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
   TestSymbolInfoTick();
   TestPositionSelectByTicket();
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void TestSymbolInfoTick()
  {
   MqlTick Tick;
//---
   ulong start,end,max_time=0,avr_time=0,counter=0;
   int   count=100000;
   for(int i=0; i<count; i++)
     {
      start=GetMicrosecondCount();
      SymbolInfoTick(_Symbol, Tick);
      end=GetMicrosecondCount()-start;
      //---
      if(end>max_time)
         max_time=end;
      if(end>100)
        {
         avr_time+=end;
         counter++;
        }
     }
   Print("SymbolInfoTick max bad time: ",DoubleToString(max_time/1000.0,3)," ms; avr bad time: ",counter ? DoubleToString(avr_time/1000.0/counter,3):"0"," ms; bad iterations: ",counter," total iterations: ",count);
  }  
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void TestPositionSelectByTicket()
  {
//---
   ulong start,end,max_time=0,avr_time=0,counter=0;
   int   count=100000;
   for(int i=0; i<count; i++)
     {
      start=GetMicrosecondCount();
      GetBid();
      end=GetMicrosecondCount()-start;
      //---
      if(end>max_time)
         max_time=end;
      if(end>100)
        {
         avr_time+=end;
         counter++;
        }
     }
   Print("GetBid max bad time: ",DoubleToString(max_time/1000.0,3)," ms; avr bad time: ",counter ? DoubleToString(avr_time/1000.0/counter,3):"0"," ms; bad iterations: ",counter," total iterations: ",count);
  }

20 Expert Advisors auf EURUSD, d.h. alle OnTick-Prozesse gleichzeitig. Die Bauart des Terminals ist 2664. Der Test läuft ohne Optimierung, Kompilierung und andere zusätzliche Belastung bei 100 % CPU - Sie werden doch nicht einen echten "hft"-Handel auf diesem Hintergrund durchführen, oder?

Typisches Testprotokoll:

2020.10.29 11:10:49.133 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 28.004 ms; avr bad time: 0.393 ms; bad iterations: 1569 total iterations: 100000
2020.10.29 11:10:49.136 SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 4.795 ms; avr bad time: 0.361 ms; bad iterations: 1783 total iterations: 100000
2020.10.29 11:10:49.137 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 25.367 ms; avr bad time: 0.425 ms; bad iterations: 1496 total iterations: 100000
2020.10.29 11:10:49.138 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 2.681 ms; avr bad time: 0.352 ms; bad iterations: 1804 total iterations: 100000
2020.10.29 11:10:49.139 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 4.264 ms; avr bad time: 0.370 ms; bad iterations: 1734 total iterations: 100000
2020.10.29 11:10:49.142 SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 7.049 ms; avr bad time: 0.362 ms; bad iterations: 1803 total iterations: 100000
2020.10.29 11:10:49.142 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 13.376 ms; avr bad time: 0.365 ms; bad iterations: 1754 total iterations: 100000
2020.10.29 11:10:49.144 SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 18.048 ms; avr bad time: 0.417 ms; bad iterations: 1516 total iterations: 100000
2020.10.29 11:10:49.144 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 21.280 ms; avr bad time: 0.372 ms; bad iterations: 1769 total iterations: 100000
2020.10.29 11:10:53.837 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.631 ms; avr bad time: 0.143 ms; bad iterations: 205 total iterations: 100000
2020.10.29 11:10:53.837 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.517 ms; avr bad time: 0.134 ms; bad iterations: 170 total iterations: 100000
2020.10.29 11:10:53.837 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.483 ms; avr bad time: 0.144 ms; bad iterations: 178 total iterations: 100000
2020.10.29 11:10:53.838 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.517 ms; avr bad time: 0.147 ms; bad iterations: 182 total iterations: 100000
2020.10.29 11:10:53.844 SymbolInfoTick (EURUSD,H1)      SymbolInfoTick max bad time: 0.582 ms; avr bad time: 0.134 ms; bad iterations: 165 total iterations: 100000
2020.10.29 11:10:53.845 SymbolInfoTick (EURUSD,H1)      SymbolInfoTick max bad time: 0.518 ms; avr bad time: 0.137 ms; bad iterations: 195 total iterations: 100000
2020.10.29 11:10:53.845 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.530 ms; avr bad time: 0.139 ms; bad iterations: 160 total iterations: 100000
2020.10.29 11:10:53.846 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.575 ms; avr bad time: 0.138 ms; bad iterations: 143 total iterations: 100000
2020.10.29 11:10:53.848 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.593 ms; avr bad time: 0.143 ms; bad iterations: 206 total iterations: 100000
2020.10.29 11:10:53.849 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.446 ms; avr bad time: 0.138 ms; bad iterations: 147 total iterations: 100000
2020.10.29 11:10:53.850 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.661 ms; avr bad time: 0.146 ms; bad iterations: 191 total iterations: 100000
2020.10.29 11:10:53.850 SymbolInfoTick (EURUSD,H1)      SymbolInfoTick max bad time: 0.471 ms; avr bad time: 0.141 ms; bad iterations: 219 total iterations: 100000
2020.10.29 11:10:53.851 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.442 ms; avr bad time: 0.137 ms; bad iterations: 198 total iterations: 100000
2020.10.29 11:10:53.851 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.574 ms; avr bad time: 0.140 ms; bad iterations: 215 total iterations: 100000
2020.10.29 11:10:53.853 SymbolInfoTick (EURUSD,H1)      SymbolInfoTick max bad time: 0.507 ms; avr bad time: 0.140 ms; bad iterations: 222 total iterations: 100000
2020.10.29 11:10:53.857 SymbolInfoTick (EURUSD,H1)      SymbolInfoTick max bad time: 0.776 ms; avr bad time: 0.165 ms; bad iterations: 341 total iterations: 100000
2020.10.29 11:10:53.858 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.568 ms; avr bad time: 0.156 ms; bad iterations: 381 total iterations: 100000
2020.10.29 11:10:53.860 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.896 ms; avr bad time: 0.164 ms; bad iterations: 293 total iterations: 100000
2020.10.29 11:10:53.861 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 6.124 ms; avr bad time: 0.178 ms; bad iterations: 219 total iterations: 100000
2020.10.29 11:10:53.862 SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 0.794 ms; avr bad time: 0.164 ms; bad iterations: 356 total iterations: 100000
2020.10.29 11:10:54.686 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 4.870 ms; avr bad time: 0.339 ms; bad iterations: 1575 total iterations: 100000
2020.10.29 11:10:54.728 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 6.442 ms; avr bad time: 0.343 ms; bad iterations: 1691 total iterations: 100000
2020.10.29 11:10:54.732 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 7.568 ms; avr bad time: 0.349 ms; bad iterations: 1671 total iterations: 100000
2020.10.29 11:10:54.755 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 13.354 ms; avr bad time: 0.365 ms; bad iterations: 1634 total iterations: 100000
2020.10.29 11:10:54.773 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 9.385 ms; avr bad time: 0.352 ms; bad iterations: 1734 total iterations: 100000
2020.10.29 11:10:54.778 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 2.526 ms; avr bad time: 0.342 ms; bad iterations: 1748 total iterations: 100000
2020.10.29 11:10:54.785 SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 15.195 ms; avr bad time: 0.356 ms; bad iterations: 1708 total iterations: 100000
2020.10.29 11:10:54.790 SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 5.180 ms; avr bad time: 0.347 ms; bad iterations: 1796 total iterations: 100000
 
Anton:

Ein sehr einfacher Test:

20 EAs auf EURUSD, d.h. alle OnTick-Prozesse zur gleichen Zeit. Terminal-Build 2664. Der Test läuft ohne Optimierung, Kompilierung und andere zusätzliche Arbeitsbelastung auf 100% CPU - Sie werden doch nicht einen echten "hft"-Handel auf diesem Hintergrund durchführen, oder?

Typisches Testprotokoll:

Sie schaffen Treibhausbedingungen, indem Sie 100K Iterationen für 1,5 Sekunden auf demselben Tick durchführen. Ich hingegen habe absichtlich auf Ticks gewartet, die kein OnTick auslösten.

Wenn ich mir meine Handelsprotokolle ansehe, stelle ich fest, dass die SymbolInfoTick-Ausführung innerhalb weniger Millisekunden erfolgt. Und ich weiß zu 100%, dass die CPU zu diesem Zeitpunkt im Leerlauf war.


Es ist ganz einfach. Es gibt bedingt 1 Million Zecken pro Tag. Selbst eine Verlangsamung von 0,01 % der Ticks entspricht 100 Ticks pro Tag mit Verzögerungen. Sie werden sagen, dass das Unsinn ist. Ich würde sagen, es ist schlecht. Wenn ich bei einer Bestellung auf eine Verzögerung stoße, ist das ein potenzieller finanzieller Verlust.


Ich bin sehr dankbar, dass dieser Zweig nicht unbemerkt bleibt, und insbesondere an dieser Funktion wurde viel gearbeitet, um die Dinge zu beschleunigen. Allerdings war ich etwas überrascht, dass die schreckliche Krücke in bestimmten Situationen die normale Funktion übertreffen konnte. Und wenn Sie diese Verzögerung beseitigen würden, würden aus 100 potenziellen Verzögerungen pro Tag vielleicht 10 werden.


Ich sage, es ist viel besser als zu Beginn des Threads. Aber es gibt auch Zeiten, in denen das nicht gut ist. Und ich kann sehen, dass Sie sich nicht damit befassen wollen. Ich respektiere Ihre Entscheidung.


Oben wurde die Option "Snapshot" genannt , um aktuelle Preise zu erhalten. Es würde mir vollkommen genügen, wenn es auf dem Idle-CPU-Rechner nicht zu Verzögerungen im Millisekundenbereich käme.

Außerdem mache ich mir nicht nur Sorgen über die Geschwindigkeit von SymbolInfoTick, sondern auch über die Relevanz der zurückgegebenen Preise. Ich sehe, dass Sie sich diese Frage nicht stellen. Offensichtlich haben Sie beschlossen, sich das später anzusehen.

 
fxsaber:

Sie schaffen Treibhausbedingungen, indem Sie 100K Iterationen innerhalb von 1,5 Sekunden auf demselben Tick durchführen. Ich hingegen habe gezielt auf Ticks gewartet, die nicht OnTick auslösen.

Bei der Durchsicht meiner Handelsprotokolle stelle ich fest, dass SymbolInfoTick einige Millisekunden lang läuft. Ich weiß zu 100 %, dass die CPU in diesem Moment voll im Leerlauf war.

Es ist ganz einfach. An einem Tag gibt es bedingt 1 Million Zecken. Selbst eine Verzögerung von 0,01 % entspricht 100 Ticks pro Tag mit Verzögerungen. Sie werden sagen, dass das Unsinn ist. Ich würde sagen, es ist schlecht. Wenn ich bei einer Bestellung auf eine Verzögerung stoße, ist das ein potenzieller finanzieller Verlust.

Ich bin sehr dankbar, dass dieser Zweig nicht unbemerkt bleibt, und insbesondere an dieser Funktion wurde viel gearbeitet, um die Dinge zu beschleunigen. Allerdings war ich etwas überrascht, dass die schreckliche Krücke in bestimmten Situationen die normale Funktion übertreffen konnte. Und wenn Sie diese Verzögerung beseitigen würden, würden aus 100 potenziellen Verzögerungen pro Tag vielleicht 10 werden.

Ich sage, es ist viel besser als zu Beginn des Threads. Aber es gibt auch Zeiten, in denen das nicht gut ist. Und ich kann sehen, dass Sie sich nicht damit befassen wollen. Ich respektiere Ihre Entscheidung.

Oben wurde die Option "Snapshot" genannt , um aktuelle Preise zu erhalten. Es würde mir vollkommen genügen, wenn es auf dem Idle-CPU-Rechner nicht zu Verzögerungen im Millisekundenbereich käme.

Außerdem mache ich mir nicht nur Sorgen über die Geschwindigkeit von SymbolInfoTick, sondern auch über die Relevanz der zurückgegebenen Preise. Ich sehe, dass Sie sich diese Frage nicht stellen. Offensichtlich haben Sie beschlossen, sich das später anzusehen.

Das sind überhaupt keine warmen Bedingungen. Eine Schleife für 100000 Preisanfragen ohne Sleep() und dergleichen und in 20 Threads gleichzeitig ist ein offensichtlicher Stresstest. Nichts dergleichen dürfte unter realen Bedingungen auch nur annähernd möglich sein.

Wenn Sie glauben, dass in 1,5 Sekunden keine weiteren Ticks kommen - ok, machen Sie 10 Millionen Abfragen, es wird nichts ändern, Ihre "Krücke" funktioniert schlechter:
NG      0       10:26:22.903    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 2.223 ms; avr bad time: 0.146 ms; bad iterations: 22369 total iterations: 10000000
OK      0       10:26:22.934    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 1.759 ms; avr bad time: 0.144 ms; bad iterations: 22462 total iterations: 10000000
KO      0       10:26:22.944    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 4.587 ms; avr bad time: 0.145 ms; bad iterations: 22620 total iterations: 10000000
RS      0       10:26:23.443    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 8.433 ms; avr bad time: 0.162 ms; bad iterations: 36242 total iterations: 10000000
LG      0       10:26:23.487    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 9.660 ms; avr bad time: 0.163 ms; bad iterations: 36378 total iterations: 10000000
KH      0       10:26:23.492    SymbolInfoTick (EURUSD,H1)      SymbolInfoTick max bad time: 8.433 ms; avr bad time: 0.163 ms; bad iterations: 36208 total iterations: 10000000
HK      0       10:26:23.505    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 14.355 ms; avr bad time: 0.164 ms; bad iterations: 36292 total iterations: 10000000
QN      0       10:27:26.728    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 18.589 ms; avr bad time: 0.373 ms; bad iterations: 122026 total iterations: 10000000
HQ      0       10:27:27.042    SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 15.544 ms; avr bad time: 0.371 ms; bad iterations: 123026 total iterations: 10000000
RD      0       10:27:29.190    SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 16.207 ms; avr bad time: 0.370 ms; bad iterations: 127228 total iterations: 10000000
QJ      0       10:27:32.661    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 7.465 ms; avr bad time: 0.495 ms; bad iterations: 994 total iterations: 10000000
CL      0       10:27:32.799    SymbolInfoTick (EURUSD,H1)      SymbolInfoTick max bad time: 16.999 ms; avr bad time: 0.585 ms; bad iterations: 1081 total iterations: 10000000
EP      0       10:27:33.056    SymbolInfoTick (EURUSD,H1)      SymbolInfoTick max bad time: 11.774 ms; avr bad time: 0.515 ms; bad iterations: 1122 total iterations: 10000000
EE      0       10:27:33.555    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 17.385 ms; avr bad time: 0.368 ms; bad iterations: 134761 total iterations: 10000000
FG      0       10:27:35.581    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 10.428 ms; avr bad time: 0.502 ms; bad iterations: 373 total iterations: 10000000
CJ      0       10:27:46.372    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 14.278 ms; avr bad time: 0.360 ms; bad iterations: 153668 total iterations: 10000000
QO      0       10:27:46.819    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 12.494 ms; avr bad time: 0.361 ms; bad iterations: 154170 total iterations: 10000000
KP      0       10:27:46.897    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 17.176 ms; avr bad time: 0.362 ms; bad iterations: 154258 total iterations: 10000000
PE      0       10:27:47.560    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 14.090 ms; avr bad time: 0.362 ms; bad iterations: 156325 total iterations: 10000000
LF      0       10:27:47.946    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 16.794 ms; avr bad time: 0.367 ms; bad iterations: 160557 total iterations: 10000000
IH      0       10:27:47.970    SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 11.241 ms; avr bad time: 0.366 ms; bad iterations: 160307 total iterations: 10000000
KN      0       10:27:51.026    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 4.961 ms; avr bad time: 0.333 ms; bad iterations: 687 total iterations: 10000000
FP      0       10:27:51.517    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 19.844 ms; avr bad time: 0.372 ms; bad iterations: 165266 total iterations: 10000000
LE      0       10:27:51.574    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 15.435 ms; avr bad time: 0.371 ms; bad iterations: 165785 total iterations: 10000000
QE      0       10:27:51.686    SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 13.601 ms; avr bad time: 0.371 ms; bad iterations: 166278 total iterations: 10000000
CK      0       10:27:52.204    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 15.480 ms; avr bad time: 0.374 ms; bad iterations: 161441 total iterations: 10000000
FL      0       10:27:52.262    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 19.503 ms; avr bad time: 0.374 ms; bad iterations: 161363 total iterations: 10000000
FQ      0       10:27:52.504    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 15.440 ms; avr bad time: 0.375 ms; bad iterations: 161927 total iterations: 10000000
KQ      0       10:27:52.507    SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 20.155 ms; avr bad time: 0.375 ms; bad iterations: 161670 total iterations: 10000000
EG      0       10:27:52.558    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 15.634 ms; avr bad time: 0.371 ms; bad iterations: 167511 total iterations: 10000000
OK      0       10:27:52.751    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 14.698 ms; avr bad time: 0.368 ms; bad iterations: 168482 total iterations: 10000000
LL      0       10:27:53.941    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 16.659 ms; avr bad time: 0.364 ms; bad iterations: 171194 total iterations: 10000000
JP      0       10:27:58.244    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 12.019 ms; avr bad time: 0.308 ms; bad iterations: 970 total iterations: 10000000
OD      0       10:27:58.879    SymbolInfoTick (EURUSD,M15)     SymbolInfoTick max bad time: 7.972 ms; avr bad time: 0.299 ms; bad iterations: 1094 total iterations: 10000000
CE      0       10:28:06.402    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 14.140 ms; avr bad time: 0.342 ms; bad iterations: 56289 total iterations: 10000000
EK      0       10:28:06.860    SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 14.013 ms; avr bad time: 0.344 ms; bad iterations: 56008 total iterations: 10000000
QL      0       10:28:06.922    SymbolInfoTick (EURUSD,H1)      GetBid max bad time: 11.626 ms; avr bad time: 0.343 ms; bad iterations: 56676 total iterations: 10000000
ER      0       10:28:07.010    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 13.021 ms; avr bad time: 0.340 ms; bad iterations: 51610 total iterations: 10000000
ER      0       10:28:08.708    SymbolInfoTick (EURUSD,M15)     GetBid max bad time: 2.970 ms; avr bad time: 0.317 ms; bad iterations: 24083 total iterations: 10000000

Diese Ihre Aussage ist zu 100 % falsch:

Просматривая логи своей торговли, замечаю исполнение SymbolInfoTick в течение нескольких миллисекунд. При этом на 100% знаю, что в этот момент был полный Idle CPU.

Genau wie Ihre vorherige Aussage:

Уверен, что могу доказать, что получение текущих цен у Вас реализовано очень медленно. И CPU-нагрузка создает такие тормоза только из-за неправильной реализации Вами самой главной функции в MQL5.

Der Zugriff auf Preise über SymbolInfoTick ist jetzt sehr schnell und vollständig von der Verarbeitung des Tick-Streams entkoppelt. Sie arbeiten mit einem vorgefertigten Preis-Cache, der sehr sparsam und schnell aktualisiert wird.

Alle "Verlangsamungen der Tickrate um 0,01 %" treten nur unter Stresstestbedingungen auf, und das ist ein großartiges Ergebnis. Unter normalen Bedingungen ist ein sehr schneller Zugriff gewährleistet.

Wenn Sie zugeben, dass "eine Menge Arbeit getan wurde, um SymbolInfoTick zu beschleunigen", dann sollten Sie mir glauben, dass die "Krücke", Preise über PositionSelectByTicket zu erhalten, keine bessere Lösung sein kann.

Aus einem einfachen Grund - die Implementierung von PositionSelectByTicket ist völlig identisch mit der ursprünglichen "langsamen" Implementierung von SymbolInfoTick.

Wie ich oben geschrieben habe, ist diese Implementierung nicht langsam im wörtlichen Sinne des Wortes, aber unter hoher CPU-Last hat sie eine höhere Wahrscheinlichkeit von Laufzeitausreißern (was in meinem letzten Test deutlich sichtbar ist).

Die Zeitangaben sind hier stark vom System-Task-Scheduler abhängig, der unter Last läuft, d.h. es kann Unterschiede von Betriebssystem zu Betriebssystem und sogar von Version zu Version geben.

Und je höher die Belastung ist, desto mehr testen Sie die Leistung des Task-Planers und nicht des Terminals.

Das ist das Ende des Themas der SymbolInfoTick-Leistung.

Wenn Ihre Experten eine Belastung auf dem Niveau von synthetischen Stresstests erzeugen, gibt es nur eine Lösung: "Das Eisen muss zu den Aufgaben passen".

 

Ich habe eine Frage zur Relevanz der von SymbolInfoTick angegebenen Ticks.

Situation:

1. Wir machen TimeCurretn(); wir erhalten die Zeit 18:00:00

2. SymbolInfoTick bei einem ungültigen Symbol ausführen. Wir erhalten ein Häkchen mit der Zeit 17:58:00.

3. schlafen(1)

4. Fügt einen SymbolInfoTick für das nicht linke Symbol hinzu. Wir erhalten ein Häkchen mit der Uhrzeit 17:59:00.


D.h., im vierten Element haben wir einen neuen Tick, der eine Minute anders ist als TimeCurretn().

Sehen Sie in dieser Situation ein Problem?

Wie kommt man seltener in diese Situation?

 
pivomoe:

Ich habe eine Frage zur Relevanz der von SymbolInfoTick angegebenen Ticks.

Situation:

1. Wir machen TimeCurretn(); wir erhalten die Zeit 18:00:00

2. SymbolInfoTick für ein nicht beschriftetes Symbol ausführen. Wir erhalten ein Häkchen mit der Zeit 17:58:00.

3. schlafen(1)

4. Fügt einen SymbolInfoTick für das nicht linke Symbol hinzu. Wir erhalten ein Häkchen mit der Uhrzeit 17:59:00.


D.h., im vierten Element haben wir einen neuen Tick, der eine Minute anders ist als TimeCurretn().

Sehen Sie in dieser Situation ein Problem?

Wie kommt man seltener in diese Situation?

SymbolInfoTick sendet die vom Broker-Server empfangenen Daten. Was der Server sendet, ist das, was Sie bekommen.

Wenn Sie Fragen zum Tick-Stream haben, der von Ihrem Broker übertragen wird, müssen Sie sich an Ihren Broker wenden.