tiwaryshailesh

STY-Divergence

draws a blue line representing the divergence between a 3-period moving average (3MA) close and the current candle high, and a red line representing the divergence between a 20-period moving average (20MA) close and the 3MA close
This script calculates the moving averages for both 3-period and 20-period and then computes the divergences as described. It plots the lines with blue color if the divergence is positive and red if negative. Adjust the length of moving averages or other parameters according to your preference.
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?