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.
نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الكود في منشور تحكمه قواعد الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟
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)