kurtsmock

MAs - A Bridge Too Far

kurtsmock Updated   
I scoured the internet and found all the ways someone can make an average.
Then I scoured all of TradingNiew to find all the things that people like moving averages to do.
Then I tried to come up with the different ways averages get applied to charts.
I put it all together and here it is.


Script Modes
  • 6 Unique, Independent Moving Averages
  • 18 line Ribbon
  • 3 line Envelope

Moving Average list
  • SMA
  • EMA
  • Double EMA
  • Triple EMA
  • Zero Lag EMA
  • ALMA (Default Attribute Values: (1) Offset: 0.85 (2) Sigma: 6)
  • Elastic VWMA
  • Fractal AMA (Default Attribute Values: (1) SC: 1 (2) FC: 200) |
  • Grover LSMA
  • Hull MA
  • Jurik MA (Default Attribute Values: (1) Phase: either: <-100, >100, or -99 to 99 (2) Power: 2)
  • Kauffman AMA (Default Attributes: (1) Fast: 2 (2) Slow: 30)
  • LSMA (Default Attributes: (1) Offset: 0 )
  • RMA
  • SMMA
  • Triangluar MA
  • Trend Regularity AMA
  • Volatility AMA
  • VWMA
  • WMA

Moving Average Options
  • Length
  • Type
  • Source
  • Offset
  • Timeframe
  • Attribute One - For use if chosen moving average has additional inputs
  • Attribute Two - For use if chosen moving average has two additional inputs

Override Options
The Ribbon - The ribbon is made of of 19 moving averages with the primary source being the center moving average, which is customized via the settings of Moving Average One. The moving average lengths used for the ribbon are displaced positively and negatively in percentages around Moving Average One (the center ma). The percentage difference between can be between 1% and 10% (0.01 - 0.10). This is changed in the "Displacement Between MAs" setting.

The Envelope - The Envelope is made up of an average (Moving Average One), an upper line, and a lower line. The upper and lower boundaries can be defined by Percent (Pct), Standard Deviation (BB), or ATR.

The Gradient - Since Envelopes and Guppies are used to determine trend, I added the colorization of trend. This is established through the use of the RCI. The RCI uses the same length as the moving average. RCI stands for Rank Correlation Index. There are multiple ways of calculating this. I am using the Spearman Rank Correlation Coefficient. What it basically does is rank the bars based on their close price (highest to lowest). The progression of that rank places it in context of the rest of the bars being ranked. If you take 20 bars, one is the highest and one is the lowest. And when plotted individually and taken together you use this to derive a value between -100 and 100 that describes the slope of the sample. For more information read the article
www.mql5.com/en/articles/5481

tldr; 100 = Max uptrend. -100 Max downtrend about + 10 to - 10 is neutral. The gradient on the envelope and ribbon goes red to green based on the RCI value.

Other -
Just for fun I included the option to color bars based on the RCI. I just got this gradient working (thanks to another TV user) and I thought it was fun.

Let me know what you think
Release Notes:
_solvebarsback function

Protected script
This script is published closed-source but you may use it freely. You can favorite it to use it on a chart. You cannot view or modify its source code.
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?