Index number of candles
Index number of candles
29 Mar 2014, 15:41
Dear Support,
I would like to ask you that, sometimes you change the index number of candles ? If yes, what is the technical reason of this? Because I use a custom indicator that refers to indexes, and I have to reset it in this cases, and that's a lot of work for me.
Thanks in advance!
Replies
Elogos
02 Apr 2014, 22:30
RE:
rkokerti said:
Thanks for your answer Elogos!
I would have liked read the opinion of developers as well, but I think I will follow your train of thought.
Thanks again!
No problem, the thing about using OpenTime is it also makes it inherently easier code for any MarketSeries for MTF indicators.
@Elogos
Elogos
29 Mar 2014, 16:52
RE:
rkokerti said:
It is preferable to refer to candles by open time with this platform.
The index of any given candle can change if refresh is called (history is trimmed) or you are on some sort of composite chart like Tick Charts.
The index of a given candle is useful when referring to the collection when in a snapshot state, say for example the Calculate() event, any locally stored references should be fine.
But input parameters or if you store data outside of the indicator and use indexes for reference then it won't have any referential integrity. Indicators call Initialise() when the chart refreshes so data held within the scope of the indicator or any instances it makes should be fine.
I am sorry if this hasn't helped you, I have tried my best to understand the issue you have, and unless there is a bug, the chart indexes should not change without calling an Initialise() after, which allows short-term referential integrity.
@Elogos