Member-only story

The Moving Average (Simple And Exponential) — Theory, Math, And Implementation In JavaScript

Oliver Jumpertz
9 min readJan 31, 2022

The moving average is a method to analyze data by creating a series of averages (from subsets ) of it.

Especially in finance, the moving average is used a lot to give buy or sell signals for stocks. And we will learn how it works and implement it in JavaScript.

The Moving Average (MA)

As you have already read, the moving average is a method to analyze data. It is, more specifically, usually used to identify trends, especially in finance, but you can also apply it to house prices, or else.

The moving average is calculated over a specific time-span which is customizable to your liking. You can calculate it for 10 days, 20 days, etc.

Common intervals are:

  • 10
  • 20
  • 50
  • 100
  • 200

with a variable unit (minutes, hours, days, etc.).

There are also multiple types of moving averages:

  • Simple Moving Average (SMA)
  • Exponential Moving Average (EMA)
  • Smoothed Moving Average (SMMA)
  • Linear Weighted Moving Average (LWMA)

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Already have an account? Sign in

Oliver Jumpertz
Oliver Jumpertz

Written by Oliver Jumpertz

Software Engineer - Content Creator

No responses yet

Write a response