Help with EMA Bar Tread Label Script

Nightkiller

New member
It is a label on the top left of think or swim describing the current EMA trend

yzv6ysl.png
 
Last edited by a moderator:

Nightkiller

New member
Define a strong EMA trend and we'll code a label for you.
Awesome!thanks, let me go to the drawing board and think about how I will define each one. Im thinking I want to use 4 categories Strong Bearish Trend, Weak Bearish Trend, Weak Bullish Trend, and Strong Bullish Trend and the way those are defined are by certain EMAs above or below one another.
 

beardeddonut

New member
This is all I got so far. Looking to creat a trend bar label to show streanth of tread simulator to this:

aLvdR0E.png


Code:
#defines EMA values as random percentage.
#Will have to code the EMA inputs yourself to display useful data. Otherwise, color is just random.



def var = Round(Random(), 2);

#Labels turn lime if var is a certain percentage
AddLabel(yes, " ", if (var<=0.1) then color.lime else color.dark_red);
AddLabel(yes, " ", if (0.1<var && var <=0.2) then color.lime else color.red);
AddLabel(yes, " ", if (0.2<var && var <=0.3) then color.lime else color.magenta);
AddLabel(yes, " ", if (0.3<var && var <=0.4) then color.lime else color.dark_orange);
AddLabel(yes, " ", if (0.4<var && var <=0.5) then color.lime else color.orange);
AddLabel(yes, " ", if (0.5<var && var <=0.6) then color.lime else color.orange);
AddLabel(yes, " ", if (0.6<var && var <=0.7) then color.lime else color.yellow);
AddLabel(yes, " ", if (0.7<var && var<=0.8) then color.lime else color.dark_green);
AddLabel(yes, " ", if (0.8<var && var<=0.9) then color.lime else color.dark_green);
AddLabel(yes, " ", if (0.9<var && var<=1) then color.lime else color.dark_green);
#Displays result value for debugging
AddLabel(yes, "var: " + (var), color.cyan);
 

halcyonguy

Well-known member
VIP
Lifetime
it appears you want to calculate a % of something, to drive the colored labels, but i don't know what. can you describe it in more detail?
 

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.
Top