# Can anyone help me clean this Triple RSI up a little?

#### imauic90

##### New member
Just messing with a new RSI strategy. Using 3 RSI levels with a cross over to indicate going long or short. Just seeing if anyone can help me clean up the code a little better and plot the vertical lines when the parameter is truly met versus when the RSI levels are in transition. I'm fairly new to scripting and only know the basics. Code:
``````###Triple RSI ###

declare lower;

input length = 8;
input length2 = 14;
input length3 = 21;
input over_Bought = 70;
input over_Sold = 30;
input over_Bought2 = 80;
input over_Sold2 = 20;
input over_Bought3 = 90;
input over_Sold3 = 10;
input midlineX = 50;

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

###RSI ONE###
def NetChgAvg = MovingAverage(averageType, price - price, length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;

###RSI TWO###
def NetChgAvg2 = MovingAverage(averageType, price - price, length2);
def TotChgAvg2 = MovingAverage(averageType, AbsValue(price - price), length2);
def ChgRatio2 = if TotChgAvg2 != 0 then NetChgAvg2 / TotChgAvg2 else 0;

plot RSI2 = 50 * (ChgRatio2 + 1);
plot OverSold2 = over_Sold2;
plot OverBought2 = over_Bought2;

###RSI THREE###
def NetChgAvg3 = MovingAverage(averageType, price - price, length3);
def TotChgAvg3 = MovingAverage(averageType, AbsValue(price - price), length3);
def ChgRatio3 = if TotChgAvg3 != 0 then NetChgAvg3 / TotChgAvg3 else 0;

plot RSI3 = 50 * (ChgRatio3 + 1);
plot OverSold3 = over_Sold3;
plot OverBought3 = over_Bought3;

###MIDLINE###

plot Midline = midlineX;

###Vertical Lines###

def M1 = RSI crosses above RSI2 and RSI3;
def M2 = M1+ M1;
AddVerticalLine(M2 > M2, "Go BULLISH!", Color.green, Curve.SHORT_DASH);

def M3 = RSI crosses below RSI2 and RSI3;
def M4 = M3+ M3;
AddVerticalLine(M4 > M4, "Go SHORT", Color.red, Curve.SHORT_DASH);``````

Last edited by a moderator:

#### Ramesh16

##### Member
VIP
which time frame is the best to use the triple RSI?

#### imauic90

##### New member
which time frame is the best to use the triple RSI?

I've been playing with it on the higher timeframes from 1hr up to the daily charts.

• Ramesh16

#### APOT7

##### Member
VIP
Do anyone have or know how to make a lower study for Mutiple RSI. Also is there a way to level of rsi written out on a box?
5 Day RSI,
7 Day Rsi
14 Day Rsi
60 Day RSI
120 Day Rsi

#### APOT7

##### Member
VIP
@imauic90 How did u get the label " bearish volume" on your chart? Can you share the link? thank u

#### imauic90

##### New member
Do anyone have or know how to make a lower study for Mutiple RSI. Also is there a way to level of rsi written out on a box?
5 Day RSI,
7 Day Rsi
14 Day Rsi
60 Day RSI
120 Day Rsi

Can you elaborate on this?

#### imauic90

##### New member
@imauic90 How did u get the label " bearish volume" on your chart? Can you share the link? thank u

Code:
``````Volume###################################################################
#Colored Volume By Ethans080901
#Mod TroyX-8-17-18
#If today's closing price and volume is greater than 'n' days ago, color green
#If today's closing price is greater than 'n' days ago but volume is not, color blue
#If today's closing price is less than 'n' days ago, color orange
#If today's closing price is less than 'n' days ago but volume is not, color red

input n = 10;

def CN = Average(close, n);
def VN = Average(volume, n);
def G = close > CN and volume > VN ;
def B = close > CN and volume == VN;
def O = close < CN and volume == VN;
def R = close < CN and volume >= VN;

AddLabel( G, "Strong Bullish Volume" , Color.CYAN); #Strong Bull
AddLabel( B, "Weak Bullish Volume" , Color.blue); #Weak Bull
AddLabel( O, "Weak Bearish Volume" , Color.YELLOW); #Weak Bear
AddLabel( R, "Strong Bearish Volume" , Color.Dark_ORANGE); #Strong Bear

#How to use:
#Sell on Yellow or Orange

#End;``````

#### UYAREDUDE

##### New member
Just messing with a new RSI strategy. Using 3 RSI levels with a cross over to indicate going long or short. Just seeing if anyone can help me clean up the code a little better and plot the vertical lines when the parameter is truly met versus when the RSI levels are in transition. I'm fairly new to scripting and only know the basics. Code:
``````###Triple RSI ###

declare lower;

input length = 8;
input length2 = 14;
input length3 = 21;
input over_Bought = 70;
input over_Sold = 30;
input over_Bought2 = 80;
input over_Sold2 = 20;
input over_Bought3 = 90;
input over_Sold3 = 10;
input midlineX = 50;

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

###RSI ONE###
def NetChgAvg = MovingAverage(averageType, price - price, length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;

###RSI TWO###
def NetChgAvg2 = MovingAverage(averageType, price - price, length2);
def TotChgAvg2 = MovingAverage(averageType, AbsValue(price - price), length2);
def ChgRatio2 = if TotChgAvg2 != 0 then NetChgAvg2 / TotChgAvg2 else 0;

plot RSI2 = 50 * (ChgRatio2 + 1);
plot OverSold2 = over_Sold2;
plot OverBought2 = over_Bought2;

###RSI THREE###
def NetChgAvg3 = MovingAverage(averageType, price - price, length3);
def TotChgAvg3 = MovingAverage(averageType, AbsValue(price - price), length3);
def ChgRatio3 = if TotChgAvg3 != 0 then NetChgAvg3 / TotChgAvg3 else 0;

plot RSI3 = 50 * (ChgRatio3 + 1);
plot OverSold3 = over_Sold3;
plot OverBought3 = over_Bought3;

###MIDLINE###

plot Midline = midlineX;

###Vertical Lines###

def M1 = RSI crosses above RSI2 and RSI3;
def M2 = M1+ M1;
AddVerticalLine(M2 > M2, "Go BULLISH!", Color.green, Curve.SHORT_DASH);

def M3 = RSI crosses below RSI2 and RSI3;
def M4 = M3+ M3;
AddVerticalLine(M4 > M4, "Go SHORT", Color.red, Curve.SHORT_DASH);``````
Hi, I found this very useful. Did you get a response? I am looking to find out how I can adjust the signal days "buy, sell" like calculating it a 2-3 days? Thanks in advance.