C_EMAmeter For ThinkOrSwim

carey3

New member
VIP
I try to monitor multiple EMA levels but I don't like the lines on my chart, seems too cluttered.
So this is my idea for how to monitor the levels without getting analysis paralysis.


This indicator adds labels to the chart that indicate if the current price is above or below 5 different EMA lines.
It also monitors and alerts when the price crosses over the EMA line.
VWAP was added and monitored also.


1727570929639.png


Green is Bullish or the price is above the EMA level, Redish is Bearish or below the EMA level
Finally, for open charts, it sends an alert if there is a crossover on any of the charts.



I welcome comments, feedback, and suggestions.

Cheers,
-=Carey


Ruby:
#hint: C_EMAmeter \n This is my solution to watch Multiple EMA lines without having a bunch of lines on my chart\n This also gives me an alert message when the price crosses above or below one of these EMA lines if I have the chart open./nC_EMAmeter - V1.0\n
#
# - Posted this to https://usethinkscript.com/
# V1.1 - Moved the Bearish Crossover signals to the end

input EMA1 = 9;
input EMA2 = 21;
input EMA3 = 50;
input EMA4 = 100;
input EMA5 = 200;
input AvgType = averageType.EXPONENTIAL;
def priceH = high();
def priceL = low();
def priceC = close();
def AVG1 = MovingAverage(AvgType, priceC, EMA1);
def AVG2 = MovingAverage(AvgType, priceC, EMA2);
def AVG3 = MovingAverage(AvgType, priceC, EMA3);
def AVG4 = MovingAverage(AvgType, priceC, EMA4);
def AVG5 = MovingAverage(AvgType, priceC, EMA5);
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> VWAP
def DailyVWAP = vwap(period = AggregationPeriod.DAY);
def WeeklyVWAP = vwap(period = AggregationPeriod.WEEK);
def MonthlyVWAP = vwap(period = AggregationPeriod.MONTH);
def aPeriod = GetAggregationPeriod();
def VWAP1 = if aPeriod < AggregationPeriod.DAY then DailyVWAP
else if aPeriod < AggregationPeriod.WEEK then WeeklyVWAP
else MonthlyVWAP ; #double.nan;
def DeltaVWAP = priceC - VWAP1;
AddLabel(1,"/EMA", CreateColor(200,200,200));

#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Bullish EMA signals
AddLabel( priceC crosses Above VWAP1, "P Cx/\VWAP", CreateColor(100,255,128) );
AddLabel( priceC crosses Above AVG1, Concat("P Cx^Ema", EMA1), CreateColor(000,255,128) );
AddLabel( priceC crosses Above AVG2, Concat("P Cx^Ema", EMA2), CreateColor(000,255,128) );
AddLabel( priceC crosses Above AVG3, Concat("P Cx^Ema", EMA3), CreateColor(000,255,128) );
AddLabel( priceC crosses Above AVG4, Concat("P Cx^Ema", EMA4), CreateColor(000,255,128) );
AddLabel( priceC crosses Above AVG5, Concat("P Cx^Ema", EMA5), CreateColor(000,255,128) );
AddLabel(priceC > VWAP1, "V", CreateColor(000,255,128));
AddLabel(priceC > AVG1, EMA1, CreateColor(000,255,128));
AddLabel(priceC > AVG2, EMA2, CreateColor(000,255,128));
AddLabel(priceC > AVG3, EMA3, CreateColor(000,255,128));
AddLabel(priceC > AVG4, EMA4, CreateColor(000,255,128));
AddLabel(priceC > AVG5, EMA5, CreateColor(000,255,128));
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Bearish EMA signals
AddLabel(priceC < VWAP1, "V", CreateColor(192,000,128));
AddLabel(priceC < AVG1, EMA1, CreateColor(192,000,128));
AddLabel(priceC < AVG2, EMA2, CreateColor(192,000,128));
AddLabel(priceC < AVG3, EMA3, CreateColor(192,000,128));
AddLabel(priceC < AVG4, EMA4, CreateColor(192,000,128));
AddLabel(priceC < AVG5, EMA5, CreateColor(192,000,128));

