TextCreate(0, (string)Symbol() + i, TextCreate(0, (string)Symbol() + DailyBar,
Do not use series index in object names, as they are not unique. As soon as a new bar starts, you will be trying to create a new name (e.g., “name0”), same, existing, previous, name (e.g., “name0” now on bar one.)
Use time (as int) or a non-series index:
#define SERIES(I) (Bars - 1 - I) // As-series to non-series or back.
Do not use series index in object names, as they are not unique. As soon as a new bar starts, you will be trying to create a new name (e.g., “name0”), same, existing, previous, name (e.g., “name0” now on bar one.)
Use time (as int) or a non-series index:
Hi William,
I see what you mean, Thank you for that.
So in fact it isn't failing to count the entirety of bars at all. It is just trying to create the same object again and again on the most recent candle.
Appreciate that, Cheers.
C

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
I was having an issue with a HTF moving average calculating the entire rates_total on every loop due to a badly designed for loop. I have created an indicator to help debug this and redesign the loop so that I am only calculating the most recent bar (after the intial loop through the whole chart). That part is resolved, I am now only calcualting the most bar.
However now, my HTF MA is only calculating the most recent bar, as opposed to the whole history, and I can't work out why.
I have added text labels of 'i' in blue, and 'DailyBar' (the daily bar shift) in red to help debug but I still cannot work it out. (See attached screenshot)
If anyone can set me right here it would be greatly appreciated.
Thanks in advance.