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)