Choppiness Index and RSI For ThinkOrSwim

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Please can anyone Convert tv free indicator to TOS

Choppiness Index and RSI by ceyhun
https://www.tradingview.com/v/SduZEj4k/
find below

CSS:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © ceyhun
#indicator(title='Choppiness Index and RSI by ceyhun', format=format.price, precision=2, timeframe='')
# converted by sam4Cok@Samer800    - 07/2023
declare lower;

input ChopLength = 14;#, 'Chop Length', minval=1)
input offset = 0;#, 'Offset', minval=-500, maxval=500)
input rsiLength = 14;#, minval=1, title='Rsi Length')
input src = close;#, 'Source')
input BarColor = yes;#(true, 'Barcolor');

def na = Double.NaN;
def last = isNaN(close);
def ci = 100*Lg(Sum(ATR(Length=1),ChopLength)/(Highest(high,ChopLength) - Lowest(low,ChopLength)))/Lg(ChopLength);
def chopchange = if ci > 61.8 then -1 else
                 if ci < 38.2 then  1 else 0;#? #0000FF : #FFFF00
plot CHOP = ci[offset];#, 'CHOP', color=chopchange, offset=offset, linewidth=2)
CHOP.AssignValueColor(if chopchange>0 then Color.GREEN else
                      if chopchange<0 then Color.RED else Color.WHITE);

def nRSI = RSI(Price = src, Length = rsiLength);

def rsichange = if nRSI > 61.8 then 1 else
                if nRSI < 38.2 then -1 else 0;#? #FF0000 : #8E1599
plot rsi = nRSI;#, 'RSI', color=rsichange, linewidth=2)
rsi.SetLineWeight(2);
rsi.AssignValueColor(if rsichange>0 then Color.CYAN else
                     if rsichange<0 then Color.MAGENTA else Color.GRAY);
def band1 = if last then na else 70;#, 'Upper Band', color=#00FF00)
def band2 = if last then na else 61.8;#, 'Upper Band', color=#00FF00, linestyle=hline.style_dashed)
def band3 = if last then na else 38.2;#, 'Lower Band', color=#FF0000, linestyle=hline.style_dashed)
def band4 = if last then na else 30;#, 'Lower Band', color=#FF0000)


AddCloud(band1, band2, Color.DARK_GREEN,Color.DARK_GREEN,yes);
AddCloud(band3, band4, Color.DARK_RED,Color.DARK_RED,yes);

def change1 = if nrsi > ci then 1 else
              if nrsi < ci then -1 else 0;# #FF0000 : #FFFF00
AssignPriceColor(if !BarColor then Color.CURRENT else
                 if change1>0 then Color.GREEN else
                 if change1<0 then Color.RED else color.GRAY);


#--- END CODE
 
Can someone please assist with adjusting this simple script to INCLUDE & REMOVE the following:

TO INCLUDE: code in the script to change the color of the Candle Bars to my choosing and not the red/greens

TO REMOVE: the bottom portion without effecting the purpose of the indicator as display on the main chart. Do not want to have the bottom portion to be displayed on the Main Chart.


CURRENT SCRIPT:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © ceyhun
#indicator(title='Choppiness Index and RSI by ceyhun', format=format.price, precision=2, timeframe='')
# converted by sam4Cok@Samer800 - 07/2023
declare lower;

input ChopLength = 14;#, 'Chop Length', minval=1)
input offset = 0;#, 'Offset', minval=-500, maxval=500)
input rsiLength = 14;#, minval=1, title='Rsi Length')
input src = close;#, 'Source')
input BarColor = yes;#(true, 'Barcolor');

def na = Double.NaN;
def last = isNaN(close);
def ci = 100*Lg(Sum(ATR(Length=1),ChopLength)/(Highest(high,ChopLength) - Lowest(low,ChopLength)))/Lg(ChopLength);
def chopchange = if ci > 61.8 then -1 else
if ci < 38.2 then 1 else 0;#? #0000FF : #FFFF00
plot CHOP = ci[offset];#, 'CHOP', color=chopchange, offset=offset, linewidth=2)
CHOP.AssignValueColor(if chopchange>0 then Color.GREEN else
if chopchange<0 then Color.RED else Color.WHITE);

