
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
r+s-1
why
-1
please?
Thanks so much.
Hello, someone could explain to me in
why
please?
Thanks so much.
Yeah, it's easier to learn Russian.
I am with @okwh. I am still baffled why the loop starts with 1?
I've read the article that was pointed by @Rashid Umarov. It did say this :
The default indexing of all arrays and indicator buffers is left to right. The index of the first element is always equal to zero. Thus, the very first element of an array or indicator buffer with index 0 is by default on the extreme left position, while the last element is on the extreme right position.
I am with @okwh. I am still baffled why the loop starts with 1?
I've read the article that was pointed by @Rashid Umarov. It did say this :
The default indexing of all arrays and indicator buffers is left to right. The index of the first element is always equal to zero. Thus, the very first element of an array or indicator buffer with index 0 is by default on the extreme left position, while the last element is on the extreme right position.
Because in this particular example, the indicator needs to calculate the Close[1]-Close[0]. Then, if the start is equal 0, that would cause the indicator to calculate a negative index: Close[0] - Close[-1]. That's why the start must be 1. So the indicator will calculate: Close[1] - Close[0]. Somenthing like: Close[start] - Close[start-1] written on the code.
for(int i=1;i<rates_total;i++)
{
MTMBuffer[i]=price[i]-price[i-1];
AbsMTMBuffer[i]=fabs(MTMBuffer[i]);
}
Why use [i-1] to calculate [i] and start i=1 ? no [0] ?
MTMBuffer[i]=price[i]-price[i-1];
Does this exist in German?
From the article itself you can switch between the different available languages.
https://www.mql5.com/de/articles/10