Reading the speed of the strategy tester?

 

Aloha,

does somebody know if it´s possible to read the speed-value of the strategy tester? Or, if this is not possible, a way to get the real value of GetTickCount() from the Windows Kernel32.dll, because GetTickCount() is matched to the simulated server time in the strategy tester, but I would need the real value? Direct import via DLL is not possible, because of the reserved word GetTickCount in MT. I don´t want to code a separate DLL just because of this silly feature ...

Thanks

Doerk 

 
Doerk:

Aloha,

...Direct import via DLL is not possible, because of the reserved word GetTickCount in MT. I don´t want to code a separate DLL just because of this silly feature ...

Thanks

Doerk 

Yes it's possible with Scope Resolution Operator.
 
Yeah, thank you. Sometimes the answer is just in front of your eyes and one doesn´t recognize it ;) But reading the testers speed isn´t possible, right?
 
Doerk:
Yeah, thank you. Sometimes the answer is just in front of your eyes and one doesn´t recognize it ;) But reading the testers speed isn´t possible, right?
Unfortunately no, at least with mql4/5. Maybe with WINAPI but I never tried.
 
Well, the class name of the control with the slider is "msctls_trackbar32", this sounds like windows standard control library, so it should be possible. But it makes no difference if I use the Kernel32.dll or read this value, the sense was to avoid any DLL calls as far as possible. 
 

But the difference between two GetTickCount() call gives you the time between the generated ticks and that is independet of simulated time (at least on my MQL4 and MQL5 terminals).

This is a quick example. But I am curious what for do you need that values?

Uwe

uint oldtc;
int oldspeed;
int prevspeed;
int oldtrigger;

void OnTick()
{
   int newspeed = GetReplaySpeed();
   if (newspeed!=oldspeed)
   {
      if (oldtrigger==3) // prevent inbetween values
      {
         Print(newspeed);
         oldspeed=newspeed; 
         oldtrigger=0;       
      }
      if (newspeed==prevspeed) 
         oldtrigger++; 
      else 
         oldtrigger=0;
      prevspeed=newspeed;
   }
}

int GetReplaySpeed() // difference between to OnTick calls
{
   int speedval=32; // max speed
   uint tc = GetTickCount();
   uint diff = tc-oldtc;
   oldtc=tc;

   if (diff>16000) speedval=1;
   else if (diff>12000) speedval=2; 
   else if (diff>8000) speedval=3; 
   else if (diff>6000) speedval=4; 
   else if (diff>4000) speedval=5; 
   else if (diff>3000) speedval=6; 
   else if (diff>2000) speedval=7; 
   else if (diff>1500) speedval=8; 
   else if (diff>1000) speedval=9; 
   else if (diff>900) speedval=10; 
   else if (diff>820) speedval=11; 
   else if (diff>750) speedval=12;
   else if (diff>690) speedval=13; 
   else if (diff>630) speedval=14; 
   else if (diff>570) speedval=15; 
   else if (diff>510) speedval=16; 
   else if (diff>470) speedval=17;
   else if (diff>430) speedval=18;
   else if (diff>390) speedval=19;
   else if (diff>360) speedval=20;
   else if (diff>330) speedval=21;
   else if (diff>300) speedval=22;
   else if (diff>270) speedval=23;
   else if (diff>240) speedval=24;
   else if (diff>210) speedval=25;
   else if (diff>180) speedval=26;
   else if (diff>150) speedval=27;
   else if (diff>120) speedval=28;
   else if (diff>090) speedval=29;
   else if (diff>060) speedval=30;
   else if (diff>030) speedval=31;
   return(speedval);
}