MT4 se cuelga, no vuelve a llamar a start() - página 4

 

Estoy de acuerdo con Raptor, la única manera de que alguien realmente va a ser capaz de ayudar es si usted publica el código relevante de lo contrario es como sólo tomar fotos en la oscuridad.

 

Lo siento, no puedo publicar el código. Son 72 páginas y es el código de un producto, que publicaré.

Mientras tanto, he implementado las llamadas de registro, que WHRoeder sugirió en su primera respuesta,

escribiendo información de depuración, que puede ser vista por el dbgView de Microsoft.

Esta información de depuración es exactamente la misma que mi propia información de depuración, lo que demuestra

que podemos confiar en lo que vemos en los archivos de registro.

Ahora, el archivo de registro nos dice, que start() se sale, pero no se dispara más.

Parece que esto tiene que ver con la cantidad de trabajo que se hace en CreateHistory(), que se llama dentro de start().

Cuando llamo al mismo CreateHistory() en init(), se realiza exactamente la misma cantidad de trabajo sin ningún problema.

¿Podemos involucrar a un desarrollador de MT4, para que vea esto?

¿Dónde puedo encontrar más información acerca de una caída de MT4 (la versión EA de mi indicador se bloquea en MT4)?

No he podido ver nada en el visor de eventos de Windows.

 

Cuando dije que publicaras el código relevante no me refería a todo, sino a lo que cambiaste o añadiste desde la última vez que se ejecutó con éxito. Asumo que no escribiste 72 páginas de código directo sin ninguna prueba en el camino ...

 

Lo que he cambiado es: he movido CreateHistory() de init() a start().

La situación actual es la siguiente:

Cuando llamo a CreateHistory() en start sin ningún retardo: funciona bien.

Cuando llamo a CreateHistory() en start con un retraso >= 1 seg: MT4 se cuelga.

Sin embargo, no es CreateHistory() la que se cuelga, es la función start().

Aquí está el código de 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);
  }

Abajo hay 2 archivos de registro:

uno para el código anterior con TimeLocal() >= IndiStartTime + 0 (funciona bien), otro para el código anterior con TimeLocal() >= IndiStartTime + 1 (se cuelga).

En el último caso CreateHistory() funciona y devuelve correctamente.

Se llama sólo una vez dentro de start().

No se hace nada más en start(), sin embargo start() nunca es llamado de nuevo por MT4 y MT4 se cuelga, consumiendo CPU.

CreateHistory() activa el 80% de mi código.

No puedo publicarlo.

archivo de registro para 0 segundos de retraso:

2013.12.04 12:34:10 Prueba reducida: USDJPY M15 Debug Init() comenzar:
2013.12.04 12:34:10 Prueba reducida: USDJPY M15 Debug Init() retorno:
2013.12.04 12:34:10 Prueba reducida: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:34:10 Prueba reducida: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1 <----------- CreateHistory() se llama inmediatamente
2013.12.04 12:34:10 Prueba reducida: USDJPY M15 Debug CreateHistoryTimeFrame(), inicio: CurrencyIndex: 1 TF: 1 ShiftsArray[1, TF]: 4996 TheShift: 0
2013.12.04 12:34:10 Prueba reducida: USDJPY M15 Debug CreateHistoryTimeFrame(), retorno final: CurrencyIndex: 1 TF: 1
2013.12.04 12:34:10 Prueba reducida: USDJPY M15 DebugStart: en el bucle +++++++++++++: IndexCount: 2
2013.12.04 12:34:10 Prueba reducida: USDJPY M15 DebugStart: devolviendo ...
2013.12.04 12:34:11 Prueba reducida: USDJPY M15 DebugStart: begin ---------------------------------------: <------------ start() se dispara repetidamente
2013.12.04 12:34:11 Prueba reducida: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:34:11 Prueba reducida: USDJPY M15 DebugStart: en el bucle +++++++++++++: IndexCount: 2
2013.12.04 12:34:11 Prueba reducida: USDJPY M15 DebugStart: devolviendo ...
2013.12.04 12:34:11 Prueba reducida: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:34:11 Prueba reducida: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:34:11 Prueba reducida: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:34:11 Prueba reducida: USDJPY M15 DebugStart: devolviendo ...

archivo de registro para 1 segundo de retraso:

2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 Debug Init() begin:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 Debug Init() return:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: begin ---------------------------------------:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: in loop +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ...
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ...
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ...
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ...
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ...
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ...
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ...
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ...
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:17 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ...
2013.12.04 12:32:18 Prueba reducida 0: USDJPY M15 DebugStart: comenzar ---------------------------------------:
2013.12.04 12:32:18 Prueba reducida 0: USDJPY M15 DebugStart: en bucle +++++++++++++: IndexCount: 1
2013.12.04 12:32:18 Prueba reducida 0: USDJPY M15 Debug CreateHistoryTimeFrame(), start: CurrencyIndex: 1 TF: 1 ShiftsArray[1, TF]: 4996 TheShift: 0 <----------- después de 1 segundo se llama CreateHistory()
2013.12.04 12:32:18 Prueba reducida 0: USDJPY M15 Debug CreateHistoryTimeFrame(), retorno final: CurrencyIndex: 1 TF: 1
2013.12.04 12:32:18 Prueba reducida 0: USDJPY M15 DebugStart: en el bucle +++++++++++++: IndexCount: 2
2013.12.04 12:32:18 Prueba reducida 0: USDJPY M15 DebugStart: volviendo ... <---------- start() no se dispara nunca más

 
Tengo ganas de jugar al escondite. Ahora mismo tengo muchas sospechas de que su función CreateHistory() escriberepetidamente en los archivos .hst vivos. ¿Estoy en lo cierto?
 

CreateHistory() crea gráficos fuera de línea, escribiendo en archivos .hst.

NO escribe en los archivos .hst en vivo.

 
mt4forum:

CreateHistory() crea gráficos fuera de línea, escribiendo en archivos .hst.

NO escribe en los archivos .hst en vivo.

¿Cómo se asegura de que esto sea así?
 
RaptorUK:
Cómo se puede asegurar que este es el caso?

   CurrencyIndexStr = "CI_EUR";  

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

No hay ningún instrumento MT4 llamado CI_EUR.

 
mt4forum:

No hay ningún instrumento MT4 llamado CI_EUR.

OK
Razón de la queja: