Strength Momentum Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © parrabram - Inpired by LazyBear; JoshJaySalazar

//@version=5
indicator("Strength Momentum Indicator", "STRMOM")

// Input
srt = input(13, "Short Period", "This is the number used to calculate the periods of both the RSI and the ADX")
lng = input(21, "Long Period", "This is the number of periods used to calculate the linear regression curve")
ovs = input(70, "Oversold", "Oversold RSI")
ovb = input(30, "Overbought", "Overbought RSI")
crs = input(25, "Crossover", "ADX Crossover")
src = input(close, "Source")
mat = input.string("EMA", "MA Type", ["SMA", "EMA"])

// Calculate RSI
rsi = if ta.rsi(src, srt) > ovs or ta.rsi(src, srt) < ovb
    true
else
    false

// Calculate LRC
mac = if mat == "EMA"
    true
else
    false
lrc = if mac
    ta.linreg(src - math.avg(math.avg(ta.highest(high, lng), ta.lowest(low, lng)), ta.ema(src, lng)), lng, 0)
else
    ta.linreg(src - math.avg(math.avg(ta.highest(high, lng), ta.lowest(low, lng)), ta.sma(src, lng)), lng, 0)
cga = if rsi
    #fbc02d
else
    color.lime
cgb = if rsi
    #fff176
else
    color.maroon
cfa = if rsi
    #fff176
else
    color.green
cfb = if rsi
    #fbc02d
else
    color.red
hst = lrc >= 0 ? lrc[1] < lrc ? cga : cfa : lrc[1] < lrc ? cgb : cfb

// Calculate ADX
[dlp, dlm, adx] = ta.dmi(srt, srt)
clr = adx >= crs ? adx >= adx[1] ? color.orange : #ffcc80 : adx >= adx[1] ? color.blue : #90caf9

// Plot
plot(lrc, "LRC", hst, 4, plot.style_histogram)
plot(0, "ADX", clr, 2, plot.style_cross)