def nRSI = RSI(Price = src, Length = rsiLength);

def rsichange = if nRSI > 61.8 then 1 else
if nRSI < 38.2 then -1 else 0;#? #FF0000 : #8E1599
plot rsi = nRSI;#, 'RSI', color=rsichange, linewidth=2)
rsi.SetLineWeight(2);
rsi.AssignValueColor(if rsichange>0 then Color.CYAN else
if rsichange<0 then Color.MAGENTA else Color.GRAY);
def band1 = if last then na else 70;#, 'Upper Band', color=#00FF00)
def band2 = if last then na else 61.8;#, 'Upper Band', color=#00FF00, linestyle=hline.style_dashed)
def band3 = if last then na else 38.2;#, 'Lower Band', color=#FF0000, linestyle=hline.style_dashed)
def band4 = if last then na else 30;#, 'Lower Band', color=#FF0000)


AddCloud(band1, band2, Color.DARK_GREEN,Color.DARK_GREEN,yes);
AddCloud(band3, band4, Color.DARK_RED,Color.DARK_RED,yes);

def change1 = if nrsi > ci then 1 else
if nrsi < ci then -1 else 0;# #FF0000 : #FFFF00
AssignPriceColor(if !BarColor then Color.CURRENT else
if change1>0 then Color.GREEN else
if change1<0 then Color.RED else color.GRAY);
 

Attachments

  • one.jpg
    one.jpg
    42.8 KB · Views: 146
  • two.jpg
    two.jpg
    96 KB · Views: 148
Last edited by a moderator:
Can someone please assist with adjusting this simple script to INCLUDE & REMOVE the following:

TO INCLUDE: code in the script to change the color of the Candle Bars to my choosing and not the red/greens

TO REMOVE: the bottom portion without effecting the purpose of the indicator as display on the main chart. Do not want to have the bottom portion to be displayed on the Main Chart.

Why you should keep the script headers
  • shows respect and appreciation to the members who generously post contributions to the forum.
  • greatly increase the chances that a member will be able to assist you.
  • it helps with moving your question to the thread, in which it belongs.
Your post was edited to put headers back in.
To ensure a smooth experience and maintain your posting privileges on the forum, kindly refrain from removing script headers. Your cooperation is greatly appreciated!

Choppiness Index and RSI This is Candle Painting Only
Ruby:
# Choppiness Index and RSI by ceyhun  UPPER CHART Candle Painting ONLY
# converted by sam4Cok@Samer800 - 07/2023
input ChopLength = 14; input offset = 0; input rsiLength = 14; input src = close;
input BarColor = yes;#(true, 'Barcolor');

def na = Double.NaN; def last = isNaN(close);
def ci = 100*Lg(Sum(ATR(Length=1),ChopLength)/(Highest(high,ChopLength) - Lowest(low,ChopLength)))/Lg(ChopLength);
def chopchange = if ci > 61.8 then -1 else if ci < 38.2 then 1 else 0;
def nRSI = RSI(Price = src, Length = rsiLength);
def change1 = if nrsi > ci then 1 else if nrsi < ci then -1 else 0;

DefineGlobalColor("NotChop", CreateColor(217,61,255)) ;
DefineGlobalColor("Chop", CreateColor(255,216,61)) ;
AssignPriceColor(
if change1>0 then GlobalColor("NotChop") else
if change1<0 then GlobalColor("Chop") else color.current);
To modify the colors painted:
1. go to chart settings
2. scroll down to Global colors
3. click on the color that you want to change
4. go to the top of chart settings
5. click on save as Default to save your choices for all your future charting needs.
KfSr4Ko.jpg


shared chart link: http://tos.mx/vTLh9Dj
fYYGxJn.png
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
508 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top