When plotting the Stochastics K line, Pine chops off my peaks and valleys at 100 and 0. Is there a way to stretch beyond this scale and get true peaks and valleys? (How would I modify the 0 to 100?)
My code:
rsiLength = input(title="RSI Length", type=input.integer, defval=14)
lbLength = input(title="Look Back Length", type=input.integer, defval=5)
avgLength = input(title="Average Length", type=input.integer, defval=8)
drawSig = input(title="Signal On/Off?", type=input.bool, defval=false)
sigLength = input(title="Signal Length", type=input.integer, defval=6)
src = input(title="Source", type=input.source, defval=close)
ob = input(title="Over Bought", type=input.float, defval=50.0)
os = input(title="Over Sold", type=input.float, defval=30.0)
// Calculate Stochastics
rsi = rsi(src, rsiLength)
k = sma(stoch(rsi, rsi, rsi, lbLength), avgLength)
plot(series=k, title="Stochastics K", color=color.orange, linewidth=2)
h1 = hline(price=ob, title="Overbought", color=color.red)
h2 = hline(price=os, title="Oversold", color=color.green)
hline(price=(ob + os) / 2, title="Center", color=color.gray, linestyle=hline.style_dashed)
The picture shows different length inputs, but I don't remember what they were (I was playing around with them)