My VWAP indicator stopped to work recently, after an update. I noticed that the volume_tick array returns 1 in the last iteration. In the next iteration the before values are right.
I coded the follow indicator to show the problem:
A return fragment is:
Notice that I put the indicator at 11:09:32.
The history data are loaded correctly. But the iterate data returns 1 to tick_volume.
The tick_volume returns the correct value in the next iteration: idx-1 is always correct, but idx is always 1.
I tested this code in real data with two brokers and the behavior was the same.
Build 1940
What can I do to fix that?
Tks Alain,
To fix that I skipped when prev_calculated=zero and I always calculate i-1 values.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My VWAP indicator stopped to work recently, after an update. I noticed that the volume_tick array returns 1 in the last iteration. In the next iteration the before values are right.
I coded the follow indicator to show the problem:
A return fragment is:
Notice that I put the indicator at 11:09:32.
The history data are loaded correctly. But the iterate data returns 1 to tick_volume.
The tick_volume returns the correct value in the next iteration: idx-1 is always correct, but idx is always 1.
I tested this code in real data with two brokers and the behavior was the same.
Build 1940
What can I do to fix that?