[RS]HL Swing Convergence V0

EXPERIMENTAL: swing directional bias convergence.

Skrip open-source

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.

Inggin menggunakan skrip ini pada chart?
study("[RS]HL Swing Convergence V0", overlay=true)
length = input(4)
sh = sma(high, length)
sl = sma(low, length)
hh = highest(sh, length)
ll = lowest(sl, length)

swingH = high > hh[1]  or low > nz(swingL[1]) ? sl : na
swingL = low < ll[1] or high < nz(swingH[1]) ? sh : na

devH = swingH - stdev(sh, length)
devL = swingL + stdev(sl, length)

plot(swingH, style=linebr, color=green, linewidth=3)
plot(swingL, style=linebr, color=maroon, linewidth=3)

plot(devH, style=linebr, color=green, linewidth=1)
plot(devL, style=linebr, color=maroon, linewidth=1)