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.
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?
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)