Analogue to iBarShift - page 8

 
Vitaly Muzichenko:

I checked quickly: there is a function that has been working for more than a day, I substitutediBarShift3 instead and got the EA to work incorrectly. That's the conclusion I drew from it.

Here is the one I use

Try with your function do this:

Print("iBarShift1 = "+IntegerToString(iBarShift (_Symbol,PERIOD_H1,D'04.04.2018 08:00:01')));
Print("iBarShift0 = "+IntegerToString(iBarShift (_Symbol,PERIOD_H1,D'04.04.2018 08:00:00')));

Your function will give out different values, but the hour is the same. That means it is not working.

The native function in MQL4 gives the same values.

iBarShift3 also gives same values, but for periods D1, W1 and MN1 it is equally wrong. I need to tweak the code a bit. I know how to do it and will do it later when I have enough time.

Otherwise, these functions behave the same, only iBarShift3 is much faster.


ZS: Sorry. Your function works correctly. I put in the wrong code. It's mine that doesn't behave correctly on periods D1,W1 and MN1. I will fix it today.

 
I'm already confused by the programming pillars - so which function now exactly counts everything on all TFs?
 
Aleksey Vyazmikin:
I'm already confused by the programming pillars - so which function counts accurately on all TFs nowadays?
Logically, the slowest function seems to get it right :-)
 
Aleksey Vyazmikin:
I'm already confused by the programming pillars - so which function now exactly counts everything on all TFs?
https://www.mql5.com/ru/forum/743/page7#comment_6995147
 
Aleksey Vyazmikin:
I'm already confused by the programming pillars - so which function now exactly counts everything on all TFs?
And does it all work correctly when there are bar skips!
 
Yury Kirillov:
If you look at the logic, the slowest one seems to get it right :-)

No, the slowest one is not correct, judging from the indicator posted earlier.

Yury Kirillov:
And do all of them work correctly when there are gaps in the bars!

This is very important, because sometimes time goes by and there is no bar, especially on small TFs, then different number of bars with minutes may be different on different days...

 
Vitaly Muzichenko :

I checked quickly: there is a function that has been working for more than a day, I substituted iBarShift3 instead and got the EA to work incorrectly. That's the conclusion I drew from it.

Here is the one I am using

This is my code. Any problems ?

 
Nikolai Semko :
...

All the algorithms that were available before, including @Alain Verleyen' s one, have abnormal situations.

You can create a full analogue of iBarShift MQL4, but the code will be very cumbersome and I don't see any sense in it.

What problem have you found?

 
Alain Verleyen:

What problem have you detected?

Forum on trading, automated trading systems and strategy testing

iBarShift Analogue

Nikolai Semko, 2018.04.04 17:47

Try with your function do this:

Print("iBarShift1 = "+IntegerToString(iBarShift (_Symbol,PERIOD_H1,D'04.04.2018 08:00:01')));
Print("iBarShift0 = "+IntegerToString(iBarShift (_Symbol,PERIOD_H1,D'04.04.2018 08:00:00')));

Your function will give different values, but the hour is the same. So it's not working.

In MQL4 the native function gives the same values.

iBarShift3 also gives same values, but for periods D1, W1 and MN1 it is equally mistaken. I need to tweak the code a bit. I know how to do it and will do it later when I have enough time.

Otherwise, these functions behave the same, only iBarShift3 is much faster.


ZS: Sorry. Your function works correctly. I put in the wrong code. It's mine that doesn't behave correctly on periods D1,W1 and MN1. I will fix it today.


 
Vitaly Muzichenko :

Thank you.
Reason: