RSI Momentum Trend For ThinkOrSwim

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

Appreciate if anyone can help. thanks
https://www.tradingview.com/script/g6Nyg5kS-RSI-Momentum-Trend/

Original link

indicator('RSI Momentum Trend', overlay=true)
// ** ---> Inputs ------------- {
var bool positive = false
var bool negative = false
string RSI_group = "RSI Settings"
string mom_group = "Momentum Vales"
string visual = "Visuals"
int Len2 = input(14,"RSI 1️⃣",inline = "rsi",group = RSI_group)
int pmom = input(65," Positive above",inline = "rsi1",group =RSI_group )
int nmom = input(32,"Negative below",inline = "rsi1",group =RSI_group )
bool showlabels = input(true,"Show Momentum ❓",inline = "001",group =visual )
color p = input(color.rgb(76, 175, 79, 62),"Positive",inline = "001",group =visual )
color n = input(color.rgb(255, 82, 82, 66),"Negative",inline = "001",group =visual )
bool filleshow = input(true,"Show highlighter ❓",inline = "002",group =visual )
color bull = input(color.rgb(76, 175, 79, 62),"Bull",inline = "002",group =visual )
color bear = input(color.rgb(255, 82, 82, 66),"Bear",inline = "002",group =visual )
rsi = ta.rsi(close, Len2)
//------------------- }
// ** ---> Momentums ------------- {
p_mom = rsi[1] < pmom and rsi > pmom and rsi > nmom and ta.change(ta.ema(close,5)) > 0
n_mom = rsi < nmom and ta.change(ta.ema(close,5)) < 0
if p_mom
positive:= true
negative:= false
if n_mom
positive:= false
negative:= true
// ** ---> Entry Conditions ------------- {
a = plot(filleshow ? ta.ema(high,5) : na,display = display.none,editable = false)
b = plot(filleshow ? ta.ema(low,10) : na,style = plot.style_stepline,color = color.red,display = display.none,editable = false)
// fill(a,b,color = color.from_gradient(rsi14,35,pmom,color.rgb(255, 82, 82, 66),color.rgb(76, 175, 79, 64)) )
fill(a,b,color = positive ? bull :bear ,editable = false)
//plotting
pcondition = positive and not positive[1]
ncondition2 = negative and not negative[1]
plotshape(showlabels ? pcondition: na , title="Positive Signal",style=shape.labelup, color=p, location= location.belowbar , size=size.tiny,text= "Positive",textcolor = color.white)
plotshape(showlabels ? ncondition2: na , title="Negative Signal",style=shape.labeldown, color=n, location= location.abovebar , size=size.tiny,text = "Negative",textcolor = color.white)
// Alerts //
alertcondition(pcondition,"Positive Trend")
alertcondition(ncondition2,"Negative Trend")
//
check below

CSS:
#/ This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © TZack88
#indicator('RSI Momentum Trend', overlay=true)
# - Converted by Sam4Cok@Samer800     -  08/2023
#// ** ---> Inputs ------------- {
input rsiLength  = 14;        # "RSI Length"
input rsiOverbought = 65;     # "Positive above"
input rsiOversold   = 32;     # "Negative below"
input showSignals   = yes;       # "Show Momentum ❓"
input showCloud  = yes;       # "Show highlighter ❓"

def na = Double.NaN;
def rsi = rsi(Price = close, Length = rsiLength);

#// ** ---> Momentums ------------- {
def ema5 = ExpAverage(close,5);
def p_mom = rsi[1] < rsiOverbought and rsi > rsiOverbought and rsi > rsiOversold and (ema5-ema5[1]) > 0;
def n_mom = rsi < rsiOversold and (ema5-ema5[1]) < 0;

def positive;def negative;
if p_mom {
    positive = yes;
    negative = no;
    } else
if n_mom {
    positive = no;
    negative = yes;
    } else {
    positive = positive[1];
    negative = negative[1];
}

#// ** ---> Entry Conditions ------------- {
def pos = positive;
plot a = if showCloud then ExpAverage(high,5) else na;#,display = display.none,editable = false)
plot b = if showCloud then ExpAverage(low,10) else na;#,style = plot.style_stepline,color = color.red,display = display.none,editable = false)
a.AssignValueColor(if pos then Color.DARK_GREEN else Color.DARK_RED);
b.AssignValueColor(if pos then Color.DARK_GREEN else Color.DARK_RED);

#// fill(a,b,color = color.from_gradient(rsi14,35,pmom,color.rgb(255, 82, 82, 66),color.rgb(76, 175, 79, 64)) )
AddCloud(if pos then a else na, b, Color.DARK_GREEN);#color = positive ? bull :bear ,editable = false)
AddCloud(if pos then na else a, b, Color.DARK_RED);

#//plotting
def pcondition = positive and !positive[1];
def ncondition2 = negative and !negative[1];

AddChartBubble(showSignals and pcondition, low, "Positive", Color.GREEN, no);
AddChartBubble(showSignals and ncondition2, high, "Negative", Color.RED, yes);



#-- End Of Code
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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