jkswoods

JKSW Strength momentum index v2

Based on increasing and decreasing strength, this indicator will give a good indication of when a short or long opportunity is available.
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(title="JKSW Strength momentum index v2", shorttitle="JKSW SMI v2")

// Plot the RSI 
src = input(ohlc4, "Source")

shortlen = input(10, "Short term bars", integer)
midlen = input(35, "Mid term bars", integer)
longlen = input(110, "Long term bars", integer)

shortup = rma(max(change(src), 0), shortlen)
shortdown = rma(-min(change(src), 0), shortlen)

midup = rma(max(change(src), 0), midlen)
middown = rma(-min(change(src), 0), midlen)

longup = rma(max(change(src), 0), longlen)
longdown = rma(-min(change(src), 0), longlen)

short = shortdown == 0 ? 100 : shortup == 0 ? 0 : 100 - (100 / (1 + shortup / shortdown))
mid = middown == 0 ? 100 : midup == 0 ? 0 : 100 - (100 / (1 + midup / middown))
long = longdown == 0 ? 100 : longup == 0 ? 0 : 100 - (100 / (1 + longup / longdown))

// Overbought line
hline(80, "Overbought", black, dotted, 2)
// Oversold line
hline(20, "Oversold", black, dotted, 2)
// Mid line
hline(50, "Mid line", black, dotted)

// Plot on the chart where the points cross
color = short > mid ? short > long ? green : yellow : short < long ? red : yellow 
plot(short, color=color, title="SMI")
barcolor(color)