OPEN-SOURCE SCRIPT

4C Moving Avg Cloud

Updated
This indicator plots 2 moving averages with a cloud filling the area between the two.
It has the unique ability to choose between multiple moving average types, AND also paints the average based on slope direction, all in one indicator.

Most of the available moving average cloud indictors only allow one type of moving average for both averages together (e.g. 21 EMA with 200 EMA; or 21 SMA with 200 SMA)
The 4C Moving Avg Cloud features the ability to choose a different average type for each of the moving averages, and can be mixed and matched (e.g. 21 EMA with 200 SMA; or 21 RMA with 200 EMA; etc...)
Offers a selection for each of the moving averages to choose between: EMA, SMA, RMA, WMA
Credit: Some aspects of this part of the 4C moving avg cloud indicator were adapted from the "Best Cloud All MA" indicator Author=Daveatt

Another unique aspect of this moving avg cloud indicator is that is paints the moving average lines based on slope direction.
If the slope direction of the avg is up, it is painted one color, and if the avg is sloping down, it is painted another color (default: red).
This slope coloring is based on a 1 period lookback, and cant be adjusted.

Release Notes
This update adds a new feature that shades the cloud a different color when the moving averages get spread far apart in a "wide state".
Oliver Velez uses the 20 and 200 moving averages, and the relative distance between the 2 averages can be a very good guide as to the 'room' an instrument has to move.
A wide state between moving averages can signal that a move could be getting extended, or even have the potential to reverse.
The indicator now looks at a hidden Keltner Channel of the long period moving average, and when the short period avg is outside of the Keltner Channel, it shades the cloud a different color in that area.
The default 'wide state' settings on this indicator are set for 2min charts with the 21ema and 200sma, with a Keltner Channel multiplier of 8.
It is recommended that you look at your preferred time frames and moving avgs, and determine which Keltner multiplier works best for you. This can be done by looking through charts of your preferred settings, and note where price with the 2 moving averages were extended apart, and then price reversed. It is in those areas that the shading should be different. Please see the attached screenshot for reference.
The new feature can be turned on/off.
snapshot
Release Notes
Bug Fix for settings toggle "Show Wide State Cloud Shading"
Release Notes
2/27/23
Added a third moving average that can be toggled on/off.
The third moving average also is colored by slope direction.
The third moving average is se as the 8 ema by default.
Release Notes
2/28/23 Fixed bug from recent script changes
cloudMoving Averagesmovingaveragecloudslopeslopecolor

Open-source script

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer