Moving Average Crossovers For ThinkOrSwim

Hello everyone,

I am looking for movie average crossover scanner and alert. Here is the short moving average cloud.

input ema1low = 5;
input ema1high = 12;
def ema5 = ExpAverage(close, ema1low);
def ema12 = ExpAverage(close, ema1high);
AddCloud(ema5, ema12, Color.green, Color.RED);


I would like to create scanner where price crosses above the 5-12 ema cloud on 10 minutes and also the alert. Thank you in advance..
 

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

Code:
def ema200 = ExpAverage(close, 200);
def ema50 = ExpAverage(close, 50);
def ema15 = ExpAverage(close, 15);
plot scan = ema15 crosses above ema200 and ema50 cross above ema200 ;
FYI, Having a scan alert when ema15 and ema50 cross at the exact same point this scan will have limited results.
Is there a way to make a watchlist that shows when 9-EMA crosses the 100-SMA? It would need to be color coded for green as crossing above, red crossing below, and yellow as neutral. I tried making it, but it doesn't work in the watchlist. Would this particular code work in the watchlist if the values were changed? Would SMA be used for the 100 instead of EMA? I only need those two moving averages.
 
Hello, can someone help me with coding, where I get an alert for every time the EMA 13 crosses above and below the EMA 21 on the 15minute time frame.
 
how do i convert this to EMA study??

# MA Crossover Watchlist AG
# blt
# 5.19.2016

def ma_fast = average(close,9);
def ma_slow = average(close,50);
def xo_up = ma_fast crosses above ma_slow;
def xo_dn = ma_fast crosses below ma_slow;
def up = ma_fast > ma_slow;
def dn = ma_fast < ma_slow;

plot output = if xo_up OR xo_dn then 1 else 0;
output.assignvaluecolor(if up then color.green else if dn then color.red else color.yellow);

assignbackgroundcolor(if up then color.green else if dn then color.red else color.black);

# End Study
 
@m2je @BKK
I moved your post here. There are 14 pages of crossover scripts. Change the lengths, plug & play and then come back and tell us any tweaks that you still need.
 
Last edited:
how do i convert this to EMA study??

# MA Crossover Watchlist AG
# blt
# 5.19.2016

def ma_fast = average(close,9);
def ma_slow = average(close,50);
def xo_up = ma_fast crosses above ma_slow;
def xo_dn = ma_fast crosses below ma_slow;
def up = ma_fast > ma_slow;
def dn = ma_fast < ma_slow;

plot output = if xo_up OR xo_dn then 1 else 0;
output.assignvaluecolor(if up then color.green else if dn then color.red else color.yellow);

assignbackgroundcolor(if up then color.green else if dn then color.red else color.black);

# End Study
Is there a way to make this where it has the close above or below the 100 SMA without throwing off the rest of the code? I find crossovers that cross above the 100 SMA are best for long positions and those that cross below that are below the 100 SMA are best for short positions. About 90% of trades on this method make money. It doesn't matter which moving average the crossover is using this method that I've tried thus far. For example, a 9-EMA crossing above the 21 SMA that is above the 100 SMA will be 90% likely to make money on a long position. The philosophy behind this is that stocks that are above the 100 SMA are trending up and those that are below are trending down.
 
Good morning yall,

Hope someone can help me with this request...

Looking to setup either a scanner or alert on a watchlist that will alert when the following is true...

(13 EMA crosses above 48 EMA & BOTH ARE ABOVE the 200 EMA) as well as the opposite (13 EMA crosses below 48 EMA & BOTH ARE below the 200 EMA)

Is this possible? Any guidance would be greatly appreciated
 
Good morning yall,

Hope someone can help me with this request...

Looking to setup either a scanner or alert on a watchlist that will alert when the following is true...

(13 EMA crosses above 48 EMA & BOTH ARE ABOVE the 200 EMA) as well as the opposite (13 EMA crosses below 48 EMA & BOTH ARE below the 200 EMA)

Is this possible? Any guidance would be greatly appreciated
You can modify this script to do what you want:
https://usethinkscript.com/threads/moving-average-crossovers-for-thinkorswim.229/page-13#post-87392
 
i use 8/21/34/55/89 for ema stack crossover on MTF,,, im only finding dynamic labels for 2- emas at ones,,, i want to plot 1 label on a single chart that shoes if all timeframes match,,,, THE Ripster Indicator on here is perfect however only plots 2 emas, the 5/21,,,

