Per a recommendation, I'm posting here a request to have the following TradingView indicator for a Stochastic RSI with Divergence converted into Thinkscript. I like using the Stochastic RSI vs. regular/fast/slow or full stochastics because it includes both a price and relative strength. The sorce code is below under the link to the source page. If there is anything else that I might need to provide, please let me know. Thanks in advance.
https://www.tradingview.com/script/3ogyZpSE-Stochastic-RSI-with-Divergences/
//@version=3
//Log RSI by @fskrypt
//Divergences by @RicardoSantos (@JustUncleL's edit)
//Edited by @NeoButane 8 Aug. 2018
study(title="Stochastic RSI with Divergences", shorttitle="Stoch RSI Divs", precision=0)
smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)
uselog = input(true, title="Log")
srcIn = input(close, type=source, title="Source")
showdivs = input(true, title="Show Divergences")
showhidden = input(false, title="Show Hidden Divergences")
showchan = input(false, title="Show Divergences Channel")
src = uselog ? log(srcIn) : srcIn
rsi1 = rsi(src, lengthRSI)
kk = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(kk, smoothD)
hm = input(false, title="Use Average of both K & D")
k = hm ? avg(kk, d) : kk
a = plot(kk, color=blue, linewidth=1, transp=0, title="K")
b = plot(d, color=orange, linewidth=1, transp=0, title="D")
f = kk >= d ? blue : orange
fill(a, b, title="KD Fill", color=f)
lower = hline(20, title="Lower Band")
upper = hline(80, title="Upper Band")
fill(upper, lower, color=aqua, transp=95, title="Background")
// plotshape(cross(kk, d) and kk > d ? 80 : na, title="Crossover", color=green, style=shape.circle, location=location.absolute)
// plotshape(cross(kk, d) and d > kk ? 20 : na, title="Crossunder", color=red, style=shape.circle, location=location.absolute)
//------------------------------
//@RicardoSantos' Divergence Script
f_top_fractal(_src)=>_src[4] < _src[2] and _src[3] < _src[2] and _src[2] > _src[1] and _src[2] > _src[0]
f_bot_fractal(_src)=>_src[4] > _src[2] and _src[3] > _src[2] and _src[2] < _src[1] and _src[2] < _src[0]
f_fractalize(_src)=>f_top_fractal(_src) ? 1 : f_bot_fractal(_src) ? -1 : 0
//-------------------------
fractal_top = f_fractalize(k) > 0 ? k[2] : na
fractal_bot = f_fractalize(k) < 0 ? k[2] : na
high_prev = valuewhen(fractal_top, k[2], 0)[2]
high_price = valuewhen(fractal_top, high[2], 0)[2]
low_prev = valuewhen(fractal_bot, k[2], 0)[2]
low_price = valuewhen(fractal_bot, low[2], 0)[2]
regular_bearish_div = fractal_top and high[2] > high_price and k[2] < high_prev
hidden_bearish_div = fractal_top and high[2] < high_price and k[2] > high_prev
regular_bullish_div = fractal_bot and low[2] < low_price and k[2] > low_prev
hidden_bullish_div = fractal_bot and low[2] > low_price and k[2] < low_prev
//-------------------------
plot(showchan?fractal_top:na, title="Top Div Channel", offset=-2, color=gray)
plot(showchan?fractal_bot:na, title="Bottom Div Channel", offset=-2, color=gray)
col1 = regular_bearish_div ? red : hidden_bearish_div and showhidden ? red : na
col2 = regular_bullish_div ? green : hidden_bullish_div and showhidden ? green : na
col3 = regular_bearish_div ? red : hidden_bearish_div and showhidden ? red : showchan ? gray : na
col4 = regular_bullish_div ? green : hidden_bullish_div and showhidden ? green : showchan ? gray : na
plot(title='H F', series=showdivs and fractal_top ? k[2] : na, color=col1, linewidth=2, offset=-2)
plot(title='L F', series=showdivs and fractal_bot ? k[2] : na, color=col2, linewidth=2, offset=-2)
plot(title='H D', series=showdivs and fractal_top ? k[2] : na, style=circles, color=col3, linewidth=3, offset=-2)
plot(title='L D', series=showdivs and fractal_bot ? k[2] : na, style=circles, color=col4, linewidth=3, offset=-2)
plotshape(title='+RBD', series=showdivs and regular_bearish_div ? k[2] : na, text='R', style=shape.labeldown, location=location.absolute, color=red, textcolor=white, offset=-2)
plotshape(title='+HBD', series=showdivs and hidden_bearish_div and showhidden ? k[2] : na, text='H', style=shape.labeldown, location=location.absolute, color=red, textcolor=white, offset=-2)
plotshape(title='-RBD', series=showdivs and regular_bullish_div ? k[2] : na, text='R', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)
plotshape(title='-HBD', series=showdivs and hidden_bullish_div and showhidden ? k[2] : na, text='H', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)
alertcondition(regular_bearish_div, "Regular Bearish Stoch RSI", "Regular Bearish div. on SRSI")
alertcondition(regular_bullish_div, "Regular Bullish Stoch RSI", "Regular Bullish div. on SRSI")
alertcondition(hidden_bearish_div, "Hidden Bearish Stoch RSI", "Hidden Bearish div. on SRSI")
alertcondition(hidden_bullish_div, "Hidden Bullish Stoch RSI", "Hidden Bullish div. on SRSI")