MT4 se bloque, n'appelle pas start() à nouveau - page 4

 

Je suis d'accord avec Raptor, la seule façon pour que quelqu'un puisse vraiment aider est que vous postiez le code pertinent, sinon c'est comme prendre des coups dans le noir.

 

Je suis désolé, je ne peux pas poster le code. Il fait 72 pages et c'est le code d'un produit, que je vais publier.

En attendant, j'ai implémenté les appels de logs, que WHRoeder a suggéré dans sa première réponse,

en écrivant des informations de débogage, qui peuvent être visualisées par dbgView de Microsoft.

Ces informations de débogage sont exactement les mêmes que mes propres informations de débogage, ce qui montre,

que nous pouvons faire confiance à ce que nous voyons dans les fichiers de log.

Maintenant, le fichier journal nous dit que start() est sorti, mais qu'il n'est plus déclenché.

Il semble que cela soit lié à la quantité de travail effectuée dans CreateHistory(), qui est appelé dans start().

Lorsque j'appelle le même CreateHistory() dans init(), exactement la même quantité de travail est effectuée sans aucun problème.

Pouvons-nous demander à un développeur MT4 d'examiner ce problème ?

Où puis-je trouver plus d'informations sur un crash MT4 (la version EA de mon indicateur plante MT4) ?

Je n'ai rien vu dans l'observateur d'événements de Windows.

 

Quand j'ai dit de poster le code pertinent, je ne voulais pas dire tout le code, je voulais dire ce que tu as changé ou ajouté depuis la dernière fois qu'il a fonctionné avec succès ? Je suppose que tu n'as pas écrit 72 pages de code sans aucun test en cours de route...

 

Ce que j'ai changé, c'est que j'ai déplacé CreateHistory() de init() à start().

La situation actuelle est la suivante :

Lorsque j'appelle CreateHistory() dans start sans aucun délai : cela fonctionne bien.

Lorsque j'appelle CreateHistory() dans start avec un délai >= 1 sec : MT4 se bloque.

Cependant, ce n'est pas CreateHistory() qui se bloque, c'est la fonction start().

Voici le code de la fonction start() :

int start()
  {     
   int TFInd;
   int k;  
   
   if (CheckDebug(DebugStart, 2))
      {
         DebugStr = "DebugStart: " + "begin ---------------------------------------: ";
         PrintDebug(DebugFile, DebugStr);
      }

      
   for (IndexCount = 1; IndexCount <= MaxIndices; IndexCount++)
      {
         if (CheckDebug(DebugStart, 2))
            {
               DebugStr = "DebugStart: " + "in loop +++++++++++++: "+ "IndexCount: "+ IndexCount;
               PrintDebug(DebugFile, DebugStr);
            }              
      
         if (MyCurrencyIndices[IndexCount] == 0)
            break;

         CurrencyIndex = MyCurrencyIndices[IndexCount];             

         CurrencyIndexStr = Prefix + CurrencyNames[CurrencyIndex];
                 
         if (!HistoryCreated[CurrencyIndex] && (TimeLocal() >= IndiStartTime + 0))                                                  // yyy
            {                     
               FileSeek(FileHandle[CurrencyIndex, TimeFrameM15] , HeaderFilePointer[CurrencyIndex, TimeFrameM15] , SEEK_SET);
               FileSeek(FileHandle[CurrencyIndex, TimeFrameH1] , HeaderFilePointer[CurrencyIndex, TimeFrameH1] , SEEK_SET);
               FileSeek(FileHandle[CurrencyIndex, TimeFrameH4] , HeaderFilePointer[CurrencyIndex, TimeFrameH4] , SEEK_SET);
               FileSeek(FileHandle[CurrencyIndex, TimeFrameD1] , HeaderFilePointer[CurrencyIndex, TimeFrameD1] , SEEK_SET);

               CreateHistory();
               HistoryCreated[CurrencyIndex] = true;    
            }                           
      }  

   if (CheckDebug(DebugStart, 2))
      {
         DebugStr = "DebugStart: " + "returning ...";
         PrintDebug(DebugFile, DebugStr);
      }
                          
   return(0);
  }

Vous trouverez ci-dessous 2 fichiers log :

un pour le code ci-dessus avec TimeLocal() >= IndiStartTime + 0 (fonctionne correctement), un pour le code ci-dessus avec TimeLocal() >= IndiStartTime + 1 (se bloque).

Dans le dernier cas, CreateHistory() fonctionne et renvoie correctement.

Elle est appelée une seule fois dans start().

Rien d'autre n'est fait dans start(), néanmoins start() n'est jamais appelé à nouveau par MT4 et MT4 se bloque, consommant le CPU.

CreateHistory() déclenche 80% de mon code.

Je ne peux pas l'afficher.

fichier journal pour un délai de 0 sec :

2013.12.04 12:34:10 Test réduit : USDJPY M15 Debug Init() begin :
2013.12.04 12:34:10 Test réduit : USDJPY M15 Debug Init() return :
2013.12.04 12:34:10 Test réduit : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:34:10 Test réduit : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1 <----------- CreateHistory() est appelé immédiatement.
2013.12.04 12:34:10 Test réduit : USDJPY M15 Debug CreateHistoryTimeFrame(), start : CurrencyIndex : 1 TF : 1 ShiftsArray[1, TF] : 4996 TheShift : 0
2013.12.04 12:34:10 Test réduit : USDJPY M15 Debug CreateHistoryTimeFrame(), retour final : CurrencyIndex : 1 TF : 1
04.12.2013 12:34:10 Test réduit : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
04.12.2013 12:34:10 Test réduit : USDJPY M15 DebugStart : retour ...
04.12.2013 12:34:11 Test réduit : USDJPY M15 DebugStart : begin --------------------------------------- : <------------ start() se déclenche à plusieurs reprises.
2013.12.04 12:34:11 Test réduit : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
04.12.2013 12:34:11 Test réduit : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
04.12.2013 12:34:11 Test réduit : USDJPY M15 DebugStart : retour ...
2013.12.04 12:34:11 Test réduit : USDJPY M15 DebugStart : commencer --------------------------------------- :
2013.12.04 12:34:11 Test réduit : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:34:11 Test réduit : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
04.12.2013 12:34:11 Test réduit : USDJPY M15 DebugStart : retour ...

log file for 1 sec delay :

2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 Debug Init() begin :
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 Debug Init() return :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : returning ...
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 2
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : returning ...
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 2
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : returning ...
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : returning ...
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : returning ...
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : returning ...
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : returning ...
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : returning ...
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:17 Test réduit 0 : USDJPY M15 DebugStart : dans la boucle +++++++++++++ : IndexCount : 2
2013.12.04 12:32:17 Test reduced 0 : USDJPY M15 DebugStart : returning ...
2013.12.04 12:32:18 Test reduced 0 : USDJPY M15 DebugStart : begin --------------------------------------- :
2013.12.04 12:32:18 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 1
2013.12.04 12:32:18 Test réduit 0 : USDJPY M15 Debug CreateHistoryTimeFrame(), start : CurrencyIndex : 1 TF : 1 ShiftsArray[1, TF] : 4996 TheShift : 0 <----------- après 1 sec CreateHistory() est appelé
2013.12.04 12:32:18 Test réduit 0 : USDJPY M15 Debug CreateHistoryTimeFrame(), retour final : CurrencyIndex : 1 TF : 1
2013.12.04 12:32:18 Test réduit 0 : USDJPY M15 DebugStart : in loop +++++++++++++ : IndexCount : 2
2013.12.04 12:32:18 Test reduced 0 : USDJPY M15 DebugStart : returning ... <---------- start() is never triggerd again

 
J'ai l'impression de jouer à cache-cache. Pour l'instant, je soupçonne fortement que votre fonction CreateHistory() écritde façon répétée dans les fichiers .hst actifs. Ai-je raison ?
 

CreateHistory() crée des graphiques hors ligne, en écrivant dans des fichiers .hst.

Elle n'écrit PAS dans les fichiers .hst actifs.

 
mt4forum:

CreateHistory() crée des graphiques hors ligne, en écrivant dans des fichiers .hst.

Elle n'écrit PAS dans les fichiers .hst actifs.

Comment pouvez-vous vous assurer que c'est bien le cas ?
 
RaptorUK:
Comment pouvez-vous vous assurer que c'est le cas ?

   CurrencyIndexStr = "CI_EUR";  

   FileName = CurrencyIndexStr + ThePeriod + ".hst";
   FileHandle = FileOpenHistory(FileName, FILE_BIN|FILE_WRITE);  

Il n'y a pas d'instrument MT4 nommé CI_EUR.

 
mt4forum:

Il n'existe pas d'instrument MT4 nommé CI_EUR.

OK