Need Help with RSI on chart indicator.

JohnWick4

New member
Hello All,

having an issue designing this indicator. I would like to see a color change for RSI 30, 25, and 20. for some reason my code is not taking in TOS.

Any one able to help with this. Thanks in advance.

code below line.
--------------------------------------------------------------------------------------------------------------------


### Updated and re-designed by Everton Foster 9/11/2022
## Version 0.01



input KCFactor = 3.0;


plot extendedLong3 = close > KeltnerChannels(factor = KCFactor).UpperBand and RSI() > 75;

plot extendedLong2 = close > KeltnerChannels(factor = KCFactor).UpperBand and RSI() > 72;

plot extendedLong1 = close > KeltnerChannels(factor = KCFactor).UpperBand and RSI() > 70;




plot extendedShort1 = close < KeltnerChannels(factor = KCFactor).LowerBand and RSI() < 30;

plot extendedShort2 = close < KeltnerChannels(factor = KCFactor).LowerBand and RSI() < 25;

plot extendedShort3 = close < KeltnerChannels(factor = KCFactor).LowerBand and RSI() < 20;




extendedLong3.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Up);

extendedLong2.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Up);

extendedLong1.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Up);




extendedShort1.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Down);

extendedShort2.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Down);

extendedShort3.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Down);




extendedLong3.setDefaultColor(Color.red);

extendedLong2.setDefaultColor(Color.orange);

extendedLong1.setDefaultColor(Color.yellow);



extendedShort1.setDefaultColor(Color.white);

extendedShort2.setDefaultColor(Color.blue);

extendedShort3.setDefaultColor(Color.green);
 
Solution
Hello All,

having an issue designing this indicator. I would like to see a color change for RSI 30, 25, and 20. for some reason my code is not taking in TOS.

Any one able to help with this. Thanks in advance.

code below line.
--------------------------------------------------------------------------------------------------------------------


### Updated and re-designed by Everton Foster 9/11/2022
## Version 0.01

input KCFactor = 3.0;
plot extendedLong3 = close > KeltnerChannels(factor = KCFactor).UpperBand and RSI() > 75;
plot extendedLong2 = close > KeltnerChannels(factor = KCFactor).UpperBand and RSI() > 72;
plot extendedLong1 = close > KeltnerChannels(factor = KCFactor).UpperBand and RSI() > 70;

plot extendedShort1 = close...

halcyonguy

Well-known member
VIP
Lifetime
Hello All,

having an issue designing this indicator. I would like to see a color change for RSI 30, 25, and 20. for some reason my code is not taking in TOS.

Any one able to help with this. Thanks in advance.

code below line.
--------------------------------------------------------------------------------------------------------------------


### Updated and re-designed by Everton Foster 9/11/2022
## Version 0.01

input KCFactor = 3.0;
plot extendedLong3 = close > KeltnerChannels(factor = KCFactor).UpperBand and RSI() > 75;
plot extendedLong2 = close > KeltnerChannels(factor = KCFactor).UpperBand and RSI() > 72;
plot extendedLong1 = close > KeltnerChannels(factor = KCFactor).UpperBand and RSI() > 70;

plot extendedShort1 = close < KeltnerChannels(factor = KCFactor).LowerBand and RSI() < 30;
plot extendedShort2 = close < KeltnerChannels(factor = KCFactor).LowerBand and RSI() < 25;
plot extendedShort3 = close < KeltnerChannels(factor = KCFactor).LowerBand and RSI() < 20;

extendedLong3.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Up);
extendedLong2.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Up);
extendedLong1.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Up);
extendedShort1.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Down);
extendedShort2.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Down);
extendedShort3.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Down);
extendedLong3.setDefaultColor(Color.red);
extendedLong2.setDefaultColor(Color.orange);
extendedLong1.setDefaultColor(Color.yellow);
extendedShort1.setDefaultColor(Color.white);
extendedShort2.setDefaultColor(Color.blue);
extendedShort3.setDefaultColor(Color.green);

please post code in a code window, click on </> in the header of a post

---------------------------------------------

issues,
there can be multiple plots that will be true and plot on top of each other. not sure which color will appear, but probably not the desired one.
could possibly fix it by reordering the short plot formulas, to be 20, 25, 30
shorts, you are testing 30 first, when you should be testing 20 first. then 25, then 30.

or, just use 1 plot formula for long and 1 plot formula for short, and plot just 1 shape for each, not 3.

i changed orange to magenta, as orange is too close to yellow

Code:
# rsi_color_bands_01

input KCFactor = 3.0;
def kup = KeltnerChannels(factor = KCFactor).UpperBand;
def kdwn = KeltnerChannels(factor = KCFactor).LowerBand;

input show_keltner_lines = no;
plot zu = if show_keltner_lines then kup else double.nan;
plot zd = if show_keltner_lines then kdwn else double.nan;

# compare rsi to the smallest # in plot.  use all rngs in color
plot exlong = close > kup and RSI() > 70;
exlong.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Up);
# 1st compare is the biggest rsi
exlong.AssignValueColor(if
close > kup and RSI() > 75 then Color.red
else if close > kup and RSI() > 72 then Color.magenta
else if close > kup and RSI() > 70 then Color.yellow
else color.gray);
exlong.setlineweight(3);

# compare rsi to the biggest # in plot.  use all rngs in color
plot exshort = close < kdwn and RSI() <30;
exshort.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Down);
# 1st compare is the smallest rsi
exshort.AssignValueColor(if
close < kdwn and RSI() < 20 then Color.green
else if close < kdwn and RSI() < 25 then Color.blue
else if close < kdwn and RSI() <30 then Color.white
else color.gray);
 
Solution

JohnWick4

New member
please post code in a code window, click on </> in the header of a post

---------------------------------------------

issues,
there can be multiple plots that will be true and plot on top of each other. not sure which color will appear, but probably not the desired one.
could possibly fix it by reordering the short plot formulas, to be 20, 25, 30
shorts, you are testing 30 first, when you should be testing 20 first. then 25, then 30.

or, just use 1 plot formula for long and 1 plot formula for short, and plot just 1 shape for each, not 3.

i changed orange to magenta, as orange is too close to yellow

Code:
# rsi_color_bands_01

input KCFactor = 3.0;
def kup = KeltnerChannels(factor = KCFactor).UpperBand;
def kdwn = KeltnerChannels(factor = KCFactor).LowerBand;

input show_keltner_lines = no;
plot zu = if show_keltner_lines then kup else double.nan;
plot zd = if show_keltner_lines then kdwn else double.nan;

# compare rsi to the smallest # in plot.  use all rngs in color
plot exlong = close > kup and RSI() > 70;
exlong.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Up);
# 1st compare is the biggest rsi
exlong.AssignValueColor(if
close > kup and RSI() > 75 then Color.red
else if close > kup and RSI() > 72 then Color.magenta
else if close > kup and RSI() > 70 then Color.yellow
else color.gray);
exlong.setlineweight(3);

# compare rsi to the biggest # in plot.  use all rngs in color
plot exshort = close < kdwn and RSI() <30;
exshort.setPaintingStrategy(PaintingStrategy.Boolean_Wedge_Down);
# 1st compare is the smallest rsi
exshort.AssignValueColor(if
close < kdwn and RSI() < 20 then Color.green
else if close < kdwn and RSI() < 25 then Color.blue
else if close < kdwn and RSI() <30 then Color.white
else color.gray);
Thnks Hal, The code works great.
 

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.
Top