RicardoSantos

[RS]Leading Momentum Oscilator V0

EXPERIMENTAL: Momentum oscilator based on offset, can also be used for divergence/convergence
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?
study("[RS]Leading Momentum Oscilator V0")
ma_length = input(title='ma length', type=integer, defval=5)
signal_length = input(title='signal length', type=integer, defval=21)
offset = input(title='offset', type=integer, defval=8)

leading_cd(_src, ma_l, signal_l, offset_l)=>
    _ma = sma(_src, ma_l)
    _signal = sma(_src, signal_l)
    _hist = _ma-offset(_signal, offset_l)
    _hist

o = leading_cd(open, ma_length, signal_length, offset)
h = leading_cd(high, ma_length, signal_length, offset)
l = leading_cd(low, ma_length, signal_length, offset)
c = leading_cd(close, ma_length, signal_length, offset)

plotcandle(o, h, l, c, color=c>o?green:c<o?maroon:gray)
hline(0)