Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 570

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
How do I check the condition at a given time? e.g. on the M5 chart, at 22:59, i.e. one minute before the bar closes. check for the whole minute.
How to check the condition at a given time? For example, on the M5 chart, at 22:59, i.e. one minute before the bar closes.
In the indicator on the history - only by reading the data from the younger TF (in this case M1), we will have to fuss. But for the zero bar:
...Well for the zero bar:
That is, current time subtract the bar open time?
Maybe we should skip the iteration if the time is not in the range of 22:59, 23:00
how to write this condition correctly?
Is it, the current time subtracted from the bar opening time? Does it count for less than a minute?
Maybe skip the iteration if the time is not in the range 22:59, 23:00
How do I correctly write this condition?
If the time is explicitly set, then it's the same as in the scheme above:
I didn't check the code. There may be misprints and some errors. The main thing here is the directions of thought.
You must also check that the values of hours and minutes are correct. After all, a user can enter values like 38 hours and 112 minutes.
If the time is explicitly set, then it's the same as above:
I haven't checked the code. There may be typos and some errors. The main thing here is the direction of thought.
You should also check that the values of hours and minutes are correct. After all, a user can enter values like 38 hours and 112 minutes.
In the eye, user, for 112 minutes)
why can't it be like this?
does not show at the specified time
There will be several ranges each to be switched off
the quotes may "fall asleep" for a minute and you will miss the time)
The right thing to do is to make a timer, synchronise local and current time, and in the timer "catch" the right time
In the eye, to the user, in 112 minutes)
Why can't you do it this way?
This is exactly the wrong solution, because you are comparing strings, not numbers. Although you can do something with TimeToStr too. But this approach is doomed to be slower than operating with numbers. After all, string operations take much more time than the simplest arithmetic operations (+, -, /, *).
This is done by storing the values of the desired ranges into arrays. Admittedly, it's not clear how this would look in the configuration parameters - too many of them would have to be done. The solutions do exist, though. Not simple, but they are available.
the quotes may "fall asleep" for a minute and you will miss the time)
The correct way is to make a timer, synchronize local and current time, and "catch" the right time in the timer
Well, you don't have to do anything at a set time. So it's OK))
the quotes may "fall asleep" for a minute and miss the time)
correctly make a timer, synchronize local and current time, and in the timer "catch" the right time
can you insert OnCalculate() in OnTimer()?
I don't know how to synchronize local andcurrent time, I can't find it in help.
Well, that's what it takes to do nothing at a given time. So it's OK ))
how, do nothing? only this minute is required to check, and sleep for 24 hours)