pullend:
Well that depends on what the final value of i is when the for loop exits, what is it's value ? if it's 0 then there is no difference.
Hello Forum, I have the following question which has shown up a BIG gap in my base understanding of how and when indicators update.
Why is comparing indicator values for bars 0 to 1, different to comparing indicator values bars i to (i+1), in the context below?
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
Hello Forum, I have the following question which has shown up a BIG gap in my base understanding of how and when indicators update.
Why is comparing indicator values for bars 0 to 1, different to comparing indicator values bars i to (i+1), in the context below?
Context:
I put together an indicator which I hoped would simplistically show ( as a discrete arrow on the main chart, see attached picture) the change in direction of the MACD line.
The arrow on the main chart simply changes from either upwards, downwards or sideways as the direction of the MACD line changes.
All went well until I noticed some synchronisation issues, that is, the chart arrow seemed to lag when changing direction relative to the MACD line visible on the chart.
Anyway with a lot of exploring, I found the problem lay in whether I defined the change in my MACD line slope as:
Now I am only interested in what is happening in the current active bar, versus the previous closed bar and I thought the above 2 methods would give the same result.
The black arrow is updating as planned (changing directions sometimes intra bar), the blue is not working the way I had hoped
Would someone mind telling me why they are behaving differently in this context?.....
thanks in advance (indicator code also attached)