Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 817
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
The only thing to do is to add lots of small functions that would check one expression for equality, subtraction, addition, inequality, multiplication, etc.
PS/ What's "check on subtraction, addition, multiplication" and I don't get it :-(
How can I see bar open times on M1 from a higher timeframe?
If you want to see the high bar from the low bar, then
How can I see the bar open time on M1 from a higher timeframe?
If you want to see the high bar from the low bar, then
if i got it right:
datetime time_h1=iTime(_Symbol,PERIOD_H1,1); // время открытия прошлого бара H1
int bar_m1=iBarShift(_Symbol,PERIOD_M1,time_h1); // соотв. ему бар периода M1
datetime time_m1=iTime(_Symbol,PERIOD_M1,bar_m1); // время его открытия
//PS - the difference can only be from h2 and only on Monday morning :-)
If I understand correctly, then:
datetime time_h1=iTime(_Symbol,PERIOD_H1,1); // время открытия прошлого бара H1
int bar_m1=iBarShift(_Symbol,PERIOD_M1,time_h1); // соотв. ему бар периода M1
datetime time_m1=iTime(_Symbol,PERIOD_M1,bar_m1); // время его открытия
//PS - the difference can only be from h2 and only on Monday morning :-)
Supposethe opening time of the last bar H1 is 01:00:00, how canwe get the time from the bar M1 which opened at01:01:00to thetime_m1variable?
Supposethe last H1 baropened at01:00:00, how can Iget the time from M1 bar, which opened at01:01:00,into thetime_m1variable?
time_m1_plus_1=time_h1 + 1 * PeriodSeconds(PERIOD_M1); // suddenly :-) just add 1 minute = 60 seconds to the time
but if you risk a change of day/session/week or exotic currencies/indices/funds, to be sure, use iBarShift, iTime - because in decent places the bar is formed with the first deal (there is no bar without volumes), but if there are no deals, the "quick" will be
time_m1_plus_1=time_h1 + 1 * PeriodSeconds(PERIOD_M1); // suddenly :-) just add 1 minute = 60 seconds to the time
Now, this is valuable - to know that the specified time is inside a bar at any timeframe, you need to do the following
but if time is even, without minutes"2019.04.23 01:00:00" then the arrows are on two bars, on the bar at 01:00:00 and on the previous one at 00:00:00 How not to put extra one?
Good all parts of the day and seasons))
Written by a turkey. It works, but persistently writes an error in the Experts section.
Attempts to solve the problem ... while "what to the top" ..)))
Tell me, pliz, where I messed up out of inexperience ....
I highlighted the problematic place in the code in red ... or green would be better!?)))
PS I deny the handle option in principle, because of the operating conditions of the handle on MT5
Willing to pay some wages if the code has drastic bugs.
BUT I WANT TO GET TO THE ESSENCE OF THE PROBLEM!!!!
Wrote an indie. Works, but persistently writes error in Experts section.
My log is clean, switched modes arbitrarily (EMA also tested). Give a variant of the settings where the error might appear.
Was wondering how it could work and error at the same time.
This is valuable, what is needed) To know that the given time is inside the bar of any timeframe you need to do the following
but if the time is even, without minutes"2019.04.23 01:00:00" then the arrows are on two bars, on the bar at 01:00:00 and on the previous one at 00:00:00 How not to put extra one?
if (time[i]>=time_m1 && time[i]<time_m1+PeriodSeconds(PERIOD_M1) {
// время time[i] попало внутрь бара открытого в time_m1
}
I have a clean log, switched modes arbitrarily (EMA also tested). Give option of settings at which the error may appear.
It was interesting how it could work and produce an error at the same time.
EMA line 20 23.04.2019 00:00
When turning on MT5, WITHOUT online connection, the message "array out...." appears immediately.
Errors vary, but always present. Can replicate online, but more often present when MT is switched on.
Such is the mystery of the "Bermuda parallelepiped"