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
Here is the fastest, correct working version on all TFs:
Speed slows down for TF D1, W1 and MN1
And here is a test indicator, which clearly shows the response of different versions, as well as their speed ( the second number. The smaller the number, the faster the function)
Both versions 3 and 4 work correctly. But the 3rd one is faster.
Variants with CopyTime are the slowest.
This can be checked in MQL4 (see indicator attached).
I do not specify the authorship of different variants, because I've already got confused.
But the third, most useful way is 80% from@fxsaber. I have only tweaked it a little bit.
Both options 3 and 4 work correctly. But 3 is the fastest. CopyTime variants are the slowest.
Forum on trading, automated trading systems and strategy testing
Discussion on "LifeHack for trader: mixing ForEach on defines (#define)"
fxsaber, 2018.02.14 11:58
ZZY Function speed measurements should be measured in an environment where performance is important - Tester.
The measurements don't really matter here. You can see that the logic is the fastest.
Here is the fastest, correct working version on all TFs:
Speed slows down for TF D1, W1 and MN1
And here is a test indicator, which clearly shows the response of different versions, as well as their speed ( the second number. The smaller the number, the faster the function)
Both versions 3 and 4 work correctly. But the 3rd one is faster.
Variants with CopyTime are the slowest.
It can be checked in MQL4 (see indicator attached).
I am not indicating the authorship of different variants because I am already confused.
But the third, most working variant is 80% from@fxsaber. I only tweaked it a bit.
I have added TF to your indicator - the first two algorithms are not useful at all.
In the figures, the current TF is H1, and the calculation is based on daily rates.
Yes (highlighted)
-1 is a one minus (to clarify), returned by the error function, which says that there is no such bar
So my function
also needs to be refined
though...
Documentation:
"Note.
If data for the timeseries with the specified parameters when calling the Bars() function have not yet been generated in the terminal, or data of the timeseries are not synchronized with the trade server at the moment of the function call, then function will return zero value. "
====
If res==0, then we will catch -1 from the function as it is.
===
So it all works, use it to your advantage!
On the indicator above you can clearly see how false this method is.
Here is the fastest, correct working version on all TFs:
Speed slows down for TF D1, W1 and MN1
And here is a test indicator, which clearly shows the response of different versions, as well as their speed ( the second number. The smaller the number, the faster the function)
Both versions 3 and 4 work correctly. But the 3rd one is faster.
Variants with CopyTime are the slowest.
It can be checked on MQL4 (see indicator attached).
I do not specify the authorship of different variants, because I've already got confused.
But the third, most working variant is 80% from@fxsaber. I only tweaked it a little bit.
TheiBarShift3 variantdoes not work correctly.
Here's my version. Seems to work with both junior and senior frames. Speed is a little bit faster than iBarshift3.
int iBarShift(string symbol, ENUM_TIMEFRAMES timeframe, datetime time){
datetime t1 = TimeCurrent()+10000000;
int ps = PeriodSeconds(timeframe);
double div = time/(double)ps;
double mant = div - MathFloor(div);
int ret = Bars(symbol, timeframe, (datetime)(time-(ps*mant)), t1)-1;
return(ret);
}
TheiBarShift3 option doesnot work correctly.
Can I have an example of it not working correctly?
So that leaves only option four?
TheiBarShift3 optiondoesn't work right.
Vocabulary is our everything.
Vocabulary is our everything.
I did a quick check: 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 how I came to my conclusion.
Here is the one I use