I've been using getBarStateInterval(), and noted the "use once" requirement. Seems fine when using time periods that are a multiple of the "chart" period.
I'm concerned that I don't understand getBarStateSymbol() though.
1) My main() will get called for every tick in my symbol context (computeOnClose() not set).
2) But before I get the first tick in a new bar in my symbol context, a different symbol could have had several ticks, even if the intervals are the same. What will happen when I call getBarStateSymbol() in that situation? Will I miss the BARSTATE_NEWBAR (defined as "the first tick of a new bar has arrived") and thus miss the close of the previous bar?
Put another way, "does getBarStateSymbol() always return BARSTATE_NEWBAR when called after a bar closes, even though it may be called after the bar has seen more than one tick?"
I also wonder what would happen if the longer intervals were not multiples of the chart interval (for the same symbol), would I miss the longer bars there too (using getBarStateInterval())?
Perhaps the way the indicator works wrt time might affect the answer....
Although my indicator does some per-tick computation (for one or more symbols and intervals) and displays a value, I'm not really interested in that value until I get completed bars (in all symbols and time periods, further computation occurs then), in between the closes just the high, low and "price within the last few 10s of seconds" will do fine. So really what I would like is a time-based call to main()?
Thanks
I'm concerned that I don't understand getBarStateSymbol() though.
1) My main() will get called for every tick in my symbol context (computeOnClose() not set).
2) But before I get the first tick in a new bar in my symbol context, a different symbol could have had several ticks, even if the intervals are the same. What will happen when I call getBarStateSymbol() in that situation? Will I miss the BARSTATE_NEWBAR (defined as "the first tick of a new bar has arrived") and thus miss the close of the previous bar?
Put another way, "does getBarStateSymbol() always return BARSTATE_NEWBAR when called after a bar closes, even though it may be called after the bar has seen more than one tick?"
I also wonder what would happen if the longer intervals were not multiples of the chart interval (for the same symbol), would I miss the longer bars there too (using getBarStateInterval())?
Perhaps the way the indicator works wrt time might affect the answer....
Although my indicator does some per-tick computation (for one or more symbols and intervals) and displays a value, I'm not really interested in that value until I get completed bars (in all symbols and time periods, further computation occurs then), in between the closes just the high, low and "price within the last few 10s of seconds" will do fine. So really what I would like is a time-based call to main()?
Thanks
Comment