Friday, March 3, 2017

Interval timer

interval timer

The common property - OO implementation interval timers for MT4. Of features - an arbitrary number of timers, real time reference, the ability to work in the tester.

Sketched by https://www.mql5.com/ru/forum/91807 grounds as a result of insomnia :-)

Next - interface and a library, and a test and demonstration skills in attachem

class TimeService;
class Timer {
public:
Timer (int period, datetime startTime = 0); // shall operate a period intervals starting at startTime (umolch.pryam at once)
~ Timer ();
virtual bool Clock (); // will be called when the expiration period, returns false if it is not sled.vyzova
virtual void OnAttach (); // when setting service
virtual void OnDetach (); // when removed from service
int Lag (); // delay from the last scheduled
int Omit (); // number of missed signals
public:
int period; // timer intervals
datetime startTime; // start time
datetime shedTime; // time trace. scheduled call (service set)
Timer * next; // trace. timer Service timer list
TimeService * ts; // Timer Service
};
class TimeService {
public:
TimeService ();
~ TimeService ();
void Clock (); // must be invoked at every opportunity
bool Add (Timer *); // add a timer
bool Del (Timer *); // delete the timer
public:
void Shed (Timer *);
Timer * first; // sort the list of timers. on call time (shedTime)
datetime now; // the last known time (Clock time of the call)
};




Next posts


No comments:

Post a Comment

StrikeFx

StrikeFx StrikeFx - multi martingeylovy new generation Advisor. This advisor we gave up a grid with a fixed distance between the orders. Th...