
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
It should work. Maybe the conversion StringToTime went wrong. Just Print the values of _start, _end and servertimeofday to make sure. And this might fix it:
Thanks lippmaje,
I added:
and the alerts were as you would expect, though I realize that the _currentserver time will change continually.
Rather a vexing problem, eh
Try this
Try this
Thanks Marco ... his doesn't address the minutes component though ...
Of course you can just expand the example to use more parameters.
int Minute=time1.min;
MQL4 Reference → Language Basics → Operations and Expressions → Arithmetic Operations
Find bar of the same time one day ago - Simple Trading Strategies - MQL4 and MetaTrader 4 - MQL4 programming forum
I just tried this, but it doesn't work for me. I immediately call up the OutOfHours(), even though the server time is about 10:30 at the moment. I shouldn't be blocked from trading for another 13 hours or so ...
I have set end time at 2330 and start time at 0130. Please try it yourself if you have a few moments to spare, and let me know what you think :)
Thanks all for the help.
In MQL your code works fine if you simply say
servertimeofday=TimeCurrent();
How about something simple like this:
This guarantees you avoid the crazy 0 hour spreads and you'll probably only miss out on less than 15 seconds of trading considering how often the ticks occur.
Hi,
here is my simple solution for this little problem - may it could help you.
Best regards