MT4 se cuelga, no vuelve a llamar a start()

 

Hola,

Me estoy enfrentando a un problema feo:

después de unas cuantas iteraciones la función start() de mi indicador no vuelve a aparecer después de la llamada a return(), es decir, MT4 se cuelga en un bucle, consumiendo CPU, sin llamar de nuevo a start().

Me pregunto si de alguna manera he destruido la pila de llamadas a la función.

¿Qué sugieres que debería buscar principalmente para encontrar la causa?

Ya he estado depurando toda la semana. Son 72 páginas de código.

No estoy usando ninguna llamada DLL, sólo MQL plano.

Gracias.

 
No está regresando desde el inicio. Necesitas arreglar tu código. Obtenga dbgView y agregue llamadas de registro al inicio y al retorno de cada función y rastree su bucle infinito.
 

Ya estoy registrando la información de depuración.

No veo un bucle indefinido.

Lo último que veo en el archivo de registro es cuando llamo a return() en la última línea de start().

A partir de ahí start() no vuelve a activarse.

Debe ser otra cosa.

 
¿Registro de dónde/cómo? NO puede usar Print/Alert porque está colgando el hilo de la GUI, la salida no se escribirá.
 

Lo sé, estoy usando mi propia función PrintDebug() con FileWrite(), FileFlush.

 

¿Crees que mi forma de imprimir la información de depuración es suficiente?

 
mt4forum:

Ya estoy registrando la información de depuración.

No veo un bucle indefinido.

Lo último que veo en el archivo de registro es cuando llamo a return() en la última línea de start().

A partir de ahí start() no vuelve a activarse.

Debe ser otra cosa.


¿ Imprime algo en el registro como primera línea de start() ?
 

Sí, estoy registrando la primera y la última línea.

¿Puedo estar seguro de que mi forma de registrar no pierde ninguna información de registro?

 
mt4forum:

Sí, estoy registrando la primera y la última línea.

¿Puedo estar seguro de que mi forma de registrar no pierde ninguna información de registro?

Si no está seguro, utilice un Print() estándar y compruebe el archivo de registro, no sólo la pestaña de expertos. . no hemos visto su forma de registro.

¿Utiliza algún indicador a través de las llamadas de iCustom()? . .
 

Aquí está mi función de registro:

void PrintDebug(int F, string DebugStr1, string DS2 = "", string DS3 = "", string DS4 = "", string DS5 = "", string DS6 = "", string DS7 = "", 
   string DS8 = "", string DS9 = "", string DS10 = "", string DS11 = "", string DS12 = "", string DS13 = "", string DS14 = "", string DS15 = "", 
   string DS16 = "", string DS17 = "", string DS18 = "", string DS19 = "", string DS20 = "")
{
   FileWrite(F, CommonIdentStr() + Blank + DebugStr1 + DS2 + DS3 + DS4 + DS5 + DS6 + DS7 + DS8 + DS9 + DS10 
               + DS11 + DS12 +DS13 + DS14 + DS15 + DS16 + DS17 + DS18 + DS19 + DS20);
   FileFlush(F);
}

Y aquí está mi función de inicio:

int start()
  {     
   int TFInd;
   int k;  
   
   if (CheckDebug(DebugStart, 2))
      {
         DebugStr = "DebugStart: " + "begin: " + " InitialGapFound: " + BoolToString(InitialGapFound);
         PrintDebug(DebugFile, DebugStr);
      }
   
   if (InitialGapFound)        
      {                                             
         if (TimeLocal() >= LastInitialGapCloseCheck + HistoryDownloadCheckInterval)                                  // zzz
            {
               LastInitialGapCloseCheck = TimeLocal();
               
               if (InitialHistoryGapClosed())
                  {
                     if (CheckDebug(DebugStart, 2))
                        {
                           DebugStr =  "DebugStart: " + " InitialHistoryGapClosed ";
                           PrintDebug(DebugFile, DebugStr);
                        }
                  
                     ReInit = true;
                     InitialGapFound = false;

                     MyInit();
                  }        
            }

         if (CheckDebug(DebugStart, 2))
            {
               DebugStr = "DebugStart: " + " last return in InitialGapFound";
               PrintDebug(DebugFile, DebugStr);
            } 
            
         return(OK);
      
      }  // if InitialGapFound

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

Estoy registrando el inicio del inicio y el final.

La función CheckDebug() no tiene ninguna influencia, ya que siempre devuelve true.

El siguiente es el archivo de registro generado.

Puedes ver que la última entrada es "DebugStart: last return in InitialGapFound", que es la última sentencia ejecutada en la función start().

La siguiente entrada en el archivo de registro debería ser "DebugStart: begin: ...", la primera sentencia de la función start().

Pero start() no se vuelve a activar. En su lugar MT4 se cuelga en un bucle.

No veo ningún bucle en la lógica de mi programa. No estoy usando DLLs, ni iCustom, ....

2013.11.15 12:33:14 Prueba reducida 0: USDJPY M15 Debug Init() comenzar:
2013.11.15 12:33:14 Prueba reducida 0: USDJPY M15 DebugMyInit comenzar:
2013.11.15 12:33:14 Prueba reducida 0: USDJPY M15 Debug Init() return:
2013.11.15 12:33:14 Prueba reducida 0: USDJPY M15 DebugStart: begin: InitialGapFound: True
2013.11.15 12:33:14 Prueba reducida 0: USDJPY M15 DebugStart: último retorno en InitialGapFound
2013.11.15 12:33:15 Prueba reducida 395052: USDJPY M15 DebugStart: begin: InitialGapFound: True
2013.11.15 12:33:15 Prueba reducida 395052: USDJPY M15 DebugStart: último retorno en InitialGapFound
2013.11.15 12:33:16 Prueba reducida 395052: USDJPY M15 DebugStart: begin: InitialGapFound: True
2013.11.15 12:33:16 Prueba reducida 395052: USDJPY M15 DebugStart: InitialHistoryGapClosed
2013.11.15 12:33:16 Prueba reducida 395052: USDJPY M15 DebugMyInit comenzar:
2013.11.15 12:33:16 Prueba reducida 395052: USDJPY M15 DebugMyInit InitialMyInitCalls: 0 IndexCount: 1 nach CreateHistory()
2013.11.15 12:33:17 Prueba reducida 395052: USDJPY M15 DebugMyInit InitialMyInitCalls: 0 IndexCount: 2 nach CreateHistory()
2013.11.15 12:33:18 Prueba reducida 395052: USDJPY M15 DebugMyInit InitialMyInitCalls: 0 IndexCount: 3 nach CreateHistory()
2013.11.15 12:33:19 Prueba reducida 395052: USDJPY M15 DebugMyInit InitialMyInitCalls: 0 IndexCount: 4 nach CreateHistory()
2013.11.15 12:33:20 Prueba reducida 395052: USDJPY M15 DebugMyInit InitialMyInitCalls: 0 IndexCount: 5 nach CreateHistory()
2013.11.15 12:33:21 Prueba reducida 395052: USDJPY M15 DebugMyInit InitialMyInitCalls: 0 IndexCount: 6 nach CreateHistory()
2013.11.15 12:33:22 Prueba reducida 395052: USDJPY M15 DebugMyInit InitialMyInitCalls: 0 IndexCount: 7 nach CreateHistory()
2013.11.15 12:33:22 Prueba reducida 395052: USDJPY M15 DebugMyInit return InitialMyInitCalls: 0 IndexCount: 8
2013.11.15 12:33:22 Prueba reducida 395052: USDJPY M15 DebugStart: último retorno en InitialGapFound

 
mt4forum:

Aquí está mi función de registro:

Y aquí está mi función de inicio:

Estoy registrando el inicio del inicio y el final.

La función CheckDebug() no tiene ninguna influencia, ya que siempre devuelve true.

El siguiente es el archivo de registro generado.

Puedes ver que la última entrada es "DebugStart: last return in InitialGapFound", que es la última sentencia ejecutada en la función start().

La siguiente entrada en el archivo de registro debería ser "DebugStart: begin: ...", la primera sentencia de la función start().

Pero start() no se vuelve a activar. En su lugar, MT4 se cuelga en un bucle.


Lo que está bien en...

      return(OK);


Supongamos que su depuración está causando el problema, por favor, añada lo siguiente después de las declaraciones de las variables en start() run y repórtese mostrando el registro y su extracto de registro como arriba. . .

int start()
  {     
   int TFInd;
   int k;  
   
   Print("start():  started . . .");  // <-----  add this line here
   
   if (CheckDebug(DebugStart, 2))
Razón de la queja: