OnTimer and OnTick called once

 

Hi,i'm trying to discover out why OnTimer is called once.


in my Init Method i have :

EventSetTimer(10);
OnTimer();


Inside the method OnTimer,i'm printing a number.

But this number is printed once  and the OnTimer is not called anymore.

Do you have any suggestions ?


edit : the method OnTick is called once too even if the EA is in the Chart running and the price changes.

In my computer works fine, but when i put in my VPS,don't work. ( i have other expert advisors running without problems. )
Build :1940

 

No need to called OnTimer() from OnInit().

Here's a very basic OnTimer() example that works:

#property strict

long g_timerCount = 0;

int OnInit()
{
    EventSetTimer(1);    // every second

    return INIT_SUCCEEDED;
}

void OnTick() {}

void OnTimer() 
{
    PrintFormat("%s(): g_timerCount [%d]", __FUNCTION__, g_timerCount++);
}

edit : the method OnTick is called once too even if the EA is in the Chart running and the price changes.


In my computer works fine, but when i put in my VPS,don't work. ( i have other expert advisors running without problems. )
Build :1940

No idea. Post your code if you want additional help.

 
Bilal Said:
Thanks for the help. 
But the OnTimer and OnTicket  are  called once. 
So the problem is not related about the timer as I thought
Sounds like you EA is dying. Did you check the error logs?
Reason: