
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
What problem did you find?
Here is an example of your function falsely working under the name "BarShift1"
Here is an example of your function working falsely - it works under the name "BarShift1"
Actually it only shows the opposite, my version is the only one which is correct. (And the original iBarShift1 from this code is correct).
My version was designed as a standalone function, just like mql4 iBarShift.
It is not optimised for multiple queries, so the time comparison is irrelevant. @nicholishen published a good library optimised for mass calling.
Actually it shows just the reverse, my version is the only one that is correct. (Also the original iBarShift1 from this code is correct).
My version was conceived to be used as a standalone function, exactly like mql4 iBarShift.
It's not optimized for multiple requests, so time comparison is irrelevant. @nicholishen published a good library optimized for bulk call.
In fact it only shows the opposite, my version is the only one which is correct. (And the original iBarShift1 from this code is correct).
My version was designed as a standalone function, just like mql4 iBarShift.
It is not optimised for multiple queries, so the time comparison is irrelevant. @nicholishen published a good library optimised for mass calling.
Actually it shows just the reverse, my version is the only one that is correct. (Also the original iBarShift1 from this code is correct).
My version was conceived to be used as a standalone function, exactly like mql4 iBarShift.
It's not optimized for multiple requests, so time comparison is irrelevant. @nicholishen published a good library optimized for bulk call.
I'm not talking about processing time, I'm talking about bar number.
In the picture you can see that at 8:37 the code thinks that the nearest bar is the bar of the previous day 23:00 , but in fact the nearest bar is 10:00. It is closer both mathematically and logically.
I'm not talking about processing time, I'm talking about the bar number.
The picture shows that at 8:37 the code considers that the nearest bar is the bar of the previous day at 23:00, but in fact the nearest bar is 10:00. He is closer both in mathematics and in logic.
Forum on trading, automated trading systems and strategy testing
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.
Let's simplify it.
I see your argument. I am not going to check it. Apparently, it's my task that differs from the accepted logic.
What problem have you discovered?
I wrote this a long time ago. I don't remember anymore, but something confused me.
Anyway, now I've found only one abnormal situation.
When not yet loaded symbol data may return -1 and should return 0.
This can be checked using the script for MQL4 that I'm attaching.
This script takes random time and random timeframe. If iBarShiftX value does not match the regular iBarShift function, then message via Print.
If you run this script on a newly opened symbol, you will see errors. Re-running the script on the same symbol will not give errors.
But it is a trifle. In my version is the same problem.
I have only one complaint about your version: it is very complicated and slow.
Here is your variant:
And here is my function, which does the same thing, but with a simple algorithm and much faster:
You can use an even shorter one without the function:
Try to prove otherwise. Find a single combination of parameters when your function and mine will show different values.
Only I haven't implemented the last parameter exact in it, because I don't understand why it's needed at all. I personally have never needed it.
But if someone really needs it, it can be implemented.
I left the iBarShift3 variant, because it incorrectly handles history holes. It can be fixed, but I don't see the point, as the above option is enough.
I left the iBarShift3 option because it doesn't correctly handle history holes. It can be fixed, but I don't see the point, because the above option is sufficient.
Are the holes because of the lack of pro-trading on the bar, or other ones? And, how does the inaccuracy manifest itself?
Are the holes due to a lack of pro-trading on the bar, or other? And what is the inaccuracy?
Let's take a Sunday any time when there is no trading:
Suppose we take Sunday any time when there is no trading:
So it shows Monday? That's what I want... :)