Simple Moving Average (SMA) Algorithm

From GM-RKB
(Redirected from Simple Moving Average (SVA))
Jump to navigation Jump to search

A Simple Moving Average (SMA) Algorithm is a moving average algorithm that ...



References

2021

  • (Wikipedia, 2021) ⇒ https://en.wikipedia.org/wiki/Moving_average#Simple_moving_average_(boxcar_filter) Retrieved:2021-3-1.
    • In financial applications a simple moving average (SMA) is the unweighted mean of the previous [math]\displaystyle{ n }[/math] data-points. However, in science and engineering, the mean is normally taken from an equal number of data on either side of a central value. This ensures that variations in the mean are aligned with the variations in the data rather than being shifted in time.

      An example of a simple equally weighted running mean for a [math]\displaystyle{ n }[/math]-day sample of the closing price is the mean of the previous [math]\displaystyle{ n }[/math] days' closing prices. Let those prices be [math]\displaystyle{ p_{1}, p_{2}, \dots, p_{n} }[/math]. Let the mean over the first [math]\displaystyle{ k }[/math] data-points be [math]\displaystyle{ \overline{p_{k}} }[/math]. Thus, the mean over all the data-points is calculated as:

      [math]\displaystyle{ \begin{align} \overline{p_{n}} &= \frac{p_{1} + p_{2} + \cdots + p_{n}}{n} \\ &= \frac{1}{n} \sum_{i=1}^{n} p_{i} \end{align} }[/math]

      This means that the moving average filter can be computed quite cheaply on real time data with a FIFO / circular buffer.