I guess my question is, would the 55crossing up or down the 89 be the same as the whole stack crossing??? 8/21/34/55/89?

any assistance would be greatly appreciated
 
Hello, is there a way to add a 9/21ema crossover scan to a personal watchlist? For example: I only want the EMA scan to scan the following Tickers: SPY, QQQ, AMD, NVDA, GS, BA, etc…

Would really like to see the highlighted columns on the specified tickers once the crossover has happens. Reference: https://usethinkscript.com/threads/moving-average-crossover-watchlist-column-for-thinkorswim.119/

Any feedback would be much appreciated!
Thanks!
Not sure what you are asking?
How to create a manual watchlist?
  1. click on MarketWatch
  2. click on Quotes
  3. click on the 2nd menu icon on the right side of the screen
  4. click on Create Watchlist
  5. name the watchlist
  6. type in the Tickers: SPY, QQQ, AMD, NVDA, GS, BA, etc…
  7. click on save
add your watchlist column:
https://usethinkscript.com/threads/moving-average-crossover-watchlist-column-for-thinkorswim.119/
 
Last edited:
I was wondering if you knew a way to have a column in watchlist that shows the point of three moving averages crossing over for example the 4, 9, 18 SMA not exponential?
 
I was wondering if you knew a way to have a column in watchlist that shows the point of three moving averages crossing over for example the 4, 9, 18 SMA not exponential?
Crossing over what? Crossing over each other? all at the same time? all at the same exact point? That will severely limit results.
In order to understand what you are asking, we need you to provide a screen grab of an example of a chart displaying the crossing over. Make sure to grab the whole chart so we can see the aggregations, what stock, and all your settings so we can understand your request.
After you post the above information, I am sure someone will be able to point you toward possible solutions.
Unsure of how to upload screenshots to the forum, Here are directions.
 
Sounds like you might be a Benzinga fan :) . Here is a script I use that was inspired by them. The plot lines are hidden since I use it for the cloud.
I added in the Alerts for you and have not tested them. You can change the Tick to Bar if you want it to sound only once per crossing within the bar. Comment out # out the Hide() if you want the lines or don't want the labels.


Code:
# 8 EMA  above 21 Ema  = bullish
# Benzinga inspired
#AddLabel(yes, "8/21 EMA", color.cyan);


def s_ema = ExpAverage(close, 8);
def l_ema = ExpAverage(close, 21);

def bullish = s_ema > l_ema;
def bearish = l_ema > s_ema;

  AddLabel(yes, if bullish then "bullish_8/21ema" else "", CreateColor(175,250,175));
  AddLabel(yes, if bearish then "bearish_8/21ema" else "", CreateColor(250,125,125));

plot DEMAS = s_ema;
DEMAS.SetDefaultColor(GetColor(1));
DEMAS.Hide();

plot DEMAL = l_ema;
DEMAL.SetDefaultColor(GetColor(1));
demal.Hide();

AddCloud(DEMAS,  DEMAL,  CreateColor(175,250,175),  CreateColor(250,125,125));


#--Alerts added for Town7425  Change Alert from Tick to Bar if you want it to sound only once on crossing per each bar
Alert(s_ema crosses above l_ema, "8 ema crossed up", Alert.Tick, Sound.Ding);
Alert(l_ema crosses above s_ema, "21 ema crossed up", Alert.Tick, Sound.Chimes);
 
Would these work to show Moving Average Crossovers? If i'm trying to make it so that the EMA label changes color to indicate when the 9 ema crosses over the 20EMA and vise versa?
 
Darth, the label in my script above does change color depending on which ema is above the other. Green for bullish and red for bearish.
 
I would like to get notified 5 mins or a bar prior to the cross of the ema 13 and ema 48 on the 5 min chart.

we all would like to get notified 5 min prior to a crossing. If you are looking for Xovers , they have to occur before a script will fire!
 
Last edited by a moderator:
I would like to get notified 5 mins or a bar prior to the cross of the ema 13 and ema 48 on the 5 min chart.

we all would like to get notified 5 min prior to a crossing. If you are looking for Xovers , they have to occur before a script will fire!
What logic are you using to know if a stock's moving averages ?MIGHT? cross and ?WHEN?
Perhaps a better scenario would be to use the logic of "when the emas are within x% of each other"?
That is one of the most popular scans / alerts on the forum.
There are 8 pages of scanning, alerting, labeling when emas are within x percentage of each other:
https://usethinkscript.com/threads/...een-emas-or-any-2-plots-for-thinkorswim.1345/
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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