GunArm

Willy Bands

Reverse engineered Willy21Ema13 to show (on chart) the levels price would have to reach to be overbought/oversold given recent price history.
By default it only shows the Williams%R with length 21.
If you change the settings it will do the same for the Ema13 of the Willy21, however because the ema is "harder" to breach, the lines are much farther away and looks really obnoxious on chart.
Open-source script

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.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study(title="Willy Bands", overlay=true)
// Created by GunArm July 6 2014
// Not exactly Groundbreaking, but hey ;p
// Thanks MagnusTradingGroup, LazyBear, and lucky_Hard for suggestions

willyLength = input(21, title="Williams Length", minval=1) 
ob_level = input(-20, title="Overbought level", minval=-100, maxval=0)
os_level = input(-80, title="Oversold level",  minval=-100, maxval=0)
noEma = input(title="Williams%R only (no EMA)", type=bool, defval=true)
emaLength = input(13, title="Ema Length", minval=1) 

upper = highest(willyLength)
lower = lowest(willyLength)
alpha = 2/(emaLength + 1)

currentWillyEma = ema(100 * (close - upper) / (upper - lower), emaLength)

InverseWilly(result) => upper + (result * (upper - lower)/100)
InverseEma(currentEma, targetEma) => ((targetEma - currentEma)/alpha) + currentEma

ob_Willy = InverseWilly(ob_level)
ob_WillyEma = InverseWilly(InverseEma(currentWillyEma, ob_level))

os_Willy = InverseWilly(os_level)
os_WillyEma = InverseWilly(InverseEma(currentWillyEma, os_level))

plot(noEma ? ob_Willy : ob_WillyEma, color = red)
plot(noEma ? os_Willy : os_WillyEma, color = green)