EventKillTimer how to kill???

 

hi  guy  how  to  kill the  timer ???


i study a script 


//+------------------------------------------------------------------+
//|                                                    TimerTest.mq4 |
//|                                       Copyright 2014, aforexpert. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, aforexpert."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property strict

//+------------------------------------------------------------------+
//| expert include                                                   |
//+------------------------------------------------------------------+
#include <stdlib.mqh>

//--- input parameters
input ushort   seconds=10;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   if(!EventSetTimer(seconds))
     {
      int error=GetLastError();
      PrintFormat("EventSetTimer FAILED: #%d[%s]", error, ErrorDescription(error));
     }
      
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
      
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
   Print("OnTimer  dopo 10 eccomi ");
  }
//+------------------------------------------------------------------+


i  test  in my demo and  i see after 10 second  write  somthing , and  do this in loop , how  is possible  kill this loop ?? , i think i must  use  the  funcion 

void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
      
  }


but  how  execute  them ???


thankz  at  all :)

 

Is it not obvious? Use the function "EventKillTimer()" from within the "OnTick()" or "OnTimer()" to disable future Timer events! However, you will also have to SET the timer from within the "OnTick()" event as well, instead of in the "OnInit()", even thou I suspect that it may also work even if the timer was SET in the "OnInit()" event. Please see the documentation.

 
faustf: hi  guy  how  to  kill the  timer ???
Perhaps you should read the manual, like the page where you learned how to start the timer (2nd paragraph from the bottom.)
 

FMIC   thankz  so much  , it was not so obvious as it seemed,  but  your explanation  it was excellent   , thankz  again



Reason: