OPEN-SOURCE SCRIPT

Moving Average Filters Add-on w/ Expanded Source Types [Loxx]

Moving Average Filters Add-on w/ Expanded Source Types [Loxx] is a conglomeration of specialized and traditional moving averages that will be used in most of indicators that I publish moving forward. There are 39 moving averages included in this indicator as well as expanded source types including traditional Heiken Ashi and Better Heiken Ashi candles. You can read about the expanded source types clicking here. About half of these moving averages are closed source on other trading platforms. This indicator serves as a reference point for future public/private, open/closed source indicators that I publish to TradingView. Information about these moving averages was gleaned from various forex and trading forums and platforms as well as TASC publications and other assorted research publications.

________________________________________________________________

Included moving averages

ADXvma - Average Directional Volatility Moving Average
Linnsoft's ADXvma formula is a volatility-based moving average, with the volatility being determined by the value of the ADX indicator.
The ADXvma has the SMA in Chande's CMO replaced with an EMA, it then uses a few more layers of EMA smoothing before the "Volatility Index" is calculated.

A side effect is, those additional layers slow down the ADXvma when you compare it to Chande's Variable Index Dynamic Average VIDYA.
The ADXVMA provides support during uptrends and resistance during downtrends and will stay flat for longer, but will create some of the most accurate market signals when it decides to move.

Ahrens Moving Average
Richard D. Ahrens's Moving Average promises "Smoother Data" that isn't influenced by the occasional price spike. It works by using the Open and the Close in his formula so that the only time the Ahrens Moving Average will change is when the candlestick is either making new highs or new lows.

Alexander Moving Average - ALXMA
This Moving Average uses an elaborate smoothing formula and utilizes a 7 period Moving Average. It corresponds to fitting a second-order polynomial to seven consecutive observations. This moving average is rarely used in trading but is interesting as this Moving Average has been applied to diffusion indexes that tend to be very volatile.

Double Exponential Moving Average - DEMA
The Double Exponential Moving Average (DEMA) combines a smoothed EMA and a single EMA to provide a low-lag indicator. It's primary purpose is to reduce the amount of "lagging entry" opportunities, and like all Moving Averages, the DEMA confirms uptrends whenever price crosses on top of it and closes above it, and confirms downtrends when the price crosses under it and closes below it - but with significantly less lag.

Double Smoothed Exponential Moving Average - DSEMA
The Double Smoothed Exponential Moving Average is a lot less laggy compared to a traditional EMA. It's also considered a leading indicator compared to the EMA, and is best utilized whenever smoothness and speed of reaction to market changes are required.

Exponential Moving Average - EMA
The EMA places more significance on recent data points and moves closer to price than the SMA (Simple Moving Average). It reacts faster to volatility due to its emphasis on recent data and is known for its ability to give greater weight to recent and more relevant data. The EMA is therefore seen as an enhancement over the SMA.

Fast Exponential Moving Average - FEMA
An Exponential Moving Average with a short look-back period.

Fractal Adaptive Moving Average - FRAMA
The Fractal Adaptive Moving Average by John Ehlers is an intelligent adaptive Moving Average which takes the importance of price changes into account and follows price closely enough to display significant moves whilst remaining flat if price ranges. The FRAMA does this by dynamically adjusting the look-back period based on the market's fractal geometry.

Hull Moving Average - HMA
Alan Hull's HMA makes use of weighted moving averages to prioritize recent values and greatly reduce lag whilst maintaining the smoothness of a traditional Moving Average. For this reason, it's seen as a well-suited Moving Average for identifying entry points.

IE/2 - Early T3 by Tim Tilson
The IE/2 is a Moving Average that uses Linear Regression slope in its calculation to help with smoothing. It's a worthy Moving Average on it's own, even though it is the precursor and very early version of the famous "T3 Indicator".

Integral of Linear Regression Slope - ILRS
A Moving Average where the slope of a linear regression line is simply integrated as it is fitted in a moving window of length N (natural numbers in maths) across the data. The derivative of ILRS is the linear regression slope. ILRS is not the same as a SMA (Simple Moving Average) of length N, which is actually the midpoint of the linear regression line as it moves across the data.

Instantaneous Trendline
The Instantaneous Trendline is created by removing the dominant cycle component from the price information which makes this Moving Average suitable for medium to long-term trading.

Laguerre Filter
The Laguerre Filter is a smoothing filter which is based on Laguerre polynomials. The filter requires the current price, three prior prices, a user defined factor called Alpha to fill its calculation.
Adjusting the Alpha coefficient is used to increase or decrease its lag and it's smoothness.

