Ultimate RSI Indicator for ThinkorSwim

Horserider, I feel terrible even asking again but after more testing I think it's still not plotting correctly in the Regression Channel — but It does seem like it's close — is there a way to change the lookback period for the Regression Channel to say 100 periods independent from the RSI look back period? I'm assuming that the Standard deviations will automatically plot to Regression Channel since they're based on that?

I also seem to have lost the 5 period EMA that uses the RSI as price source. (I'm sorry for the trouble) — Will the EMA and LRC use whatever period the chart is based on for length? That's standard for TOS charts?

Basically the Regression channel plotted with 1 and 2 Standard Deviations looking back further than than the RSI but uses the RSI as Price Source. (I'm attaching a screen grab from (Trade Station that has this functionality built in — things I love about Trade Station but I'm also really liking TOS and would love to get this little study set up in TOS) — thank you!
 
@Vosloo Set your own lookback.
Code:
input reglookback = 100;
regression = InertiaAll(RSI, reglookback);

##############################################

Add the 5 midline.


input AverageTypeBB = {default SMA, EMA};
input displaceBB = 0;
input lengthBB = 5;

plot midline ;
switch (AverageTypeBB) {
case SMA:
    midline   = reference BollingerBands(RSI, displaceBB, lengthBB , averageType = AverageType.EXPONENTIAL).Midline;
case EMA:
    midline   = reference BollingerBands(RSI, displaceBB, lengthBB, averageType = AverageType.EXPONENTIAL).Midline;
}

midline.SetDefaultColor(GetColor(3));
 
you’re awesome, thank you so much! Also made a difference adjusting how many days the 5min chart looks back. And I actually added my own input before I saw what you had done and am quite proud of myself since I have ZERO coding experience. Thanks so much again. Going to test this some more but I believe you nailed it.
 
What I added this the chart was distorted I was wondering if it’s because of the loom back could you post the full code updated so I can load it without any issues thanks
 
@horserider - Thanks. This is a great indicator; i'm liking it so far. Out of curiosity -- What was the reasoning for defaulting to 5 and 8 for the 2 different RSI lengths? Were those lengths determined based upon any prior research or studies? They seem to be working fine for lower time frames but was just interested in the reasoning behind them for my knowledge.

Thanks again!
 
Ok trying to remember, a study was posted by BenTen outlining a cross of the 8 RSI and the 5 SMA just by dragging the two into the same lower panel. This caused scaling problems. By making Bollinger bands of the RSI the scaling issue was solved and the signals the same. It is all on here somewhere. The scaled down version will show the basic crossovers.
 
horserider, THANK YOU for the Ultimate RSI, it works very well. You helped me with candle coloring several months ago. Thanks again!!
 
@horserider thank you for these awesome studies. Really enjoy looking at the stocks action with them.
I’m wondering if there is any scan on usethinkscript that you find complement these studies or do you just watch them in real-time against a personal watchlist that you’ve built up?
 
Kind of a vague question.

Hello, apologies for the vagueness; sharpening a question is critical. I'm new to all this and trying to wrap my head around it. Just curious if you build a watchlist in anticipation of the technicals in your Ultimate RSI study? I'm wondering if you utilize a TOS scan that you've created in conjunction with your Ultimate RSI studies, or if you scan more in a manual way based on some other criteria then filter down your watchlist by eyeing technicals?

Sometimes on this site, someone might post a study indicator, and along with it post a TOS link to a scan that works well with it. Again, sorry, I know my inquiry is still not well formed.
 
Ok thanks for clarifying the question. I do not scan for the RSI but you could scan RSI and midline cross if you wanted.
I trade a very few stocks regularly and just throw up the charts to see what they are doing.
Other trades would be from extreme conditions of oversold and overbought or big trends in sectors or news..
 
@british43 Try this. You did not specify color so made them all the same. Can change line colors in studies.

Code:
declare lower;
#RSI
input length = 5;
input over_Bought = 80;
input over_Sold = 20;
input price = close;
input averageType = AverageType.WILDERS;
input line = 50;
input showlabels = yes;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot lline = line;
plot line40 = 40;
plot line60 = 60;
plot line70 = 70;

#                ==== THE FIVE ====
RSI.DefineColor("Positive and Up", Color.GREEN);
RSI.DefineColor("Positive and Down", Color.DARK_GREEN);
RSI.DefineColor("Negative and Down", Color.RED);
RSI.DefineColor("Negative and Up", Color.DARK_RED);
RSI.AssignValueColor(if RSI >= 50 then if RSI > RSI[1] then RSI.Color("Positive and Up") else RSI.Color("Positive and Down") else if RSI < RSI[1] then RSI.Color("Negative and Down") else RSI.Color("Negative and Up"));


OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
line40.SetDefaultColor(GetColor(8));
line60.SetDefaultColor(GetColor(8));
line70.SetDefaultColor(GetColor(8));


AddLabel(ShowLabels, ("RSI 40"), if RSI > 40 then Color.GREEN else Color.RED)  ;
AddLabel(ShowLabels, ("RSI 60"), if RSI > 60 then Color.GREEN else Color.RED)  ;
AddLabel(ShowLabels, Concat("RSI 70:", Round(RSI)), if RSI > 70 then Color.GREEN else Color.RED)  ;


#plot 5;

input AverageTypeBB = {default SMA, EMA, HMA};
input displaceBB = 0;
input lengthBB = 5;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;

plot midline ;

switch (AverageTypeBB) {
case SMA:

    midline   = reference BollingerBands(RSI, displaceBB, lengthBB, Num_Dev_Dn, Num_Dev_up).Midline;
case EMA:

    midline   = reference BollingerBands(RSI, displaceBB, lengthBB, Num_Dev_Dn, Num_Dev_up, averageType = AverageType.EXPONENTIAL).Midline;
case HMA:

    midline   = reference BollingerBands(RSI, displaceBB, lengthBB, Num_Dev_Dn, Num_Dev_up, averageType = AverageType.EXPONENTIAL).Midline;
}

midline.SetDefaultColor(GetColor(3));
 
@british43 Try this. You did not specify color so made them all the same. Can change line colors in studies.

Code:
declare lower;
#RSI
input length = 5;
input over_Bought = 80;
input over_Sold = 20;
input price = close;
input averageType = AverageType.WILDERS;
input line = 50;
input showlabels = yes;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot lline = line;
plot line40 = 40;
plot line60 = 60;
plot line70 = 70;

#                ==== THE FIVE ====
RSI.DefineColor("Positive and Up", Color.GREEN);
RSI.DefineColor("Positive and Down", Color.DARK_GREEN);
RSI.DefineColor("Negative and Down", Color.RED);
RSI.DefineColor("Negative and Up", Color.DARK_RED);
RSI.AssignValueColor(if RSI >= 50 then if RSI > RSI[1] then RSI.Color("Positive and Up") else RSI.Color("Positive and Down") else if RSI < RSI[1] then RSI.Color("Negative and Down") else RSI.Color("Negative and Up"));


OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
line40.SetDefaultColor(GetColor(8));
line60.SetDefaultColor(GetColor(8));
line70.SetDefaultColor(GetColor(8));


AddLabel(ShowLabels, ("RSI 40"), if RSI > 40 then Color.GREEN else Color.RED)  ;
AddLabel(ShowLabels, ("RSI 60"), if RSI > 60 then Color.GREEN else Color.RED)  ;
AddLabel(ShowLabels, Concat("RSI 70:", Round(RSI)), if RSI > 70 then Color.GREEN else Color.RED)  ;


#plot 5;

input AverageTypeBB = {default SMA, EMA, HMA};
input displaceBB = 0;
input lengthBB = 5;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;

plot midline ;

switch (AverageTypeBB) {
case SMA:

    midline   = reference BollingerBands(RSI, displaceBB, lengthBB, Num_Dev_Dn, Num_Dev_up).Midline;
case EMA:

    midline   = reference BollingerBands(RSI, displaceBB, lengthBB, Num_Dev_Dn, Num_Dev_up, averageType = AverageType.EXPONENTIAL).Midline;
case HMA:

    midline   = reference BollingerBands(RSI, displaceBB, lengthBB, Num_Dev_Dn, Num_Dev_up, averageType = AverageType.EXPONENTIAL).Midline;
}

midline.SetDefaultColor(GetColor(3));
@horserider thank you for this. Is there anyway to add arrows such that when the Midline crosses the RSI line crossing back from overbought/oversold it shows on the lower study? Thx
 
Trying to add a:

input rsiMALength = 5; #hint rsiMALength: RSI Moving Average Length
input rsiAverageType = AverageType.SIMPLE;

Code:
  # RSI with Standard Deviation bands

declare lower;





# Inputs:


input Price = Close;


input RSIPeriod = 14;



input BBLength = 50;

input SD = 2.1;






# vars:


plot UpperBand;

plot LowerBand;

plot PctBrsia;


plot rsia;



rsia = reference RSI(length = RSIPeriod, Price = Price);


UpperBand = reference BollingerBands(price = rsia,

displace = 0,

length = BBLength,

Num_Dev_Dn = -SD,

Num_Dev_up = SD).UpperBand;

LowerBand = reference BollingerBands(price = rsia,

displace = 0,

length = BBLength,

Num_Dev_Dn = -SD,

Num_Dev_up = SD).LowerBand;

PctBrsia = (rsia - LowerBand) / (UpperBand - LowerBand);


plot Plot1 = PctBrsia;

plot Plot2 = 0;

plot Plot3 = 1;
 
@horserider can you share your scan settings? im getting too many signals with rsi over illine

Okay figured a scan out here it goes for anyone who wants to use it

From_horserider_on_Jul_25_1("length" = 9)."RSI" crosses above From_horserider_on_Jul_25_1("length" = 9)."midline" and From_horserider_on_Jul_25_1("length" = 9)."RSI" is less than 50

Also Changed Length BB to 20.
 
Last edited:
@horserider can you share your scan settings? im getting too many signals with rsi over illine

Okay figured a scan out here it goes for anyone who wants to use it

From_horserider_on_Jul_25_1("length" = 9)."RSI" crosses above From_horserider_on_Jul_25_1("length" = 9)."midline" and From_horserider_on_Jul_25_1("length" = 9)."RSI" is less than 50

Also Changed Length BB to 20.
hi can you please share the scanner
 
@horserider , would it be possible to create an RSI with divergences as the example in the link below but for TOS. Greatly appreciate your feedback:
https://es.tradingview.com/script/5gmbUNQV-Stoch-RSI-With-Color-Combination/

code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RRanjanFX
//@version=4
study(title="Stoch+RSI With Color Combination. ", shorttitle="Stoch+RSI By RRanjanFX", format=format.price, precision=2, resolution="")
odk = input(21, title="K", minval=1)
dP = input(7, title="D", minval=1)
sK = input(7, title="Smooth", minval=1)
lK = sma(stoch(close, high, low, odk), sK)
bnd = sma(lK, dP)
plot(bnd, title="%D", color=#FF6A00)


//RSI
rrfxlen = input(10, minval=1, title="Length")
rrfxsrc = input(close, "Source", type = input.source)
rrfxup = rma(max(change(rrfxsrc), 0), rrfxlen)
rrfxdown = rma(-min(change(rrfxsrc), 0), rrfxlen)
rrfxrsi = rrfxdown == 0 ? 100 : rrfxup == 0 ? 0 : 100 - (100 / (1 + rrfxup / rrfxdown))
plot(rrfxrsi, "RSI", color=#008902)


//Band & Fill Color
rrband1 = hline(80, "80 Band", color=#FF0000)
rrband0 = hline(70, "70 Band", color=#FF5353)
rrh0 = hline(30, "30 Band", color=#00B90E)
rrh1 = hline(20, "20 Band", color=#00B90E)
fill(rrband1, rrband0, color=#FF0000, transp=60, title="Background")
fill(rrh0, rrh1, color=#05AC00, transp=60, title="Background")
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
411 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