looking for 21ema crossing 9 ema

bushido22

New member
Brand new here, so I apologize if I'm not in the right location to seek help.

I'm an old dog trying to learn new tricks. Not as easy as it seemed at the beginning.

Nonetheless, I'd like to find an indicator that would alert throughout the day when the 21ema crosses the 9ema for any time frame. I have 1,2,5,10,15, 30, 1-hr, 4-hour, daily, weekly and monthly charts open during trading.

I've used the "create alert" method with the help of TOS help chat, but it needs to be reset after every alert, which isn't what I'm hoping to find. I'm told TOS is aware of the interest from members to have access to this, but, thus far, it is not available.

I'll help in ay way I can, but, at 62, a good day is when I get the remote start to work on my truck, so at best I may only be able to offer appreciation.

Thank you in advance and best of luck to all,

Christopher
 
Solution
Brand new here, so I apologize if I'm not in the right location to seek help.

I'm an old dog trying to learn new tricks. Not as easy as it seemed at the beginning.

Nonetheless, I'd like to find an indicator that would alert throughout the day when the 21ema crosses the 9ema for any time frame. I have 1,2,5,10,15, 30, 1-hr, 4-hour, daily, weekly and monthly charts open during trading.

I've used the "create alert" method with the help of TOS help chat, but it needs to be reset after every alert, which isn't what I'm hoping to find. I'm told TOS is aware of the interest from members to have access to this, but, thus far, it is not available.

I'll help in ay way I can, but, at 62, a good day is when I get the remote start to work...
Brand new here, so I apologize if I'm not in the right location to seek help.

I'm an old dog trying to learn new tricks. Not as easy as it seemed at the beginning.

Nonetheless, I'd like to find an indicator that would alert throughout the day when the 21ema crosses the 9ema for any time frame. I have 1,2,5,10,15, 30, 1-hr, 4-hour, daily, weekly and monthly charts open during trading.

I've used the "create alert" method with the help of TOS help chat, but it needs to be reset after every alert, which isn't what I'm hoping to find. I'm told TOS is aware of the interest from members to have access to this, but, thus far, it is not available.

I'll help in ay way I can, but, at 62, a good day is when I get the remote start to work on my truck, so at best I may only be able to offer appreciation.

Thank you in advance and best of luck to all,

Christopher

Here is a grid with the timeframes you listed with the following script.

There are various options that can be turned on/off at the input screen for the script.

A color coded label will show the relationship of the EMAs and how many bars ago it occurred.
A label will also appear as "Crossing" when it is happening.
A color coded cloud will appear for 2 bars at crossings
An alert will sound whenever there is a crossing. It is automatically reset to sound again for the next crossing.

Here is a link to the grid. http://tos.mx/wHudHyF [Edit: Link fixed]

Screenshot-2023-04-15-192814.png
Code:
#EMA9_21

input showplots  = yes;
input lineweight = 2;

plot ema9 = ExpAverage(close, 9);
plot ema21 = ExpAverage(close, 21);
ema9.SetLineWeight(lineweight);
ema21.SetLineWeight(lineweight);
ema9.SetHiding(!showplots);
ema21.SetHiding(!showplots);

input use_label = yes;
def count = if ema9 crosses ema21 then 1 else count[1] + 1;
AddLabel(use_label, "EMA 9_21 Crossed Bars Ago: " + count,
if ema9 > ema21 then Color.GREEN else Color.RED);

input use_crossing_label = yes;
AddLabel(use_crossing_label,
if ema9 crosses ema21 then "CROSSING" else "",
if ema9[1] < ema21[1] and ema9 > ema21 then Color.LIGHT_GREEN
else if ema9[1] > ema21[1] and ema9 < ema21 then Color.LIGHT_RED
else Color.CURRENT);

input use_backgroundcolor = yes;
plot cloudcount = count;
cloudcount.SetHiding(yes);

AddCloud(
if use_backgroundcolor  and
   (cloudcount == 1 or cloudcount == 2) and
   ema9 > ema21
then Double.POSITIVE_INFINITY
else Double.NaN,
Double.NEGATIVE_INFINITY,
Color.GREEN, Color.GREEN);

AddCloud(
if use_backgroundcolor and
  (cloudcount == 1 or cloudcount == 2) and
   ema9 < ema21
then Double.POSITIVE_INFINITY
else Double.NaN,
Double.NEGATIVE_INFINITY,
Color.RED, Color.RED);

Alert( ema9 crosses ema21,
if ema9 crosses above ema21 then "ABOVE" else "BELOW",
Alert.BAR, Sound.Ding);
 
Last edited:
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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