Leader Exponential Moving Average
The Leader EMA was created by Giorgos E. Siligardos who created a Moving Average which was able to eliminate lag altogether whilst maintaining some smoothness. It was first described during his research paper "MACD Leader" where he applied this to the MACD to improve its signals and remove its lagging issue. This filter uses his leading MACD's "modified EMA" and can be used as a zero lag filter.

Linear Regression Value - LSMA (Least Squares Moving Average)
LSMA as a Moving Average is based on plotting the end point of the linear regression line. It compares the current value to the prior value and a determination is made of a possible trend, eg. the linear regression line is pointing up or down.

Linear Weighted Moving Average - LWMA
LWMA reacts to price quicker than the SMA and EMA. Although it's similar to the Simple Moving Average, the difference is that a weight coefficient is multiplied to the price which means the most recent price has the highest weighting, and each prior price has progressively less weight. The weights drop in a linear fashion.
McGinley Dynamic

John McGinley created this Moving Average to track price better than traditional Moving Averages. It does this by incorporating an automatic adjustment factor into its formula, which speeds (or slows) the indicator in trending, or ranging, markets.

McNicholl EMA
Dennis McNicholl developed this Moving Average to use as his center line for his "Better Bollinger Bands" indicator and was successful because it responded better to volatility changes over the standard SMA and managed to avoid common whipsaws.

Non lag moving average
The Non Lag Moving average follows price closely and gives very quick signals as well as early signals of price change. As a standalone Moving Average, it should not be used on its own, but as an additional confluence tool for early signals.

Parabolic Weighted Moving Average
The Parabolic Weighted Moving Average is a variation of the Linear Weighted Moving Average. The Linear Weighted Moving Average calculates the average by assigning different weight to each element in its calculation. The Parabolic Weighted Moving Average is a variation that allows weights to be changed to form a parabolic curve. It is done simply by using the Power parameter of this indicator.

Recursive Moving Trendline
Dennis Meyers's Recursive Moving Trendline uses a recursive (repeated application of a rule) polynomial fit, a technique that uses a small number of past values estimations of price and today's price to predict tomorrows price.

Simple Moving Average - SMA
The SMA calculates the average of a range of prices by adding recent prices and then dividing that figure by the number of time periods in the calculation average. It is the most basic Moving Average which is seen as a reliable tool for starting off with Moving Average studies. As reliable as it may be, the basic moving average will work better when it's enhanced into an EMA.

Sine Weighted Moving Average
The Sine Weighted Moving Average assigns the most weight at the middle of the data set. It does this by weighting from the first half of a Sine Wave Cycle and the most weighting is given to the data in the middle of that data set. The Sine WMA closely resembles the TMA (Triangular Moving Average).

Smoothed Moving Average - SMMA
The Smoothed Moving Average is similar to the Simple Moving Average (SMA), but aims to reduce noise rather than reduce lag. SMMA takes all prices into account and uses a long lookback period. Due to this, it's seen a an accurate yet laggy Moving Average.

Smoother
The Smoother filter is a faster-reacting smoothing technique which generates considerably less lag than the SMMA (Smoothed Moving Average). It gives earlier signals but can also create false signals due to its earlier reactions. This filter is sometimes wrongly mistaken for the superior Jurik Smoothing algorithm.

Super Smoother
The Super Smoother filter uses John Ehlers’s “Super Smoother” which consists of a a Two pole Butterworth filter combined with a 2-bar SMA (Simple Moving Average) that suppresses the 22050 Hz Nyquist frequency: A characteristic of a sampler, which converts a continuous function or signal into a discrete sequence.

Three pole Ehlers Butterworth
The 3 pole Ehlers Butterworth (as well as the Two pole Butterworth) are both superior alternatives to the EMA and SMA. They aim at producing less lag whilst maintaining accuracy. The 2 pole filter will give you a better approximation for price, whereas the 3 pole filter has superior smoothing.

Three pole Ehlers smoother
The 3 pole Ehlers smoother works almost as close to price as the above mentioned 3 Pole Ehlers Butterworth. It acts as a strong baseline for signals but removes some noise. Side by side, it hardly differs from the Three Pole Ehlers Butterworth but when examined closely, it has better overshoot reduction compared to the 3 pole Ehlers Butterworth.

