Ultimate RSI Indicator for ThinkorSwim

@chillc15 Not sure what you are trying to accomplish making it an upper study. The midline is moving average of the RSI. The midline thus cannot be extracted as it requires the RSI for calculation of the midline values. I do not believe it can be done. Maybe someone has the solution. Sorry I do not.
 
@chillc15 Not sure what you are trying to accomplish making it an upper study. The midline is moving average of the RSI. The midline thus cannot be extracted as it requires the RSI for calculation of the midline values. I do not believe it can be done. Maybe someone has the solution. Sorry I do not.

@horserider I get that thank you.

One other question. I'am familiar with assign price color but is it possible to assign a price color based on a defined color of "Positive and Up"

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

example - I would like to assign the price color based on the following:

When the RSI2 is ("Positive and Up", Color.GREEN); and obviously the reverse price color with RSI2.DefineColor("Negative and Down", Color.RED);

So of course this does not work and looking for some help.
AssignPriceColor(if RSI2 is ("Positive and Up") then Color.GREEN else if RSI2 ("Negative and Down") then Color.RED else Color.YELLOW);

Thanks
 
@chillc15 Here is first request. Make sure left axis is checked. Guess it is possible.

Code:
# Ultimate RSI stripped down to plot the midline  of the average of the RSI.
# Make sure Left Axis is checked in study settings.
# Horserider 1/7/2019 On request from chillc15 after learning use of left axis.

#RSI
input length = 5;

input price = close;
input averageType = AverageType.WILDERS;

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;

def RSI = 50 * (ChgRatio + 1);

#plot RSI avg;

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));
 
Hello Horserider, I have a question about this indicator and wanted to see if we could DM somehow so I could ask you privately. Can I message you somehow or DM you?
 
@danushman No idea if that is possible here. If it is I do not mind you doing it. Maybe ask BenTen if it is possible.
You cannot ask in this thread?
If you are in the discord I believe you can private message there.
 
Would prefer to keep it private if that is OK. On Discord, username is 'dan#1279'. Can also drop me a email if you like - dan-at-nichetheory-dot-com.
 
Hi there, new to the forum and have spent a chunk of time searching for a solution but haven't been able to find anything. —

I'm trying to add a 2 Standard deviation channel to an RSI indicator (or really any indicator) in Thinkorswim that has a 2 day look back period on a 5 min chart.

I also have a 5 period exponential moving average based on the RSI tool plotted. All I need now is to add a the linear regression channel with 1 and 2 standard deviations. Easy right? lol

any help will be greatly appreciated, thank you!
 
Hi there, new to the forum and have spent a chunk of time searching for a solution but haven't been able to find anything. —

I'm trying to add a 2 Standard deviation channel to an RSI indicator (or really any indicator) in Thinkorswim that has a 2 day look back period on a 5 min chart.

I also have a 5 period exponential moving average based on the RSI tool plotted. All I need now is to add a the linear regression channel with 1 and 2 standard deviations. Easy right? lol

any help will be greatly appreciated, thank you!
Not sure why this got moved to the thread above? Any admin able to assist?
 
@Vosloo Check code here, may assist with what you want to do. Also here is an example of adding lrc to the RSI. Not sure it accomplishes anything beyond just doing overbought and oversold, but here you go.

Code:
declare lower;
#RSI
input length = 5;

input price = close;
input averageType = AverageType.WILDERS;

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);

#               
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"));


#plot 5;

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

plot midline ;
    midline   = reference BollingerBands(RSI, displaceBB, lengthBB, averageType = AverageType.SIMPLE).Midline;
midline.SetDefaultColor(GetColor(3));


plot MiddleLR = InertiaAll(midline );
def dist = HighestAll(AbsValue(MiddleLR - midline )) * 0.6;
plot UpperLR = MiddleLR + dist;
plot LowerLR = MiddleLR - dist;

MiddleLR.SetDefaultColor(GetColor(1));
UpperLR.SetDefaultColor(GetColor(1));
LowerLR.SetDefaultColor(GetColor(1));
 
HorseRider, I have the script a go, and you nailed the first part, thank you! The #Plot5 however uses a BollingerBand, and I'm just looking for a regular Regression channel with which to encapsulate the RSI with. Like the kind you would draw except not needing to draw it on every RSI indicator if that makes sense. Actually wanting 1 and 2 standard deviations so that it creates four reference points for the RSI. Thanks so much again for your help!
 
Ok now I see what you want. Try this one. Adjust .3 and .6 to get bands where you want.

Code:
# RSI with Linear Regression_Channels

# Horserider 2/5/2020


declare lower;

#RSI

input length = 5;

input price = close;

input averageType = AverageType.WILDERS;


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);

#              

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"));


# LRC

input multi1 = .3;

input multi2 = .6;

plot MiddleLR = InertiaAll(RSI);

def dist = HighestAll(AbsValue(MiddleLR - RSI )) * multi1;

def dist2 = HighestAll(AbsValue(MiddleLR - RSI )) * multi2;

plot UpperLR = MiddleLR + dist;

plot LowerLR = MiddleLR - dist;

plot UpperLR2 = MiddleLR + dist2;

plot LowerLR2 = MiddleLR - dist2;


MiddleLR.SetDefaultColor(GetColor(1));

UpperLR.SetDefaultColor(GetColor(1));

LowerLR.SetDefaultColor(GetColor(1));

UpperLR2.SetDefaultColor(GetColor(2));

LowerLR2.SetDefaultColor(GetColor(2));
 
Last edited:
HorseRider, THANK YOU!!! You nailed. My goodness, I've been trying to sort this for so long. Thank you SO very much!
 
Horserider, the "input multi1" .03 and .06 are the Standard deviations for the #LRC — does that translate to "1" and 2" standard deviations? The reason I'm asking is because the RSI doesn't seem to be plotting in the correct quadrants of the LRC, and mostly plotting in the center of the LRC.
 
LRC SD OH MY

Code:
# RSI with Standard Deviation_Channels

# Horserider 2/5/2020


declare lower;

#RSI

input length = 5;

input price = close;

input averageType = AverageType.WILDERS;


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);

#               

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"));




####################################
input deviations1 = 1.0;
input deviations2 = 2.0;

def regression;
def stdDeviation;

regression = InertiaAll(RSI);
stdDeviation = StDevAll(RSI);

plot UpperLine = regression + deviations1 * stdDeviation;
plot MiddleLine = regression;
plot LowerLine = regression - deviations1 * stdDeviation;

plot UpperLine2 = regression + deviations2 * stdDeviation;

plot LowerLine2 = regression - deviations2 * stdDeviation;

#########################################
 
Dear Horserider, I don't know how you did it, but that was magic. Thank you so much for your time and patience!
 

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
219 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