Libraries: AccurateTimer

 

AccurateTimer:

Increased accuracy of the standard timer.


Author: fxsaber

 
is this issue still applicable today?
 
Revo Trades #: is this issue still applicable today?

I believe I remember a recent forum topic of someone complaining of the inaccuracy of the OnTimer event, and on that thread fxsaber referred to this publication.

I will try to find it.

 
Revo Trades #:
is this issue still applicable today?

The library description contains an example showing the relevance of the problem. You can check.

 
so its just for check? what about fixing timer and making it stable like a clock
 
Arpit T #:
what about fixing timer and making it stable like a clock

This is what this library is for.

 
fxsaber #:

This is what this library is for.

Hi fxsaber, how can I use this library with Init_Sync?

Init_Sync
Init_Sync
  • www.mql5.com
The library makes indicators' Init/Deinit synchronized
 
Le Minh Duc #:

Hi fxsaber, how can I use this library with Init_Sync?

#include <AccurateTimer.mqh> // https://www.mql5.com/en/code/19859
#include <Init_Sync.mqh> // https://www.mql5.com/en/code/18138
 
fxsaber #:

I got this error when try compiling the indicator, my indicator has had OnInit(), OnDeinit(), OnTimer() and OnChartEvent().

 
Le Minh Duc #:

I got this error when try compiling the indicator, my indicator has had OnInit(), OnDeinit(), OnTimer() and OnChartEvent().

#include <AccurateTimer.mqh> // https://www.mql5.com/en/code/19859
#include <Init_Sync.mqh> // https://www.mql5.com/en/code/18138

#property indicator_chart_window

#property indicator_buffers 1
#property indicator_plots   1
#property indicator_color1  clrRed
#property indicator_type1   DRAW_LINE

input int Input = 0;

double Buffer[];

int OnInit()
{
  SetIndexBuffer(0, Buffer);
  Print("Init");
  return(INIT_SUCCEEDED);
}

void OnDeinit( const int Reason )
{
  Print("DeInit");
}

void OnChartEvent( const int id,
                   const long& lparam,
                   const double& dparam,
                   const string& sparam )
{
}

void OnTimer()
{
}

int OnCalculate( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[] )
{
  ArrayCopy(Buffer, open, prev_calculated, prev_calculated);  
  return(rates_total);
}


'AccurateTimer.mqh'     AccurateTimer.mqh       1       1
'Init_Sync.mqh' Init_Sync.mqh   1       1
'TypeToBytes.mqh'       TypeToBytes.mqh 1       1
'crc64.mqh'     crc64.mqh       1       1
macro 'OnTimer' redefinition    Init_Sync.mqh   225     9
   see previous declaration of macro 'OnTimer'  AccurateTimer.mqh       110     9
code generated          1       1
0 errors, 1 warnings, 167 msec elapsed without optimizations, cpu='AVX'         1       2