Triangular Moving Average - TMA
The TMA is similar to the EMA but uses a different weighting scheme. Exponential and weighted Moving Averages will assign weight to the most recent price data. Simple moving averages will assign the weight equally across all the price data. With a TMA (Triangular Moving Average), it is double smoother (averaged twice) so the majority of the weight is assigned to the middle portion of the data.

The TMA and Sine Weighted Moving Average Filter are almost identical at times.

Triple Exponential Moving Average - TEMA
The TEMA uses multiple EMA calculations as well as subtracting lag to create a tool which can be used for scalping pullbacks. As it follows price closely, it's signals are considered very noisy and should only be used in extremely fast-paced trading conditions.

Two pole Ehlers Butterworth
The 2 pole Ehlers Butterworth (as well as the three pole Butterworth mentioned above) is another filter that cuts out the noise and follows the price closely. The 2 pole is seen as a faster, leading filter over the 3 pole and follows price a bit more closely. Analysts will utilize both a 2 pole and a 3 pole Butterworth on the same chart using the same period, but having both on chart allows its crosses to be traded.

Two pole Ehlers smoother
A smoother version of the Two pole Ehlers Butterworth. This filter is the faster version out of the 3 pole Ehlers Butterworth. It does a decent job at cutting out market noise whilst emphasizing a closer following to price over the 3 pole Ehlers.

Volume Weighted EMA - VEMA
Utilizing tick volume in MT4 (or real volume in MT5), this EMA will use the Volume reading in its decision to plot its moves. The more Volume it detects on a move, the more authority (confirmation) it has. And this EMA uses those Volume readings to plot its movements.

Studies show that tick volume and real volume have a very strong correlation, so using this filter in MT4 or MT5 produces very similar results and readings.

Zero Lag DEMA - Zero Lag Double Exponential Moving Average
John Ehlers's Zero Lag DEMA's aim is to eliminate the inherent lag associated with all trend following indicators which average a price over time. Because this is a Double Exponential Moving Average with Zero Lag, it has a tendency to overshoot and create a lot of false signals for swing trading. It can however be used for quick scalping or as a secondary indicator for confluence.

Zero Lag Moving Average
The Zero Lag Moving Average is described by its creator, John Ehlers, as a Moving Average with absolutely no delay. And it's for this reason that this filter will cause a lot of abrupt signals which will not be ideal for medium to long-term traders. This filter is designed to follow price as close as possible whilst de-lagging data instead of basing it on regular data. The way this is done is by attempting to remove the cumulative effect of the Moving Average.

Zero Lag TEMA - Zero Lag Triple Exponential Moving Average
Just like the Zero Lag DEMA, this filter will give you the fastest signals out of all the Zero Lag Moving Averages. This is useful for scalping but dangerous for medium to long-term traders, especially during market Volatility and news events. Having no lag, this filter also has no smoothing in its signals and can cause some very bizarre behavior when applied to certain indicators.
________________________________________________________________

What are Heiken Ashi "better" candles?
The "better formula" was proposed in an article/memo by BNP-Paribas (In Warrants & Zertifikate, No. 8, August 2004 (a monthly German magazine published by BNP Paribas, Frankfurt), there is an article by Sebastian Schmidt about further development (smoothing) of Heikin-Ashi chart.)

They proposed to use the following:
(Open+Close)/2+(((Close-Open)/( High-Low ))*ABS((Close-Open)/2))
instead of using :
haClose = (O+H+L+C)/4

According to that document the HA representation using their proposed formula is better than the traditional formula.

What are traditional Heiken-Ashi candles?
The Heikin-Ashi technique averages price data to create a Japanese candlestick chart that filters out market noise.

Heikin-Ashi charts, developed by Munehisa Homma in the 1700s, share some characteristics with standard candlestick charts but differ based on the values used to create each candle. Instead of using the open, high, low, and close like standard candlestick charts, the Heikin-Ashi technique uses a modified formula based on two-period averages. This gives the chart a smoother appearance, making it easier to spots trends and reversals, but also obscures gaps and some price data.

Expanded generic source types:
  • Close = close
  • Open = open
  • High = high
  • Low = low
  • Median = hl2
  • Typical = hlc3
  • Weighted = hlcc4
  • Average = ohlc4
  • Average Median Body = (open+close)/2
  • Trend Biased = (see code, too complex to explain here)
  • Trend Biased (extreme) = (see code, too complex to explain here)


Included:
-Toggle bar color on/off
-Toggle signal line on/off
educationalehlersheikenashiMoving Averagesvariety

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?


Public Telegram Group, t.me/algxtrading_public

VIP Membership Info: patreon.com/algxtrading/membership
Também em:

Aviso legal