![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
You mean it's showing Monday? That's what I want... :)
Yeah, well, it's actually strange behaviour for a standard function. After all, we are adjusting the values to its "reference".
The standard function iBarShift of MQL4 returns the number of the left bar (i.e. Saturday in this case), and iBarShift3 returns the number of the right bar (i.e. Monday) when the requested time hits the hole, which is more logical.
Yeah, well, that's actually strange behaviour for a standard function. After all, we are dealing exactly with fitting values to its "benchmark".
The standard function iBarShift of MQL4, when the requested time hits the hole, returns the left bar number (i.e. Saturday in this case), and iBarShift3 returns the right bar number from the hole (i.e. Monday), which makes more sense.
And what will happen if we are now in the hole (real time) and expect to receive information on the bar, what index will be offered to us? I assume it will be "1" in MQL4, while for the third algorithm it will be "0", or no?
I think the MQL4 function has a "don't look ahead" message, which is true to a certain extent - it all depends on the task.
Nikolai Semko :
...
I have only one complaint about your option: it is very complicated and slow.
When i posted it (4 years ago) the main goal was accuracy (again), because all other versions i found were wrong (compared to mql4 version).
I know it can be faster.
Try to prove otherwise. Find a single combination of parameters when your function and mine will show different values.
But I haven't implemented the last parameter exact in it, because I don't understand why it is needed at all. I personally have never needed it.
The requirement is to have mql4 version ONLY.
Forum on trading, automated trading systems and testing trading strategies
Analogue to iBarShift
Alain Verleyen, 2018.04.05 00:18
Actually it only shows the opposite, my version is the only one that is correct. (And the original iBarShift1 from this code is correct).
My version was conceived as a standalone function, just like mql4 iBarShift .
PS: Is it necessary to post English version or Russian translation is correct ?
Why don't you try my function? There is a solution there that adjusts the start and end of bars in time. It seems to calculate everything correctly. And it is faster in time than version 3 of your fastest one. Or the branch is more important?) Or is there an error there too?) I've been using it for a long time....
Where is it, your function, to try it out?
And what happens if we are now in a hole (real time) and expect to get information on a bar, what index will be offered to us? I assume it will be "1" in MQL4, while for the third algorithm it will be "0", or no?
I think the MQL4 function has the "don't look ahead" message, which is true to a certain extent - it all depends on the problem.
No. The first one is zero. In real time it works the same way.
And where is it, your function, to try it out?
It's at the end of page 7.)
That might be more convenient.
Why don't you try my function? I have a solution that compensates for the beginning and the end of bars in time. It seems to calculate everything correctly. And it is faster in time than the 3rd version of your fastest one. Or the branch is more important?) Or is there an error there too?) I've been using it for a long time....
That's funny ))))
Here is your function:
Since you don't know some mathematical operators, like % - the remainder of division
Let's make some simplification of your function.
It worked:
And here is my function:
Very similar. Really?
Only yours does everything very wrong and is slower at that.
You can try it with this script in MQL4.
No. The first one is zero. It works the same in real time.
OK - just some algorithm showing me "-1" on future data today....
That's funny ))))
Yeah, well, it does give out inconsistencies.) I'll dig it out ok.
Well, yes, it does give out inconsistencies.) I'll dig it out ok.