PINE LIBRARY

Extended Moving Average (MA) Library

Updated
This Extended Moving Average Library is a sophisticated and comprehensive tool for traders seeking to expand their arsenal of moving averages for more nuanced and detailed technical analysis.
The library contains various types of moving averages, each with two versions - one that accepts a simple constant length parameter and another that accepts a series or changing length parameter.
This makes the library highly versatile and suitable for a wide range of strategies and trading styles.


Moving Averages Included:

Simple Moving Average (SMA): This is the most basic type of moving average. It calculates the average of a selected range of prices, typically closing prices, by the number of periods in that range.

Exponential Moving Average (EMA): This type of moving average gives more weight to the latest data and is thus more responsive to new price information. This can help traders to react faster to recent price changes.

Double Exponential Moving Average (DEMA): This is a composite of a single exponential moving average, a double exponential moving average, and an exponential moving average of a triple exponential moving average. It aims to eliminate lag, which is a key drawback of using moving averages.

Jurik Moving Average (JMA): This is a versatile and responsive moving average that can be adjusted for market speed. It is designed to stay balanced and responsive, regardless of how long or short it is.

Kaufman's Adaptive Moving Average (KAMA): This moving average is designed to account for market noise or volatility. KAMA will closely follow prices when the price swings are relatively small and the noise is low.

Smoothed Moving Average (SMMA): This type of moving average applies equal weighting to all observations and smooths out the data.

Triangular Moving Average (TMA): This is a double smoothed simple moving average, calculated by averaging the simple moving averages of a dataset.

True Strength Force (TSF): This is a moving average of the linear regression line, a statistical tool used to predict future values from past values.

Volume Moving Average (VMA): This is a simple moving average of a volume, which can help to identify trends in volume.

Volume Adjusted Moving Average (VAMA): This moving average adjusts for volume and can be more responsive to volume changes.

Zero Lag Exponential Moving Average (ZLEMA): This type of moving average aims to eliminate the lag in traditional EMAs, making it more responsive to recent price changes.

Selector: The selector function allows users to easily select and apply any of the moving averages included in the library inside their strategy.

This library provides a broad selection of moving averages to choose from, allowing you to experiment with different types and find the one that best suits your trading strategy.
By providing both simple and series versions for each moving average, this library offers great flexibility, enabling users to pass both constant and changing length parameters as needed.
Release Notes
v2
I added a lot of new moving averages.
At the bottom of this library is a selectMA input parameter, it contains all currently working MA's that are ready to use.
I will continue my work on this library to fix bugs, finish some other MA's and to provide one-stop shop for all kind of moving averages.

Some of the new code was inspired by or copied from other members of TradingView community and I want to thank them for that:
everget
alexgrover
HPotter
KivancOzbilgic
LazyBear
Release Notes
v3

Some functions were fixed with correct implementation
Release Notes
- RMA added
- Bug fixes
Release Notes

Updated:
Kaufman's Adaptive MA calculated closely to original implementation
MATHmoving_averagestatisticstechindicator

Pine library

In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House rules.


Also on:

Disclaimer