#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

# Daily EMA 10 scan

Hi,

Anyone have a scan that will produce a list of stocks that price is at the Daily EMA 50 line ?

Thanks

Not sure if you are looking for EMA10 or EMA50 but you can just adjust the following scan codes.

First you could just write a scan for the Close to be equal to the EMA50 of the close.
[type = stock]
and [close = ema(50,close)]

However this method will miss alot of stocks, as things are rarely exactly equal, in fact you would often get zero hits with this coding. The problem is the Close is usually stated to 2 sometimes 3 decimal places, whereas the EMA50 will be calculated to multiple decimal places, thus an exact match is almost impossible.

What you really need to look for is the Close within a few percentage points of the desired EMA line. Here's a code that looks for the close to be within +\- 2% of the EMA50.

[type = stock]
and [close >= ema(50,close)*0.98]
and [close <= ema(50,close)*1.02]

For more detailed information on this type of coding see the following blog article.

http://stockcharts.com/articles/scanning/2010/03/gord-greer-scanning-for-near-crosses.html
• mod
edited January 2016
@ss_427 Agree with @gord 's observations, approach and advice.

A couple of other ways to handle it:

Use a crossover test instead of an envelope: Crossover closes (above or below) are usually near the MA, but even if they get away from the MA target envelope might still be an immediate trading opportunity.

For price closing above the MA when the previous close was below the MA:

and [close x ema(50, close)]

And similarly for cross below - just reverse the terms:

and [ema(50,close) x close)]

A variation on using percentages for the MA envelope would be to use the ATR (average true range):

and [close < ema(50, close) + ATR(5)]
and [close > ema(50, close) - ATR(5)]

You can experiment with the ATR parameter, maybe 10 or 21, or add a factor to the ATR(x) - like ATR(x)*1.5 to widen the envelope, or ATR(x)*0.5 to narrow it, or make it wider on the top than the bottom, or vice versa. The advantage of using whatever form of ATR is the target envelope fluctuates with the volatility of the stock.

• I think the following might help. Just change the EMA.

// 20 ema price crossover Up

[type = stock] AND [COUNTRY = US]
//and [SCTR > 90]
AND [Daily Volume > 500000]
AND [Daily Close > 10]
and[Yesterdays close <= Yesterdays EMA(20)]
and [Todays close > Todays EMA(20)]

// 20 ema price crossover Down

[type = stock] AND [COUNTRY = US]
//and [SCTR > 90]
AND [Daily Volume > 500000]
AND [Daily Close > 10]
and[Yesterdays close > = Yesterdays EMA(20)]
and [Todays close < Todays EMA(20)]

http://stockcharts.com/articles/scanning/2009/02/scanning-for-crossovers.html

eg....http://stockcharts.com/h-sc/ui?s=AGG&p=D&yr=0&mn=4&dy=0&id=p10423255914

Quill -