OPEN-SOURCE SCRIPT

CCI colored RSI

מעודכן
Knowing how to write code will hopefully be my saving grace with trading. Regardless, I have things to learn yet and the CCI indicator seems to get a lot of respect from chart-art minimalists.

On Investopedia, it says, “The CCI compares the current price to an average price over a period of time. The indicator fluctuates above or below zero, moving into positive or negative territory. While most values, approximately 75%, fall between -100 and +100, about 25% of the values fall outside this range, indicating a lot of weakness or strength in the price movement”

So I decided to have the regular RSI colored with information from the CCI that I just learned about. RSI color changes depending on whether or not the CCI was extended beyond the –100 and 100 extremities, as this indicates trend strength, and helps to not exit a trade early. Arrows are drawn for when the CCI crosses the 0 point of the CCI, which if overlaid, is the 50 on the RSI.

I have also added the option of having the background shaded according to CCI signals. Crosses OVER the –100 and 100 are the early and late bullish signals, while crosses UNDER the –100 and 100 are early and late bearish. I added to the RSI according to how Investopedia says to trade the CCI here.
investopedia.com/articles/active-trading/031914/how-traders-can-utilize-cci-commodity-channel-index-trade-stock-trends.asp

I added lines to the RSI to delineate the zones that Constance Brown talks about in her work with the RSI.


I kept the code simple to demonstrate my process, editing out lines instead of deleting, etc. I hope it helps somebody new to programming in Pine Script be able to hop right in.

Happy Turkey Day! Gobble Gobble. Say “Gobble Gobble” out loud. Do it.


Edit: Gratuity options removed. Try not to support terrorism this holiday season. And ffs turn off that race-baiting fact-destroying humanity threatening trash on your tv. We fight terrorism all day up in this mf. Savin stupid hoes and everything. Because it's the right thing to do. Not because Soros said so and paid TradingView enough.
הערות שחרור
I changed default values to include the features, which can still be toggled on/off.
I changed the style of it from line to stepline. It makes it easier to see the var by bar difference.

The differences in this version is mostly visual, and maybe cleaning up the code a little.

Assigning variables bullishcross and bearishcross before plotting values conditionally fixed a warning message.

The invisible plots at 15 and 85 keep the RSI from scaling based on output, generally. Now it will only scale if RSI is above/below those values, and it stays the same across charts.

Lines 37-42 include visual changes to make it clearer and to offset lines to the right of the current bar too. This had a nice affect, in my opinion.

Line 64 added something new. A horizontal "price-line" to better allow value comparison and better notice divergences.

Lines 69-70 were changed to improve placement of the RSI value. To offset the label into the future, a change to argument 'xloc''s value to xloc.bar_time from its default was made. Variable x, now required to be in Unix format, is timenow(the current Unix time, in milliseconds) + the number of milliseconds equal to 10 bars in the future. It's a lot. And every millisecond matters, so live life like you got a ping-time's amount of milliseconds left, for optimal results, of course.


In the chart above, I marked up the RSI and candles with trend-lines to show that the stylized plotted stepline in technicolor is still just the RSI. Trend-lines, divergences, and other ways to trade the RSI are still entirely the same. The original RSI is included below mine so that these changes can be easily observed.

Basically, all updates were intended to make this into a final draft. I felt that I should share a final version before moving on to something else. Community is key, and I had something to offer back.


I appreciate all the likes. It's a constant encouragement. So it is my sincere hope that traders find this to be both beneficial and share-worthy. Thank you.
Commodity Channel Index (CCI)Relative Strength Index (RSI)

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?

כתב ויתור