SMA - Simple Moving Average


The SMA is the most well-known average, representing the simplest method of displaying the trend direction in a chart. In mathematical terms, this is the arithmetic mean of a number of individual lengths. It is called “moving” because to establish an average, the oldest value is always sacrificed to make space for the new incoming price change. Fundamentally speaking, the period length influences the intensity of the smoothing. Shorter periods (such as 10 days) will mean that the indicator follows the price changes quite closely. The SMA has a few disadvantages, which is why several adaptations of this indicator have been developed in the last few years. One of the biggest disadvantages is the fact that the indicator tends to lag, and the equal weighting for all data inputs across time intervals. You can find more general interpretations and meanings here: Moving Averages.

Further information


SMA(int period)
SMA(IDataSeries InSeries, int period)
SMA(int period)[int barsAgo]
SMA(IDataSeries InSeries, int period)[int barsAgo]

Return value

When using this method with an index (e.g. SMA(14)[int barsAgo] ), the value of the indicator will be issued for the referenced bar.


inSeries Input data series for the indicator
period Number of bars included in the calculations


SMA - Simple Moving Average


Value.Set((last + InSeries[0] - InSeries[Period]) / Math.Min(ProcessingBarIndex, Period));


//Output of the SMA value
Print("The current SMA value is " + SMA(14)[0]);
Last modified 1yr ago