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"); }
MQL5.community - User Memo
- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
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.
Thank you. Wait for a fixed build, please.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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!