• Get $40 off VIP by signing up for a free account! Sign Up

Stacked EMA Dashboard For ThinkOrSwim

kaiso

New member
VIP
Screenshot (2).png

I've been trying to have three bars based on the different conditions in the script but I'm only get one bar. How can I edit the script to get separate bars based on the conditions?
This is the script:
declare lower;
def EMA5 = ExpAverage(close, 5);
def EMA13 = ExpAverage(close, 13);
def EMA20 = ExpAverage(close, 20);
def cond1 = (EMA5 > EMA13);
def cond2 = (EMA13 > EMA20);
def cond3 = (EMA5 < EMA13);
def cond4 = (EMA13 < EMA20);

plot dot = if IsNaN(close) then Double.NaN else 1;
dot.SetStyle(Curve.POINTS);
dot.SetLineWeight(5);
dot.AssignValueColor(if cond1 and cond2 then Color.GREEN
else if cond3 and cond4 then Color.RED
else color.YELLOW);

Thanks
 
Solution
View attachment 21730
I've been trying to have three bars based on the different conditions in the script but I'm only get one bar. How can I edit the script to get separate bars based on the conditions?
This is the script:
declare lower;
def EMA5 = ExpAverage(close, 5);
def EMA13 = ExpAverage(close, 13);
def EMA20 = ExpAverage(close, 20);
def cond1 = (EMA5 > EMA13);
def cond2 = (EMA13 > EMA20);
def cond3 = (EMA5 < EMA13);
def cond4 = (EMA13 < EMA20);

plot dot = if IsNaN(close) then Double.NaN else 1;
dot.SetStyle(Curve.POINTS);
dot.SetLineWeight(5);
dot.AssignValueColor(if cond1 and cond2 then Color.GREEN
else if cond3 and cond4 then Color.RED
else color.YELLOW);

Thanks

See if this helps you.
It has 3 rows.
Row 1 is the comparison...
View attachment 21730
I've been trying to have three bars based on the different conditions in the script but I'm only get one bar. How can I edit the script to get separate bars based on the conditions?
This is the script:
declare lower;
def EMA5 = ExpAverage(close, 5);
def EMA13 = ExpAverage(close, 13);
def EMA20 = ExpAverage(close, 20);
def cond1 = (EMA5 > EMA13);
def cond2 = (EMA13 > EMA20);
def cond3 = (EMA5 < EMA13);
def cond4 = (EMA13 < EMA20);

plot dot = if IsNaN(close) then Double.NaN else 1;
dot.SetStyle(Curve.POINTS);
dot.SetLineWeight(5);
dot.AssignValueColor(if cond1 and cond2 then Color.GREEN
else if cond3 and cond4 then Color.RED
else color.YELLOW);

Thanks

See if this helps you.
It has 3 rows.
Row 1 is the comparison of the same 2 averages, cond1 and cond3
Row 2 is the comparison of the same 2 averages, cond2 and cond4
Row 3 is your line, which is the summary, It will be green or red if rows 1 and 2 match, otherwise yellow

Screenshot 2024-04-30 070346.png
Code:
declare lower;
def EMA5 = ExpAverage(close, 5);
def EMA13 = ExpAverage(close, 13);
def EMA20 = ExpAverage(close, 20);
def cond1 = (EMA5 > EMA13);
def cond2 = (EMA13 > EMA20);
def cond3 = (EMA5 < EMA13);
def cond4 = (EMA13 < EMA20);

plot dot = if IsNaN(close) then Double.NaN else 3;
dot.SetStyle(Curve.POINTS);
dot.SetLineWeight(5);
dot.AssignValueColor(if cond1 and cond2 then Color.GREEN
else if cond3 and cond4 then Color.RED
else color.YELLOW);
plot dot1 = if IsNaN(close) then Double.NaN else 1;
dot1.SetStyle(Curve.POINTS);
dot1.SetLineWeight(5);
dot1.assignvalueColor(if cond1 then color.green
else if cond3 then color.red
else color.yellow);
plot dot2 = if IsNaN(close) then Double.NaN else 2;
dot2.SetStyle(Curve.POINTS);
dot2.SetLineWeight(5);
dot2.assignvalueColor(if cond2 then color.green
else if cond4 then color.red
else color.yellow);
#
 
Solution

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

See if this helps you.
It has 3 rows.
Row 1 is the comparison of the same 2 averages, cond1 and cond3
Row 2 is the comparison of the same 2 averages, cond2 and cond4
Row 3 is your line, which is the summary, It will be green or red if rows 1 and 2 match, otherwise yellow
Perfect. Thank you so so much
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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