will not work correctly with PERIOD_W1 and PERIOD_MN1, because it is counted from January 1, 1970, and it is Thursday, not Monday. And each month has a different number of seconds.
I haven't checked it - because I need to know for sure if the code will work or not for a specific situation, because it's not correct to blame someone else if you have made a mistake yourself.
I'm talking about situations like this: suppose we have 14 hours in a day (or less, if there were no quotes every hour), I have an M1 chart and I need to know the shift of a bar on M15 for the previous day. I.e. will everything work correctly if I get 45 minutes in an hour or 14 hours in a day, or any other time/switching drops?
I personally think it is appropriate to use such a feature:
For example, I have a channel, one of the characteristics of which is the start time (left edge). And I need to build this channel on different TFs. Well, what other alternative do I have but to find the bar number in a new TF?
I have a lot of other things.
For example, when I combine all TFs into one with a logarithmic scale. This is a very cool topic. Can't do without the iBarShift analogue here either
I personally think it is reasonable to use such a function:
But it should be noted that it's not a full analogue of the standard MQL4iBarShift function, at least because it doesn't have theExact parameter
Otherwise it is identical.
I am pasting a simple MQL4 script that shows the full identity of the standard function with this one.
If values from the standardiBarShift function and my function are not equal, then Print. I have not printed anything.
No, it didn't because of Comment().
If you remove it, there is a mismatch by 1, but I don't think it's a mistake, because in fact the new bar is defined in two algorithms with a shift by half a bar. My version of new bar detection seems more logical to me than the standard one.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
In my opinion, the use of theSeriesInfoInteger function is redundant, because it is not free.
Was:
Became:
A speed gain of about 1.5 times.
2% gain. Note.
will not work correctly with PERIOD_W1 and PERIOD_MN1, because it is counted from January 1, 1970, and it is Thursday, not Monday. And each month has a different number of seconds.
This needs to be added to the PeriodSeconds documentation.
I haven't checked it - because I need to know for sure if the code will work or not for a specific situation, because it's not correct to blame someone else if you have made a mistake yourself.
I'm talking about situations like this: suppose we have 14 hours in a day (or less, if there were no quotes every hour), I have an M1 chart and I need to know the shift of a bar on M15 for the previous day. I.e. will everything work correctly if I get 45 minutes in an hour or 14 hours in a day, or any other time/switching drops?
I personally think it is appropriate to use such a feature:
But it should be noted that it's not a full analogue of MQL4iBarShift function at least due to the fact that it doesn't haveExact parameter
Otherwise it is identical.
I am pasting a simple MQL4 script that shows the full identity of the standard function with this one.
If values from the standardiBarShift function and my function are not equal, then Print. It didn't print anything for me.
2% win rate. Note.
What, really?
I was too lazy to put GetMicrosecondCount(), so I trusted profiling.
Really?
I was too lazy to set GetMicrosecondCount(), so I trusted profiling.
Profiling is about something else. 2% is the maximum gain you can get.
250 million calls in the Tester on my machine gives a saving of 1 second.
Definitely your option is the best! But I can't even imagine why in MT5 you need to work with bars.
But I have no idea why in MT5 I need to work with bars.
I use it when I control the mouse. For example here.
I use this when controlling the mouse. Here, for example.
Yeah, that's what I don't understand.
Yes, that's what I don't understand.
And I don't understand the misunderstanding ))
For example, I have a channel, one of the characteristics of which is the start time (left edge). And I need to build this channel on different TFs. Well, what other alternative do I have but to find the bar number in a new TF?
I have a lot of other things.
For example, when I combine all TFs into one with a logarithmic scale. This is a very cool topic. Can't do without the iBarShift analogue here either
I personally think it is reasonable to use such a function:
But it should be noted that it's not a full analogue of the standard MQL4iBarShift function, at least because it doesn't have theExact parameter
Otherwise it is identical.
I am pasting a simple MQL4 script that shows the full identity of the standard function with this one.
If values from the standardiBarShift function and my function are not equal, then Print. I have not printed anything.
No, it didn't because of Comment().
If you remove it, there is a mismatch by 1, but I don't think it's a mistake, because in fact the new bar is defined in two algorithms with a shift by half a bar. My version of new bar detection seems more logical to me than the standard one.
And I don't understand the misunderstanding ))
I don't understand the point of using bars. CopyRates etc.
Why is the script so slow?
2018.03.30 09:21:05.208 BS (Si Splice,H4) 1 Start=15 Stop=3 Day_Shift=0 index=0
2018.03.30 09:21:05.208 BS (Si Splice,H4) 1 Start=2018.03.26 00:00 Stop=2018.03.29 00:00 Day_Shift=2018.03.29 20:00 index=0
2018.03.30 09:21:20.209 BS (Si Splice,H4) 2 Start=15 Stop=3 Day_Shift=0 index=0
2018.03.30 09:21:20.209 BS (Si Splice,H4) 2 Start=2018.03.26 00:00 Stop=2018.03.29 00:00 Day_Shift=2018.03.29 20:00 index=0
2018.03.30 09:20:49.300 Scripts script BS (Si Splice,H4) loaded successfully
2018.03.30 09:21:20.209 Scripts script BS (Si Splice,H4) removed