# SMA - Simple Moving Average

#### Description <a href="#description_66" id="description_66"></a>

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*](https://agenatrader.github.io/AgenaIndicator-documentation/indicators_oscillators/#moving-averages).

#### Further information <a href="#further-information_26" id="further-information_26"></a>

<http://www.forex-trading-online.de/indikatoren/simple-moving-average-sma>

<http://vtadwiki.vtad.de/index.php/SMA#Average-Off-Berechnungsverfahren_.28MMA.29>

#### Usage <a href="#usage_67" id="usage_67"></a>

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

#### Return value <a href="#return-value_64" id="return-value_64"></a>

**double**

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.

#### Parameters <a href="#parameters_57" id="parameters_57"></a>

inSeries Input data series for the indicator

period Number of bars included in the calculations

#### Visualization <a href="#visualization_61" id="visualization_61"></a>

![SMA - Simple Moving Average](https://agenatrader.github.io/AgenaIndicator-documentation/media/SMA.jpg)

#### Calculation <a href="#calculation_5" id="calculation_5"></a>

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

#### Example <a href="#example_63" id="example_63"></a>

```csharp
//Output of the SMA value
Print("The current SMA value is " + SMA(14)[0]);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://indicators.agenatrader.com/standard-indicators/moving-averages/sma-simple-moving-average.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
