Libraries: AccurateTimer - page 2

 
Maxim Kuznetsov:

all of the above are different timers. On a loaded machine, the differences will be significant and natural

With a bibilio library there will be no discrepancies.

 
Maxim Kuznetsov:

all of the above are different timers. On a loaded machine, the differences will be significant and natural

What is the contradiction?

The library was written to remove these "natural" discrepancies.

 
Andrey Khatimlianskii:

What's the contradiction?

The library was written to remove these "natural" discrepancies.

They measure different things.
 
Maxim Kuznetsov:
they measure different things.

Take some kind of ticker symbol as a benchmark. For example, your wristwatch. See how different the time on your computer an hour from now (according to the ticker) will be from the benchmark. Of course, there will be differences.

But differences are learnt by comparison. Take a second timer or a 100ms timer. And see what will be the differences again with the standard after 3600 "seconds" of the standard and 3600 "seconds" of the timer.

 
Maxim Kuznetsov:
they're measuring different things.

What difference does it make what they measure?

There is a task to perform an action every X ms, and you can't do it with a regular timer because of the peculiarities of its implementation.

The library allows you to close this gap.

 
Andrey Khatimlianskii:

What difference does it make what they measure?

There is a task - to perform an action every X ms, and you can't do it with a regular timer because of the peculiarities of its implementation.

The library allows you to close this gap.

Come on :) First they invent a problem and then heroically solve it. There is no such problem.

 
Rashid Umarov:

Come on :) First they invent a problem, then they heroically solve it. There is no problem.

Well, there isn't


 
After the update will be available

Frame-режим

Expert Advisors in the mode of collecting frames of Optimisation results ignore the following standard events of normal work of the Expert Advisor: Init, Deinit, NewTick, Trade, TradeTransaction, BookEvent and Timer. Only ChartEvent remains a working event.

However, this library can enable the timer in this mode of EA operation as well, for this purpose, the following line should be written before calling the library.

#define  ACCURATETIMER_FRAME_MODE // Makes the timer of advisors working in Frame-mode working

Please note that OnChartEvent (even empty) must be written in the source EA, and the corresponding Frame vulnerability starts to propagate on OnTimer.

An example of such an Expert Advisor is attached

// Demonstration of EA timer operation in Frame mode

#define  ACCURATETIMER_FRAME_MODE // Makes the timer of advisors working in Frame-mode working 
#include <AccurateTimer.mqh>     // Increase the accuracy of the standard timer

sinput uint Range = 1; // Input parameter for Optimisation

#define  SETRANGE(A, START, STEP, END) ParameterSetRange(#A, true, A, START, STEP, END)

void OnTesterInit() { SETRANGE(Range, 0, 1, Range); }

void OnTesterDeinit() { EventSetTimer(1); } // Set a timer at the end of Optimisation

// Be aware of the Frame vulnerability! - https://www.mql5.com/ru/forum/170952/page71#comment_6626688
void OnChartEvent( const int id, const long& lparam, const double& dparam, const string& sparam ) {}
void OnTimer()
{
  static const bool IsFrame = MQLInfoInteger(MQL_FRAME_MODE);
  
  if (IsFrame)
    Print("Hello World!");
}
 

fxsaber:

Frame mode

Expert Advisors in the Optimisation results frame collection mode ignore the following standard events of normal Expert Advisor work: Init, Deinit, NewTick, Trade, TradeTransaction, BookEvent and Timer. Only ChartEvent remains a working event .

Imho, this is a partially correct statement. It has been discussed.

 
Dennis Kirichenko:

Imho, partially correct statement. It' s been discussed.

Didn't notice the partiality. It's just as I said.