ChrisMoody

CM Willams %R and CCI BackGround Highlight

CM_Willams %R and CCI BackGround Highlight

Created By User Request

Indicator Highlights:

Creates Red BackGround Highlight if CCI Or Williams %R are Above Upper Line (User Defined)

Creates Green BackGround Highlight if CCI Or Williams %R are Below Lower Line (User Defined)

Ability to Turn On/Off either Williams %R or CCI Highlights in Inputs Tab via Check Boxes.

Ability To Set All Parameters for CCI and Williams %R in Inputs Tab.

Ability to Set High/Low “Threshold” Lines for Both CCI and Williams %R in Inputs Tab.

***I was asked if you could plot Back Ground Highlights on Two Individual Indicators AND have it show if BOTH Indicators were Overbought and Oversold.
***The answer is Yes. On the Chart Above I have the same Shade of Red and Green for Both Indicators. However, you will notice when Both Indicators Show OverBought…Both Plot Red Back Ground Highlights Which = a Brighter Red. The same is True for Oversold Conditions. The Green Shows a Brighter Shade of Green.

***VERY IMPORTANT - It is difficult for a programmer to release Indicators with this feature because depending on what color background you use on your charts…THE COLORS LOOK COMPLETELY DIFFERENT. So If You Don’t Use The Black Back Ground Shown Above You Most Likely Will Need To Adjust The Transparency, and Possibly The Colors Themselves!!!!

Reference Page
www.tradingview.com/v/UmsFo3hv/

Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
//Created by ChrisMoody on 10-17-2014 by user request.

study(title="CM_Willams %R and CCI BackGround Highlight", shorttitle="CM_%R and CCI", overlay=true)
length = input(21, minval=1, title="Williams %R Length")
willTL = input(10, minval=5, maxval=95, title="Williams %R Trigger Lines, 20 Converts to -20,-80...10 = -10,-90 etc.")
length2 = input(30, minval=1, title="CCI Length")
cciT = input(200, minval=50, maxval=200, title="CCI Trigger Lines, Converts to +100,-100 - +200,-200 etc.")
scci = input(true, title="Show CCI BackGround Highlight")
swill = input(true, title="Show Williams %R BackGround Highlight")
//CCI Code
ma = sma(close, length2)
cci = (close - ma) / (0.015 * dev(close, length2))
cciTA = 0 + cciT
cciTB = 0 - cciT
//CCI Criteria Definitions
cciA = cci > cciTA ? 1 : 0
cciB = cci < cciTB ? 1 : 0
//CCI Color Plots
condCCI = scci and cciA ? red : scci and cciB ? lime : na 
//Williams %R Definitions
upper = highest(length)
lower = lowest(length)
//Williams %R Criteria
willR = 100 * (close - upper) / (upper - lower)
willRAbove = willR > (0 - willTL) ? 1 : 0
willRBelow = willR < (-100 + willTL) ? 1 : 0
//Williams %R Color Definitions
condWill = swill and willRAbove ? red : swill and willRBelow ? lime : na

//Background Highlights
bgcolor(condCCI, transp=70)
bgcolor(condWill, transp=70)