Use the SRC button to post your code.
int OnInit() { //--- create timer MqlDateTime hari; TimeGMT(hari); EventSetTimer((6-hari.hour)*3600-hari.min*60-hari.sec); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- destroy timer EventKillTimer(); } void OnTimer() {EventSetTimer(3600*24); MqlDateTime hari; TimeGMT(hari); Print(hari.day); }
It's running at the moment and taking about six minutes to run each day even though I only want it to look at prices at one moment. I've used MT4 in the past and it was quick with that. What's happened?
I'd like to test a strategy to run only at 6 every morning. I think I can do it with the timer OK, but it's still incredibly slow to test, maybe half an hour to do a month.. Can I do something to speed it up? Here's the code I have:
Are you using this code in Strategy Tester?
If so, please read this post.OK, so the timer won't work in the strategy tester. But still, why is the testing SO slow? If it's going to take three hours to run a test I'll never get there. I would need to run it multiple times, ironing things out.
Should I just go back to MT4? Can I just go back to MT4?
OK, so the timer won't work in the strategy tester. But still, why is the testing SO slow? If it's going to take three hours to run a test I'll never get there. I would need to run it multiple times, ironing things out.
Should I just go back to MT4?
The timer IS working in MT5 Strategy Tester.
The code you posted is not "SO slow" :
2018.01.24 09:34:33.147 Core 1 EURUSD,H1: 32301546 ticks, 4913 bars generated. Environment synchronized in 0:00:00.078. Test passed in 0:00:16.562 (including ticks preprocessing 0:00:04.141).
2018.01.24 09:34:33.147 Core 1 EURUSD,H1: total time from login to stop testing 0:00:16.640 (including 0:00:00.078 for history data synchronization)
It's running at the moment and taking about six minutes to run each day even though I only want it to look at prices at one moment. I've used MT4 in the past and it was quick with that. What's happened?
What EXACTLY is taking 6 minutes to run ?
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'd like to test a strategy to run only at 6 every morning. I think I can do it with the timer OK, but it's still incredibly slow to test, maybe half an hour to do a month.. Can I do something to speed it up? Here's the code I have:
int OnInit()
{
//--- create timer
MqlDateTime hari;
TimeGMT(hari);
EventSetTimer((6-hari.hour)*3600-hari.min*60-hari.sec);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
void OnTimer()
{EventSetTimer(3600*24);
MqlDateTime hari;
TimeGMT(hari);
Print(hari.day);
}