KXRCapital

CM_Williams_Acceleration-Deceleration-Osc_System

osc
60
osc
Chris Moody

오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?
//Created by user ChrisMoody by request for deejmoney
//Option to plot Traditional Williams Acceleration Deceleration Indicator - Currently a 4 color histogram.
//Option to plot Threshold bands based on a lookback period and percentile of the Highs and Lowes of Indicator.
 
study(title="CM_Williams_Acceleration-Deceleration-Osc_System", shorttitle="CM_Williams Accel_Decel_Osc_System", overlay=false)
src = (hl2)
savg = input(5, title="Short MA")
lavg = input(34, title="Long MA")
col_Hist = input(true, title=" Use Threshold Histogram = Check, or 4 Color Histogram")
pt = input(.90, title="Percent Threshold of Highs and Lows - Use Decimal for %")
lb = input(100, title="Lookback Period For Threshold Percent")
stl = input(true, title="Show Upper and Lower Threshold Lines?")
stml = input(true, title="Show Mid-Lines Based on LookBack Period of Highs and Lows")
sl = input(true, title="Show Acc/Dec Line?")
sd = input(true, title="Show Entry Cross After Threshold High or Low")
 
//Williams Acceleration/Deceleration Formula
short_Avg = sma(src, savg)
long_Avg = sma(src, lavg)
 
ao = short_Avg - long_Avg
ac = ao - sma(ao, savg)
 
//upper threshold lines
ach = highest(ac, lb)*pt
acl = lowest(ac, lb)*pt
 
//mid point threshold lines
achm = ach*.50
aclm = acl*.50
 
//4 color histogram
histA_IsUp = ac > ac[1] and ac > 0
histA_IsDown = ac < ac[1] and ac > 0
histB_IsDown = ac < ac[1] and ac <= 0
histB_IsUp = ac > ac[1] and ac <= 0
 
//Warniing Histogram
warn_color = ((ac > achm and ac[1] < achm[1]) or (ac < aclm and ac[1] > aclm[1]))
 
plot_color = histA_IsUp ? aqua : histA_IsDown ? blue : histB_IsDown ? red : histB_IsUp ? maroon : gray
 
//Histogram based on Threshold
col_pr = ac >= ach ? red  : ac <= acl ? green : warn_color ? orange : gray
 
col_Histogram = col_Hist ? col_pr : plot_color
 
cross_down = (ac[3] > ach[3] or ac[4] > ach[4] or ac[5] > ach[5] or ac[6] > ach[6] or ac[7] > ach[7]) and ((sma(ac, 1)[1]) > achm[1] and (sma(ac, 1)) <= achm)
 //or ac[8] > ach[8]
cross_up = (ac[3] < acl[3] or ac[4] < acl[4] or ac[5] < acl[5] or ac[6] < acl[6] or ac[7] < acl[7]) and (sma(ac, 1)[1]) < aclm
 
circleYPosition = achm
circleYPosition_l = aclm
 
plot(ac, title="Williams ADO", style=histogram, linewidth=4, color=col_Histogram)
plot(sl and sma(ac, 1) ? sma(ac, 1) : na, title="Acc/Dec Line", style=line, linewidth=4, color=white)
plot(0, title="0 Line", style=solid, linewidth=3, color=silver)
plot(stl and ach ? ach : na, title="High Threshold Line", style=line, linewidth=4, color=red)
plot(stl and acl ? acl : na, title="Low Threshold Line", style=line, linewidth=4, color=lime)
p1 = plot(stml and achm ? achm : na, title="MidPoint High Threshold Line", style=line, linewidth=2, color=gray)
p2 = plot(stml and aclm ? aclm : na, title="MidPoint Low Threshold Line", style=line, linewidth=2, color=gray)
fill(p1,p2, color=silver, transp=70)
//plot(sd and cross(sma(ac, 1), achm) ? circleYPosition : na,style=cross, linewidth=4, color=aqua)
plot(sd and cross_down and cross(sma(ac, 1), achm) ? circleYPosition : na,style=cross, linewidth=6, color=fuchsia)
plot(sd and cross_up and cross(sma(ac, 1), aclm) ? circleYPosition_l : na,style=cross, linewidth=6, color=yellow)