A new problem with EventSetTimer
Please, properly insert code
#property copyright "Oran Leiba" #property link "www.etootim.com" #property version "1.00" bool start = true; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(0); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- if(start){ bool setTimer = EventSetTimer(2); if(setTimer){ printf("success set timer"); start = false; }else{ printf("failed set timer"); } }else{ printf("no need to set timer"); } } //+------------------------------------------------------------------+ void OnTimer(){ printf("on timer"); }
- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
Sure.
The problem seems to exist on both Vista and XP Pro and I'm almost sure it was not happening on the previous build.
One behavior I can note, is that if you let the expert run in tester for the first time till it finishes and then you immediatly start again the testing, the timer is working properly.
But, until you complete a first round of testing with wrong behavior, the timer will not work.
Thanks.
Hi,
I set "EventSetTimer(2)" on the first tick only and expect this "onTimer" event to fire during backtest, even in the weekend. I can't seem to get the output on the onTimer call which I assume means it is not being called.
Below pasted a simple code for testing the problem, I use build 355.
Can someone point the problem, or this is a bug?
#property copyright "Oran Leiba"
#property link "www.etootim.com"
#property version "1.00"
bool start = true;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(0);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
if(start){
bool setTimer = EventSetTimer(2);
if(setTimer){
printf("success set timer");
start = false;
}else{
printf("failed set timer");
}
}else{
printf("no need to set timer");
}
}
//+------------------------------------------------------------------+
void OnTimer(){
printf("on timer");
}
Thanks!