GetTickCount()

 

Hi guys, in my indicator there are these program line:

 uint  Start=GetTickCount();

.

.

.

.

uint Fine =GetTickCount()-Start;


but Start and Fine are always equal zero.

Can you help me please?

Tank you for all help.

 
80613536:

Hi guys, in my indicator there are these program line:

 uint  Start=GetTickCount();

.

.

.

.

uint Fine =GetTickCount()-Start;


but Start and Fine are always equal zero.

Can you help me please?

Tank you for all help.

where is it in your code?  best if you put all the surrounding code here otherwise it's difficult to see context and the problem use ALT-S to add code

 

here there is the complete function:

void Cerca_Indice_Array(int rates_total, int prev_calculated, const double &high[], const double &low[], const double &close[], const long &volume[], const datetime &time[], const double &open[]){    

     uint StartTime=GetTickCount();

      Qnt_Symb=FileWrite(FileOUT,"  Start time di esecuzione in millisecondi", StartTime);   

     uint FinishTime;

     int c;

     for(c=1; c<4; c++){

        if(c==1){

          Prezzo_DC=PrezzoATT1;

          Nome_Att=OBJN1;

        } 

        if(c==2){

          Prezzo_DC=PrezzoATT2;

          Nome_Att=OBJN2;

        }   

        if(c==3){

          Prezzo_DC=PrezzoATT3;

          Nome_Att=OBJN3;

        } 

        Parte_Intera=MathFloor(Prezzo_DC*100000);

        Nome_Oggetto= StringToDouble(Nome_Att)/MathPow(10,10); 

        SommaDouble=(Parte_Intera/100000)+Nome_Oggetto;

        Qnt_Symb=FileWrite(FileOUT," Cerca Indice_Array Prezzo_DC ",Prezzo_DC, " Nome_Att ", Nome_Att, " SommaDouble ", SommaDouble, " Parte_Intera ", Parte_Intera, " Nome_Oggetto ", Nome_Oggetto);

        ArraySort(att);

        Indice_Array=ArrayBsearch(att,SommaDouble,WHOLE_ARRAY,0,MODE_ASCEND);

        Qnt_Symb=FileWrite(FileOUT," dispaly elemento att(indice_Array) ",att[Indice_Array], " indice_Array ", Indice_Array);

        Cancella_Array(rates_total, prev_calculated, high, low, close, volume, time, open);

    } 

    FinishTime=GetTickCount();

    Qnt_Symb=FileWrite(FileOUT," Tempo di esecuzione in millisecondi StartTime", StartTime, " FinishTime ",FinishTime, " - ", (FinishTime-StartTime));     

}   

tank you for help.

 
80613536:

here there is the complete function:

tank you for help.

Hello,

where is this line in your code?


Line missing.... problem missing!

uint Fine =GetTickCount()-Start;
 

Will work most of the time, except for the rare instance that the timer rolls over. Encapsulated as a class:

class Duration{
   //{Typedef
   #define TICK_COUNT uint
      #define TICK_COUNT_MAX UINT_MAX
   //}Typedef
 public:                                                                //[cTor]
               Duration(void)  : myTickCount(GetTickCount()){}
 public:                                                             // Methods
   void        reset(void){      myTickCount = GetTickCount();                 }
   TICK_COUNT  get_ms(void){
      // Counter is limited by the restrictions of the system timer. Time is
      // stored as an unsigned integer, so it's overfilled every 49.7 days if a
      // computer works uninterruptedly.
      long     delay = (long)GetTickCount() - (long)myTickCount;
      if (delay < 0) delay += long(TICK_COUNT_MAX) + 1;     // GTC rolled over.
      return (TICK_COUNT)delay;
   }
 private:                                                            // Data
   TICK_COUNT  myTickCount;
}; // class Duration
////////////////////////////////////////////////
Duration Start();
⋮
uint Fine = Start.get_ms();