Paolo: My problem is: price[J] value doesn't get frozen when a new bar appears (rates_total > prev_calculated) but it assumes a avalue which:
a) does not match the value plotted on the chart
b) it gets its final value only 1-2 ticks after the new bar appearance
Price[J] is the problem, but you don't show it.
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code.
How To Ask Questions The Smart Way. 2004
Be precise and informative about your problem
We can't see your broken code.
Fix your broken code.
With the information you've provided — we can only guess. And you haven't provided any useful information for that.

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
Hi,
while developing a non banal custom indicator I met a strange behaviour which I cannot grasp fully. The indicator is intended not to be calculated for the open bar. In other words, it is supposed to calculate position J only when position J+1 appears (= bar J completed)
Below you can find the main loop which should allow for that.
My problem is: price[J] value doesn't get frozen when a new bar appears (rates_total > prev_calculated) but it assumes a avalue which:
a) does not match the value plotted on the chart
b) it gets its final value only 1-2 ticks after the new bar appearance
I wish to understand better the logic beneath in order to code properly