For the updates, this all revolves around the data that is incoming from the instrument.
So lets say you have a single data series in a chart with no indicators or NinjaScript items.
This data series and its graphical representations (bars on the chart) will be updated automatically when new data is received.
The current bar or the building bar depending on what time frame you have set will update accordingly.
Example: a 1 tick chart will generate a new bar for every tick of data, if you have last selected this would just be 1 bar for every last price that is received.
Example: a 1 minute chart will generate a new bar for every 1 minute of data that is received, if there is no market data no bars will be generated until more data is received.
Now for indicators and NinjaScript items and drawing objects.
A drawing object is not really attached to a specific dataseries on the chart in this sense, it is merely being drawn on this chart at X value and will be graphically updated when the value is updated for this object such as an OnBarUpdate event in the previous examples.
The same goes for the indicators, they will be updated in a few different ways
CaclulateOnBarClose true will allow the indicaors OnBarUpdate event to be called every time a bar closes in ANY data series on the chart
CaclulateOnBarClose false will allow the indicaors OnBarUpdate event to be called every time a tick is received in ANY data series on the chart.
The graphical representation to plots, or any other items that the indicator specifically is drawing will be updated on either of these events if the value that is being plotted changes otherwise it will retain its original value and graphics.
There are also other events that happen in Indicators such as OnMarketData which is similar to how OnBarUpdate works but this event happens for any price data item that is updated, so last, ask, bid, vol etc...
For the question on the SMA, if you add an SMA to a chart, the underlying code Sets the plots value in the OnBarUpdate event, you can look at this code if you go to Tools -> Edit NinjaScript -> Indicator and select the SMA and open it.
The SMA uses Value.Set to set its value for the plot rather than calling it by a name or using Values.
Value.set() would set the 0 index of Values where Values you can specify an index in the collection of plots such as Values[1].Set();
I look forward to being of further assistance.
Comment