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/

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
//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)