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.

V9AL8pT.png


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

###RSI TWO###
def NetChgAvg2 = MovingAverage(averageType, price - price[1], length2);
def TotChgAvg2 = MovingAverage(averageType, AbsValue(price - price[1]), 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[1], length3);
def TotChgAvg3 = MovingAverage(averageType, AbsValue(price - price[1]), 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[1];
AddVerticalLine(M2[0] > M2[1], "Go BULLISH!", Color.green, Curve.SHORT_DASH);

def M3 = RSI crosses below RSI2 and RSI3;
def M4 = M3+ M3[1];
AddVerticalLine(M4[0] > M4[1], "Go SHORT", Color.red, Curve.SHORT_DASH);
 
Last edited by a moderator:
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
 
@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;

#Added volume Label
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:
#Buy on Green or Blue
#Sell on Yellow or Orange

#End;
 
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.

V9AL8pT.png


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

###RSI TWO###
def NetChgAvg2 = MovingAverage(averageType, price - price[1], length2);
def TotChgAvg2 = MovingAverage(averageType, AbsValue(price - price[1]), 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[1], length3);
def TotChgAvg3 = MovingAverage(averageType, AbsValue(price - price[1]), 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[1];
AddVerticalLine(M2[0] > M2[1], "Go BULLISH!", Color.green, Curve.SHORT_DASH);

def M3 = RSI crosses below RSI2 and RSI3;
def M4 = M3+ M3[1];
AddVerticalLine(M4[0] > M4[1], "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.
 

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