jessebadry

Color Changing Moving Average

This is a script for creating a EMA or SMA that changes between red and green based on the calculated angle of the moving average, green when up red when down, which colors can be changed within style settings.

You can change how the angle is calculated changing the "Angle Period", "ATR Period" and "Angle Level" within input settings.
other input settings:
Length - length of the moving
Source - source of moving average data, recommend to keep this on "close"
Offset - plot the moving average on the chart with this given offset
Use EMA? - Choose either EMA or a SMA to plot

This script uses the angle calculation from this script: - Mango2Juice
And uses the same coloring technique from this script: - zathura643

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

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?