MT4 si blocca, non chiama più start() - pagina 4

 

Sono d'accordo con Raptor, l'unico modo in cui qualcuno sarà davvero in grado di aiutare è se pubblichi il codice pertinente, altrimenti è come sparare nel buio.

 

Mi dispiace, non posso postare il codice. Sono 72 pagine ed è il codice di un prodotto, che rilascerò.

Nel frattempo ho implementato le chiamate di log, che WHRoeder ha suggerito nella sua prima risposta,

scrivendo informazioni di debug, che possono essere visualizzate da dbgView di Microsoft.

Queste informazioni di debug sono esattamente le stesse delle mie informazioni di debug, il che dimostra,

che possiamo fidarci di ciò che vediamo nei file di log.

Ora, il file di log ci dice che start() è uscito, ma non viene più attivato.

Sembra che questo abbia a che fare con la quantità di lavoro che viene fatto in CreateHistory(), che è chiamata all'interno di start().

Quando chiamo la stessa CreateHistory() in init(), esattamente la stessa quantità di lavoro viene fatta senza alcun problema.

Possiamo coinvolgere uno sviluppatore di MT4, per dare un'occhiata a questo?

Dove posso trovare ulteriori informazioni su un crash di MT4 (la versione EA del mio indicatore fa crashare MT4)?

Non ho potuto vedere nulla nel visualizzatore di eventi di Windows.

 

Quando ho detto di postare il codice rilevante non intendevo tutto, ma cosa hai cambiato o aggiunto dall'ultima volta che ha funzionato con successo? Presumo che tu non abbia scritto 72 pagine di codice senza alcun test lungo la strada ...

 

Quello che ho cambiato è: ho spostato CreateHistory() da init() a start().

La situazione attuale è la seguente:

Quando chiamo CreateHistory() in start senza alcun ritardo: funziona bene.

Quando chiamo CreateHistory() in start con un ritardo >= 1 sec: MT4 si blocca.

Tuttavia, non è CreateHistory() che si blocca, è la funzione start().

Ecco il codice di 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);
  }

Qui sotto ci sono 2 file di log:

uno per il codice sopra con TimeLocal() >= IndiStartTime + 0 (funziona bene), uno per il codice sopra con TimeLocal() >= IndiStartTime + 1 (si blocca).

Nell'ultimo caso CreateHistory() funziona e ritorna correttamente.

Viene chiamata solo una volta all'interno di start().

Nient'altro viene fatto in start(), tuttavia start() non viene mai richiamato da MT4 e MT4 si blocca, consumando la CPU.

CreateHistory() innesca l'80% del mio codice.

Non posso pubblicarlo.

file di log per 0 sec di ritardo:

2013.12.04 12:34:10 Test ridotto: USDJPY M15 Debug Init() begin:
2013.12.04 12:34:10 Test ridotto: USDJPY M15 Debug Init() ritorno:
2013.12.04 12:34:10 Test ridotto: USDJPY M15 DebugStart: inizio ---------------------------------------:
2013.12.04 12:34:10 Test ridotto: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1 <----------- CreateHistory() viene chiamata immediatamente
2013.12.04 12:34:10 Test ridotto: USDJPY M15 Debug CreateHistoryTimeFrame(), inizio: CurrencyIndex: 1 TF: 1 ShiftsArray[1, TF]: 4996 TheShift: 0
2013.12.04 12:34:10 Test ridotto: USDJPY M15 Debug CreateHistoryTimeFrame(), ritorno finale: CurrencyIndex: 1 TF: 1
2013.12.04 12:34:10 Test ridotto: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:34:10 Test ridotto: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:34:11 Test ridotto: USDJPY M15 DebugStart: inizia ---------------------------------------: <------------ start() viene attivato ripetutamente
2013.12.04 12:34:11 Test ridotto: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:34:11 Test ridotto: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:34:11 Test ridotto: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:34:11 Test ridotto: USDJPY M15 DebugStart: inizio ---------------------------------------:
2013.12.04 12:34:11 Test ridotto: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:34:11 Test ridotto: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:34:11 Test ridotto: USDJPY M15 DebugStart: ritorno ...

file di log per 1 sec di ritardo:

2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 Debug Init() begin:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 Debug Init() ritorno:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Test ridotto 0: USDJPY M15 DebugStart: ritorno ...
2013.12.04 12:32:18 Test ridotto 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:18 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:18 Test ridotto 0: USDJPY M15 Debug CreateHistoryTimeFrame(), start: CurrencyIndex: 1 TF: 1 ShiftsArray[1, TF]: 4996 TheShift: 0 <----------- dopo 1 sec Viene chiamata CreateHistory()
2013.12.04 12:32:18 Test ridotto 0: USDJPY M15 Debug CreateHistoryTimeFrame(), ritorno finale: CurrencyIndex: 1 TF: 1
2013.12.04 12:32:18 Test ridotto 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 2
2013.12.04 12:32:18 Test ridotto 0: USDJPY M15 DebugStart: ritorno ... <---------- start() non viene più attivato

 
Ho voglia di giocare a nascondino. In questo momento sono molto sospettoso che la tua funzione CreateHistory() scrivaripetutamente sui file .hst live. Ho ragione?
 

CreateHistory() crea grafici offline, scrivendo su file .hst.

NON scrive sui file .hst live.

 
mt4forum:

CreateHistory() crea grafici offline, scrivendo su file .hst.

NON scrive sui file .hst live.

Come ti assicuri che sia così?
 
RaptorUK:
Come ti assicuri che sia così?

   CurrencyIndexStr = "CI_EUR";  

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

Non esiste uno strumento MT4 chiamato CI_EUR.

 
mt4forum:

Non esiste uno strumento MT4 chiamato CI_EUR.

OK