Momentum Chart & Label For ThinkOrSwim

rad14733

Options Expert
VIP
Lifetime
I used the standard momentum histogram colors, CYAN, BLUE, RED, YELLOW... Modify for your needs...

Ruby:
# Momentum_Label
# Displays a Label to display current momentum
# Coded by rad14733 for usethinkscript.com
# v1.0 : 2021-08-11 : Initial release

# SETTINGS
input price = close;
input length = 20;

# MOMENTUM LOGIC

def K = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length);
def momo = Inertia(price - K / 2, length);

def pos = momo >= 0;
def neg = momo < 0;
def up = momo >= momo[1];
def dn = momo < momo[1];

def posUp = pos and up;
def posDn = pos and dn;
def negDn = neg and dn;
def negUp = neg and up;

# DISPLAY LABEL

AddLabel(yes,
  if posUp then "Pos+Up"
  else if posDn then "Pos+Dn"
  else if negDn then "Neg+Dn"
  else if negUp then "Neg+Up"
  else "",
  if posUp then Color.CYAN
  else if posDn then Color.BLUE
  else if negDn then Color.RED
  else if negUp then Color.YELLOW
  else Color.CURRENT
);

# END - Momentum_Label
 
Last edited by a moderator:

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

@thealphabreed Here you go... I used the standard momentum histogram colors, CYAN, BLUE, RED, YELLOW... Modify for your needs...

Ruby:
# Momentum_Label
# Displays a Label to display current momentum
# Coded by rad14733 for usethinkscript.com
# v1.0 : 2021-08-11 : Initial release

# SETTINGS
input price = close;
input length = 20;

# MOMENTUM LOGIC

def K = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length);
def momo = Inertia(price - K / 2, length);

def pos = momo >= 0;
def neg = momo < 0;
def up = momo >= momo[1];
def dn = momo < momo[1];

def posUp = pos and up;
def posDn = pos and dn;
def negDn = neg and dn;
def negUp = neg and up;

# DISPLAY LABEL

AddLabel(yes,
  if posUp then "Pos+Up"
  else if posDn then "Pos+Dn"
  else if negDn then "Neg+Dn"
  else if negUp then "Neg+Up"
  else "",
  if posUp then Color.CYAN
  else if posDn then Color.BLUE
  else if negDn then Color.RED
  else if negUp then Color.YELLOW
  else Color.CURRENT
);

# END - Momentum_Label
Is there anyway to get this study or the squeeze study to work on the mobile app? Thank you I appreciate if anyone can help please
 
Hello & Welcome TraderTheJoker

The mobile app will not allow the use of multiple timeframes. There is no workaround.
You will find many of the more complex studies on this forum will not work on the mobile app.
Any chart that has vertical lines, labels, bubbles, clouds, color changes for slopes and lines, renko, and / or multiple timeframes does not work.
 
@thealphabreed Here you go... I used the standard momentum histogram colors, CYAN, BLUE, RED, YELLOW... Modify for your needs...

Ruby:
# Momentum_Label
# Displays a Label to display current momentum
# Coded by rad14733 for usethinkscript.com
# v1.0 : 2021-08-11 : Initial release

# SETTINGS
input price = close;
input length = 20;

# MOMENTUM LOGIC

def K = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length);
def momo = Inertia(price - K / 2, length);

def pos = momo >= 0;
def neg = momo < 0;
def up = momo >= momo[1];
def dn = momo < momo[1];

def posUp = pos and up;
def posDn = pos and dn;
def negDn = neg and dn;
def negUp = neg and up;

# DISPLAY LABEL

AddLabel(yes,
  if posUp then "Pos+Up"
  else if posDn then "Pos+Dn"
  else if negDn then "Neg+Dn"
  else if negUp then "Neg+Up"
  else "",
  if posUp then Color.CYAN
  else if posDn then Color.BLUE
  else if negDn then Color.RED
  else if negUp then Color.YELLOW
  else Color.CURRENT
);

# END - Momentum_Label
Hey Rad, this is great! However, I am a new user and not sure I how I transfer this code to my ToS studies. Any help is appreciated! :)
 
@rad14733 Love the momentum indicator and the clean code! I've updated the script to plot the indicator in addition to the label in order to view it across time and see the momentum of the momentum-indicator. Colors of the plot match those used by the label.

oIl4dbX.png


Code:
# Momentum_Label_Plot
# Displays a Label to display current momentum
# Coded by rad14733 (v.1.0), updated by thinkorJim (v2.0)
# v1.0 : 2021-08-11 : Initial release (Label Only).
# v2.0 : 2021-12-03 : Plot of the Indicator and Label.

# SETTINGS
declare lower;

input price = close;
input length = 20;

# MOMENTUM LOGIC

def K = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length);
plot momo = Inertia(price - K / 2, length);
plot zeroline = 0;

def pos = momo >= 0;
def neg = momo < 0;
def up = momo >= momo[1];
def dn = momo < momo[1];

def posUp = pos and up;
def posDn = pos and dn;
def negDn = neg and dn;
def negUp = neg and up;

# DISPLAY LABEL

AddLabel(yes,
  if posUp then "Pos+Up"
  else if posDn then "Pos+Dn"
  else if negDn then "Neg+Dn"
  else if negUp then "Neg+Up"
  else "",
  if posUp then Color.CYAN
  else if posDn then Color.BLUE
  else if negDn then Color.RED
  else if negUp then Color.YELLOW
  else Color.CURRENT
);

# PLOT DESIGN

momo.AssignValueColor(if posUp then Color.CYAN else if posDn then Color.BLUE else if negDn then Color.RED else if negUp then Color.YELLOW else Color.CURRENT);

momo.SetPaintingStrategy(PaintingStrategy.POINTS);
 
# END - Momentum_Label
 
Thanks to rad14733 and thinkorJim for the Momentum study. However, I noticed it match almost exactly the MACD Histogram study when the length is set to 10.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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