AddLabel( priceC crosses Below AVG1, Concat("P Cx\/Ema", EMA1), CreateColor(192,000,128) );
AddLabel( priceC crosses Below AVG2, Concat("P Cx\/Ema", EMA2), CreateColor(192,000,128) );
AddLabel( priceC crosses Below AVG3, Concat("P Cx\/Ema", EMA3), CreateColor(192,000,128) );
AddLabel( priceC crosses Below AVG4, Concat("P Cx\/Ema", EMA4), CreateColor(192,000,128) );
AddLabel( priceC crosses Below AVG5, Concat("P Cx\/Ema", EMA5), CreateColor(192,000,128) );
AddLabel( priceC crosses Below VWAP1, "P Cx\/VWAP", CreateColor(255,100,128) );
AddLabel(1,"EMA\", CreateColor(200,200,200));
#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> Alerts
alert(priceC crosses Above AVG1 and aPeriod >= AggregationPeriod.hour, Concat("P Cx^Ema",EMA1), ALert.Once, Sound.bell);
alert(priceC crosses Above AVG2 and aPeriod >= AggregationPeriod.hour, Concat("P Cx^Ema",EMA2), ALert.Once, Sound.bell);
alert(priceC crosses Above AVG3 and aPeriod >= AggregationPeriod.hour, Concat("P Cx^Ema",EMA3), ALert.Once, Sound.bell);
alert(priceC crosses Above AVG4 and aPeriod >= AggregationPeriod.hour, Concat("P Cx^Ema",EMA4), ALert.Once, Sound.bell);
alert(priceC crosses Above AVG5 and aPeriod >= AggregationPeriod.hour, Concat("P Cx^Ema",EMA5), ALert.Once, Sound.bell);
alert(priceC crosses Below AVG1 and aPeriod >= AggregationPeriod.hour, Concat("P Cx\/Ema",EMA1), ALert.Once, Sound.bell);
alert(priceC crosses Below AVG2 and aPeriod >= AggregationPeriod.hour, Concat("P Cx\/Ema",EMA2), ALert.Once, Sound.bell);
alert(priceC crosses Below AVG3 and aPeriod >= AggregationPeriod.hour, Concat("P Cx\/Ema",EMA3), ALert.Once, Sound.bell);
alert(priceC crosses Below AVG4 and aPeriod >= AggregationPeriod.hour, Concat("P Cx\/Ema",EMA4), ALert.Once, Sound.bell);
alert(priceC crosses Below AVG5 and aPeriod >= AggregationPeriod.hour, Concat("P Cx\/Ema",EMA5), ALert.Once, Sound.bell);

#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=->
 

Attachments

  • 1727570622817.png
    1727570622817.png
    3 KB · Views: 31
  • 1727570622818.png
    1727570622818.png
    6.7 KB · Views: 30
Last edited by a moderator:

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

I have added that to the next version.
For HMA I have bearish and bullish, not if it is above or below the price.
I added this before the EMA labels.

#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> HMA signals
input HMA1Length = 9;
input HMA2Length = 21;
def Htype = averageType.HULL;
def HMA1 = MovingAverage(Htype, priceC, HMA1Length);
def HMA2 = MovingAverage(Htype, priceC, HMA2Length);

AddLabel(1,"/HMA", CreateColor(200,200,200));

AddLabel(HMA1 >= HMA1[1], HMA1Length, CreateColor(000,255,128) );
AddLabel(HMA1 <= HMA1[1], HMA1Length, CreateColor(192,000,128) );
AddLabel(HMA2 >= HMA2[1], HMA2Length, CreateColor(000,255,128) );
AddLabel(HMA2 <= HMA2[1], HMA2Length, CreateColor(192,000,128) );

AddLabel(1,"\", CreateColor(200,200,200));
 
If you want to see the price above or below HMA, here is the code to add:

#<-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> <-=-> HMA signals
input HMA1Length = 9;
input HMA2Length = 21;
def Htype = averageType.HULL;
def HMA1 = MovingAverage(Htype, priceC, HMA1Length);
def HMA2 = MovingAverage(Htype, priceC, HMA2Length);

AddLabel(1,"/HMA", CreateColor(200,200,200));

AddLabel(HMA1 >= HMA1[1], HMA1Length, CreateColor(000,255,128) );
AddLabel(HMA1 <= HMA1[1], HMA1Length, CreateColor(192,000,128) );
AddLabel(HMA2 >= HMA2[1], HMA2Length, CreateColor(000,255,128) );
AddLabel(HMA2 <= HMA2[1], HMA2Length, CreateColor(192,000,128) );

AddLabel(priceC > HMA1, "C>"+HMA1Length, CreateColor(000,255,128) );
AddLabel(priceC < HMA1, "C<"+HMA1Length, CreateColor(192,000,128) );
AddLabel(priceC >= HMA2, "C>"+HMA2Length, CreateColor(000,255,128) );
AddLabel(priceC <= HMA2, "C<"+HMA2Length, CreateColor(192,000,128) );

AddLabel(1,"\", CreateColor(200,200,200));
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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