Documentation
MQL5 Help as One File:
CHM (1.7 Mb)
PDF (8 Mb)

EventSetTimer

The function indicates to the client terminal, that events from the timer must be generated with the specified periodicity for the chart, to which the Expert Advisor is attached.

bool  EventSetTimer(
   int  seconds      // number of seconds
   );

Parameters

seconds

[in] Number of seconds that determine the frequency of the timer event occurrence.

Return Value

In case of success returns true, otherwise false. In order to get an error code, the GetLastError() function should be called.

Note

Normally, this function must be called from the OnInit() function or from a class constructor. In order to handle events coming from the timer, the Expert Advisor must have the OnTimer() function.

Every Expert Advisor, as well as every indicator works with its own timer and receives events only from it. As soon as a mql5 program stops operating, the timer is destroyed forcibly if it was created but hasn't been disabled by the EventKillTimer() function.

For each program no more than one timer can be run.