Momentum Covariance Oscillator by Tenozen
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Tenozen

//@version=5
indicator("Momentum Oscillator", overlay=false, precision= 3)

src = input.source(close,"Source")
len_av = input.int(10, "Average Length")
use_smooth = input.bool(false, "Use Smoothed Line?")
len_sm_av = input.int(50, "Smoothed Momentum Length")
use_manual = input.bool(false, "Use manual ticker?")
sym_trade = input.symbol("XAUUSD","Symbol")
req = request.security(sym_trade,timeframe.period,src)

average = use_manual? ta.rma(req, len_av) : ta.rma(src, len_av)

yt_x = use_manual? req - average[1] : src - average[1]

unitless = use_manual? yt_x/req : yt_x/src

yt_x_av = ta.rma(unitless, len_sm_av)

plot(unitless, "Momentum Oscillator", color.new(color.white, 50))
plot(use_smooth? yt_x_av: na,"Smoothed", color.new(color.yellow, 50))
hline(0, "Zero Line", color.new(color.white,50),linestyle = hline.style_dotted)