Basically, it leverages the 'inline' and 'group' arguments of the 'input' function to provide you with a simple and straightforward way to:
- define your favorite moving averages by choosing type, length, source and color in the same tab and
- decide which moving averages to display in one click on a checkbox.
I do not like to have to select the color of an indicator in another tab. So, I put everything in the Inputs tab.
In addition, I like to "linewidth code" my moving averages so that a has a different thickness than an for example.
To do so, just define the line width that you want to associate with a moving average type in the "LINE WIDTH" section.
Once parameters are set to your liking, just check / uncheck the moving averages you want to display / hide (and save your settings as default).
This script handles 9 different moving averages and implements , , , , rma ( ) and (Hull).
It can easily be modified to change the number of available moving averages or include other types of moving averages.
The default settings provide an example of commonly used moving averages with associated colors ranked from Hot (more nervous) to Cold (less nervous) with the exception of displayed in gray.
These settings are just an example and are NOT meant to be used as a trading system! DYOR!
Hope it will be useful.
Enjoy and please let me know what you think in the comments.
Added smma (Smoothed moving average)
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.