50 ema screen flash (need alert)

Mobius made this, I LOVE IT. I use it to grab my attention. can someone help me add a alert to it? I would like to have the alert be custom sound so I can add a sound that I have saved to my computer rather then the chime, bell or ring that TOS has. thanks for any help

plot EMA50 = ExpAverage(close, 45);
def EMA200 = ExpAverage(close, 200);
AssignBackgroundColor(if close crosses EMA50
then color.red
else if close == EMA50
then color.red
else if close crosses above EMA200
then color.yellow
else if close == EMA200
then color.red
else color.current);
 
Here is an alert I use for $TICK. I forget where I got it.
Code:
declare upper;

input TickSymb = "$TICK";
def TICKS = if !IsNaN(close(TickSymb)) then close(TickSymb) else TICKS[1];

# Alerts:

def alerttrigger = if (TICKS >= 1000 ) or (TICKS <= -1000) then 1 else 0; #replace the 1 with your definition

# BLOCK CODE BELOW
input alerttext = "OH SH*T!!!";
input UseAlerts = {false, default true};
input AlertType = {default "BAR", "ONCE", "TICK"};
def at = AlertType;
input AlertSound = {"Bell", "Chimes", default "Ding", "NoSound", "Ring"};
Alert(alerttrigger and UseAlerts, alerttext, if at == 1 then Alert.ONCE else if at == 2 then Alert.TICK else Alert.BAR, AlertSound);
 
Here is an alert I use for $TICK. I forget where I got it.
Code:
declare upper;

input TickSymb = "$TICK";
def TICKS = if !IsNaN(close(TickSymb)) then close(TickSymb) else TICKS[1];

# Alerts:

def alerttrigger = if (TICKS >= 1000 ) or (TICKS <= -1000) then 1 else 0; #replace the 1 with your definition

# BLOCK CODE BELOW
input alerttext = "OH SH*T!!!";
input UseAlerts = {false, default true};
input AlertType = {default "BAR", "ONCE", "TICK"};
def at = AlertType;
input AlertSound = {"Bell", "Chimes", default "Ding", "NoSound", "Ring"};
Alert(alerttrigger and UseAlerts, alerttext, if at == 1 then Alert.ONCE else if at == 2 then Alert.TICK else Alert.BAR, AlertSound);
What does this do please explain
 
I think I misunderstood his question. I thought he was looking for a template to add an alert to a specific condition. I now realize that he wants to add his own alert sound, which I don't know how to do. Should I take down my reply?
 
Make sure you input it correctly. I have gotten several alerts this morning.

Full Code:

Code:
plot EMA50 = ExpAverage(close, 45);
plot EMA200 = ExpAverage(close, 200);
AssignBackgroundColor(if close crosses EMA50
then color.red
else if close == EMA50
then color.red
else if close crosses above EMA200
then color.yellow
else if close == EMA200
then color.red
else color.current);

def CrossAlert = close crosses EMA50;
Alert(CrossAlert, "EMACross", Alert.BAR, Sound.RING);
 
Last edited:
Change your code to this, and then you can more easily adjust the inputs for the length of the fast / slow EMAs.

I made some changes to your original color scheme - you should now get a red screen when price crosses the EMAfast, and a yellow screen when price crosses the EMAslow.

Code:
input fast = 45;
input slow = 200;


plot EMAfast = ExpAverage(close, fast);
plot EMAslow = ExpAverage(close, slow);
AssignBackgroundColor(if close crosses EMAfast
then color.red
else if close == EMAfast
then color.red
else if close crosses EMAslow
then color.yellow
else if close == EMAslow
then color.yellow
else color.current);

def FastAlert = close crosses EMAfast;
Alert(FastAlert, "Fast EMA Cross", Alert.BAR, Sound.RING);

def SlowAlert = close crosses EMAslow;
Alert(SlowAlert, "Slow EMA Cross", Alert.BAR, Sound.RING);
 
Last edited:

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
531 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