Hello, I am new to MarketScope coding. I'm looking at porting some of my indicators and packages to run on MarketScope.
One of the key differences that I noticed so far is that on my old platform, the chart was loaded with all the required bars (e.g. say 1000 bars). Bars were indexed from numBars-1 to 0 in this case, with 0 being the most recent. As new bars were added with the live data stream, the number of bars would increase of course, with bar 0 always being the most recent.
I understand that with MarketScope the bars are numbered the other way around, with 0 being the oldest, and source:size()-1 being the most recent I guess. That's ok.
But, one key difference with MarketScope is that you can extend the chart. (This wasn't possible with my old platform). So, if for example I scrolled back 2 months on the chart, new bars would be added.
Now, I saw some handling for host:execute("getHistory", ...) and host:execute("extendHistory", ...) which are used to extend the history. But this seems to be for manually added data streams. I didn't see this being done for the 'primary' data stream, i.e. instance.source. (By the way, do you use a special name for this stream? I'll call it the 'primary stream' for now). Does this 'primary stream' also need to be managed to get more data when the chart is re-sized, or is it handled automagically somehow?
When the chart is re-sized in this way, what happens to Update()? Does the 'mode' value indicator that I need to re-calculate the whole thing?
By the way, I also assume that Init() is only called once, when the indicator is added to the chart. Is Prepare() also only called once? What if the timeframe is changed? Does this call Prepare() again?
Sorry, for so many questions. I'll be on the learning curve for a while yet.