Simple Moving Average (SMA)
Overview
A simple moving average (SMA) is the unweighted mean of the previous n data points. In technical analysis there are various popular values for n, like 10 days, 40 days, or 200 days. The period selected depends on the kind of movement one is concentrating on, such as short, intermediate, or long term. In any case moving average levels are interpreted as support in a rising market, or resistance in a falling market.
AnyChart Stock allows you to add SMA with desired period to any of your charts.
Mathematical description of the indicator please see at: Mathematical Description of Technical Indicators

Adding indicator
To add any indicator to the chart, you need to use Data Provider with the fields required by the indicator.
When such Data Provider is ready - you can add indicator to the chart.
Preparing Data Provider
SMA indicator needs Data Provider with Value or Close fields.
Sample XML of Data Provider, which can be used to create SMA indicator:
In case if you use Data Provider for OHLC or Candlestick XML looks like that:

Indicator Declaration
As soon as Data Provider is ready you can add it to the chart.
SMA indicator is usually used as an Overlay indicator and displayed on the same chart with data series (stock data). So we should declare it in the chart where series is displayed.
XML for SMA declaration:
As you can see SMA type is set to indicator using type attribute, and data_provider attribute specifies Data Provider with series and indicator data.
Live sample of the chart with SMA indicator:
Live Sample: Technical Indicators - Adding SMA to a Chart

Indicator parameters
Simple Moving Average Indicator has only one type specific parameter - period. Period is set in <sma_indicator> node, where all settings for SMA indicator are set.
XML for setting SMA period:
As you can see you just need to set period attribute in <sma_indicator> node, this attribute accepts any integer greater than 1.
Live sample below shows two SMA: SMA(20) and SMA(80):
Live Sample: Technical Indicators - SMA Parameters

Visualization
To visualize and tune visualization of technical indicators AnyChart Stock Component uses the same methods as for the data series.
By default SMA is shown as series of Line type, but you can use almost any of available series types to show it on the chart - Spline, Area or Stick, for example.
SMA indicator settings are contained in <sma_indicator> node, also in this node you can put <series> subnode - this node defines how exactly indicator is displayed on the chart. This node is identical to <series> node used to describe data series, so you can do with indicator anything you can do with series.
Sample XML for changing indicator visualization:
As you can see we set period, color, series type is set to Spline, line width is set to 2px, and name is set to "SMA(50)".
Live sample below shows settings described above:
Live Sample: Technical Indicators - SMA Visualization Settings
Another example of changing visualization of SMA indicator - it is shown as SplineArea:
Live Sample: Technical Indicators - Show SMA as SplineArea
