Williams %R

I needed the %R code in one of my indicators and TradingVeiw have it hidden. So here is my attempt.
Remove from Favorite Scripts Add to Favorite Scripts
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

plot(output, color=black, linewidth=1, title="%R line")
plot(highLine, title="overbought")
plot(lowLine, title= "oversold")


I am looking %R indicator with histogram plotted in...Can you please help me.
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Refer a friend My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out