I needed the %R code in one of my indicators and TradingVeiw have it hidden. So here is my attempt.
study(title="Williams %R ", shorttitle="%R") // Williams %R highLine = input(90) lowLine = input(10) length = input(10, minval=1) upper = highest(length) lower = lowest(length) output = 100* (close - upper) / (upper - lower) + 100 //Plots plot(output, color=black, linewidth=1, title="%R line") plot(highLine, title="overbought") plot(lowLine, title= "oversold")