Current Market Strength
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © JaxonBest

//@version=5
indicator("Current Market Strength", "CMS", false)

plcmt = 1
cv = open
tf = input.int(10, "Average", 2)
fhv = close

for i = 1 to tf
    if close[i] < cv
        cv := close[i]
        plcmt += 1
    if close[i] > fhv
        fhv := close[i]

mrsi = ta.rsi(close, tf) / 10
psv = false
cms = plcmt + mrsi, style=plot.style_line
cms_med = ((cms - mrsi) / 2) + mrsi
sma_length = input.int(14, "SMA")
sma = ta.sma(cms_med, sma_length)

plot(cms_med, "CMS", color.orange)
plot(sma, "SCMS", color.blue)