How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...   http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
questions            tags         users          badges    unanswered
                                                                                                                                        search
                                                                                    questions          tags        users
                   I've been reading a lot and still haven't quite found the scan code I'm seeking.
            6      I'm looking for a scan that will bring up stocks at the beginning of an uptrend where the 13 Day EMA crosses above
                   the 26 Day EMA.
                   As a side note, I follow the Elder Impuse system and I like to trade within Keltner Channels.
             1
                   I see a lot of crossover code on this forum, but when I run these scans, invariably the stock is already well into its
                   uptrend and sometimes even too far above the 13 Day EMA for me to go long - so it just goes on a watch list for a
                   possible pullback to the 13/26 EMA zone.
                   So here is what I came up with - can you help me tweak it so I get better results?
                   Thanks - this site is terrific!!!
                   [type = stock]
                   and [country = us]
                   and [daily volume > 500000]
                   and [close > 20.00]
                   and [close < ema(13)]
                   and [close >= ema(26)]
                    uptrend     ema      crossover     scan
                                                                         edited Feb 02 '12 at 09:04         asked Jan 27 '12 at 16:24
                                                                                 ta4u                              BearTrader
                                                                                 5.2k ● 12● 23                     400 ● 1● 8● 15
                 11 Answers:
           oldest     newest      most voted
                   Hi BearTrader, quote from your previous post.
1 of 10                                                                                                                            11/22/2013 5:23 PM
How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...   http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
            3    "..I am looking for stocks where either the 13 and 26 EMAs or 3 and 13 EMAs have just crossed over (13 above 26, o
                 3 above 13). I also need the stock to be trading in between the 13 and 26 or 3 and 13 EMAs.."
                 I see what you are trying to do, however this approach really won't work, due to the fact that for the 13EMA to rise the
                 stock price has to be above the 13EMA. Same for the 13/26 crossover to occur the stock price would have to be
                 above both. Thus we need a different approach to get a hit a little earlier in the trend change, ie closer to the bottom
                 and before the actual 13/26 crossover.
                 I would suggest looking at comparing say the 13SMA against the 13EMA and look for a crossover there which would
                 give you an earlier signal. I'll think about it more over the weekend, interesting problem.
                 http://stockcharts.com/h-sc/ui?s=AMRN&p=D&yr=0&mn=1&dy=0&id=p77122382548&a=255412664
                 Cheers Gord
                  link                                                                                      answered Jan 28 '12 at 12:34
                                                                                                                   Gord
                                                                                                                    17.2k ● 11● 21
                 BearTrader, when you wait for an MA crossover, even with the faster emas vs smas, you are pretty much giving up th
                 rewards of a more risky earlier entry for the confirmation of the MA crossover. In effect, you are paying for information
            3
                 The reason a high percentage of the ema crossover trades look good is that the crossover condition has eliminated
                 stocks where buyers failed to follow through.
                 If you want to catch pre-follow through situations, look at your scan results and find the events they have in common
2 of 10                                                                                                                           11/22/2013 5:23 PM
How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...        http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
                 just before the crossover. How did buyers show they were gaining strength? Here are two possibilities:
                 This picks the ema 3 turning up after falling a few days. It can only happen with at least one higher close:
                 and [ema(3,close) > 1 day ago ema(3,close)]
                 and [ema(3,close) < 3 days ago ema(3,close)]
                 This picks a close above a recent lowest high, which must happen for a rally to proceed:
                 and [close > min(3,high)]
                 You can play with the parameters, of course. There will be some overlap because an ema crossover can occur
                 simultaneously with these events, but usually they would occur a day or two before. But you should get more hits than
                 you would with a crossover scan. The trick is to pick which ones will follow through - that is, to see the future which th
                 crossover scan shows you after the fact. For that you might want to visually inspect Price Performance versus a
                 relevant index (it should be generally rising) or a volume indicator like MFI, Force Index or CMF.
                 Remember, indicators are created by aggregating price action, and so are normally late. The earliest possible signals
                 but the hardest to learn to read, are in price action itself. You want to see recent price action that shows 1.) buyers are
                 becoming active (up closes, closes above highs, and best of all closes above highs on noticeably higher volume) and
                 2. sellers are pretty much done - after big volume down days, further down days, if any, are on lower volume, or on
                 high or low volume, prices just stop going down. Sorry to just run on. Hope that helps some.
                  link                                                                                            answered Feb 05 '12 at 15:37
                                                                                                                         markd
                                                                                                                          12.1k ● 13● 22
                         Thanks for the response - What you say makes a lot of sense. I often find I run the crossover scans, find good candidates,
                         and then wait for them to retrace a bit back to the 13 EMA zone so I can get back in later on.
                         And yes -- I am now seriously watching Force Index and volume more closely to see if they validate what is occurring with
                         the EMA turning up/ crossovers.
                         Again thank you for your insight. This conversation and exploration of various scanning possibilities has taught me a great
                         deal about writing scans, price action, & volume.
                                                                                                                       BearTrader (Feb 05 '12 at 18:20
                 Hi BearTrader, a couple of comments. Are you matching your scan parameters to your trading time frame? If you wan
                 to capture the very beginning of a trend the 13 and 26 won't work because it takes quite a few days to turn them. On
            4
                 the other hand, once turned, they may be good choices for longer term trades. If you want to get in early, you could try
                 much shorter term crossovers, e.g. 3x13
                 and [ema(3,close) x ema(13,close)]
                 To get in even earlier, test for a close crossing a falling ema
                 and [close x ema(13,close)] and [ema(13,close) < 5 days ago ema(13,close)]
                 To further put things in your favor, also test for a rising longer term moving average
                 and [ema(50, close) > 10 days ago ema(50,close)
                 I've also noticed recently, although I haven't tested extensively, that a close above the lowest open when the short
                 term MA is falling can be followed by a change of trend, sometimes after a test of the low, so:
3 of 10                                                                                                                                  11/22/2013 5:23 PM
How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...         http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
                 [group is sp500]
                 and [ema(13,close) < 5 days ago ema(13,close)]
                 and [close > open]
                 and [close > 1 day ago min(7, open)]
                 A final note: I'm defining trend here really as a leg or a swing in a larger up trend, assuming that's what your are
                 looking for. Also, I've noticed higher volume, higher priced stocks tend to form more regular patterns (most of the
                 time). If you want the lower price bang for the buck, the per cent changes for in the money options can be pretty good
                 although that cuts both ways.
                  link                                                         edited Jan 27 '12 at 18:46           answered Jan 27 '12 at 18:43
                                                                                                                            markd
                                                                                                                             12.1k ● 13● 22
                         I like to trade off the daily charts, but use weekly charts as my compass. I pretty much only look at 13, 26 and 200 EMAs
                         across both timeframes. I find that when I run my originally submitted scan, I mostly get stocks that are in fact pulling back
                         to the zone between the 13 and 26 EMAs, but that also seem poised to fall rather than trending back up towards the upper
                         Keltner channel.
                         I'll try out some of your suggestions and see how the results jive with Elder's Impulse system.
                         Thanks!! Off to work.....
                                                                                                                           BearTrader (Jan 27 '12 at 19:01
                 I'm going to add a chart image below so you can see where I am hoping to get in to a developing Long stock trade.
            4    I mentioned before that I am actually a momentum trader and I like to trade Keltner and MA channels. Ultimately, I am
                 looking for stocks where either the 13 and 26 EMAs or 3 and 13 EMAs have just crossed over (13 above 26, or 3
                 above 13). I also need the stock to be trading in between the 13 and 26 or 3 and 13 EMAs (either a pullback or a fres
                 breakout). So....
                 I wonder if there is some way to incorporate Keltner Channels into the scan code and look for trades that are a certain
                 percentage above or near the central Keltner 20 MA? (FYI - I use 20, 2.5 for my Keltner Channels). Hmmmm....lots to
                 think about - any ideas wise ones?
                 Here's a chart showing where I'd like to enter....
4 of 10                                                                                                                                     11/22/2013 5:23 PM
How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...   http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
5 of 10                                                                                                                           11/22/2013 5:23 PM
How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...    http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
                                                        link                                                   answered Jan 28 '12 at 10:46
                                                                          edited Jan 28 '12 at 12:07                   BearTrader
                                                                                  ekwong                               400 ● 1● 8● 15
                                                                                  7.5k ● 29● 39
                     I would just note here that you are looking for a long entry in a stock that is in a long term down trend (200 MA declining).
                     Obviously there will be a point where this kind of trade will work, but as long as the trend is down the odds are against you
                     because rallies tend to be shorter both in duration and points during a down trend. Your method of waiting for a moving
                     average cross is a problem in this situation because you are using up extra time waiting for MAs to cross when you don't
                     have time to spare. You could add a line for 200 MA or 50 MA rising (> 20 or 5 days ago) to up your odds.
                                                                                                                          markd (Jan 28 '12 at 22:03
                 BearTrader if you are a short term trader like myself your entry is perfect!
            3    Your entry is backed up by many indicators: • There is a classic double bottom pattern in play • Bullish divergance on
                 the MACD • Rising trend line on the MACD close to the zero line • MACD crossover on the day you picked.
                 This is one of the highest probability trades you can make. Professional are not afraid to enter on a high probability
                 trade like this! The reason why they enter early is so the can sell to others in the run up. Trust me, I trade for a living,
                 not for kicks like others who are discretionary gamblers ;)
                 The 3,10,16 MACD is used by Linda Raschke. John Murphy has said that she is one of the best, if not THE best
                 trader in world so she must be doing something right ;)
                 One thing I would suggest is that you pick one indicator and master it. Too many indicators creates analysis paralysis
                 Peace and happy trading :)
6 of 10                                                                                                                               11/22/2013 5:23 PM
How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...         http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
                  link                                                         edited Feb 05 '12 at 19:44           answered Feb 05 '12 at 19:40
                                                                                                                            Love_To_Trade
                                                                                                                            5.8k ● 9● 18
                 So far I tried the following much shorter term crossovers (3 / 13 EMA) as suggested using the following scan:
            1    [type = stock]
                 and [country = us]
                 and [daily volume > 500000]
                 and [close > 20.00]
                 and [ema(3,close) x ema(13,close)]
                 The results were good and I even found a Bull Flag formation setting up! Nice.
                 I'll try the other suggestions next. I'm a momentum channel trader - I just can't help myself.
                  link                                                                                              answered Jan 27 '12 at 19:14
                                                                                                                            BearTrader
                                                                                                                            400 ● 1● 8● 15
                         Ok - I got 9 stunning and relevant results with the following scan - kind of a mish-mash of your ideas - am I getting this right
                         This formula is now called the Whopper Jr. in my list of favorite scans.....Thanks!
7 of 10                                                                                                                                     11/22/2013 5:23 PM
How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...        http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
                         [type = stock]
                         and [country = us]
                         and [daily volume > 500000]
                         and [close > 20.00]
                         and [close x ema(13,close)] and [ema(13,close) < 5 days ago ema(13,close)]
                         and [ema(50, close) > 10 days ago ema(50,close)]
                                                                                                                        BearTrader (Jan 27 '12 at 19:25
                 I modified the TAZ scan above with 3/ 13 EMA parameters - but I'm still not catching stocks at the beginning of an
                 uptrend - instead the scan brings back stocks that are pulling back to the 3/13 EMA zone near the top of the trend.
            1
                 That's good too (maybe for shorting candidates) - but still not quite what I'm looking for. Any other suggestions for
                 modifying the code below to catch a stock at the beginning of an uptrend with 3/13 EMAs?
                 [type = stock] and [country = us] and[daily ema(60,daily volume) > 150000] and [daily high < yesterday's daily high]
                 and [yesterday's daily high < 2 days ago daily high] and [ema(3, close) > ema(13, close)]and [daily close > daily
                 ema(13,daily close)]and [daily close < daily ema(3,daily close)]and [daily close > daily ema(200,daily close)]and
                 [weekly ema(3,weekly close) > weekly ema(13,weekly close)]and [ADX Line(10) > 20.0]and [close >= 5]
                  link                                                                                            answered Jan 28 '12 at 06:30
                                                                                                                          BearTrader
                                                                                                                          400 ● 1● 8● 15
                         You might want to test your scans by moving back the scan date (time traveling) to see if you are really at the top of an up
                         trend when you get the signal or at the beginning of a much bigger move. When you run the scan, use the Starting "0" days
                         before Last market close (date) feature at the top of the advanced scan page and set the "0" to 10, 20, 30, etc. days back
                         and see what you get.
                                                                                                                             markd (Jan 28 '12 at 21:52
                 I realized my last chart example wasn't ideal as the entry was below the 200 EMA - so here is a better chart (link) so
                 you can again see what I am shooting for. I'd still appreciate any scanning advice - so far all of the suggestions have
            1
                 been great and are getting me closer and closer to my goal.
                 Keep in mind I am looking for the 13/ 36 EMAs (OR 3/ 13 EMAs ) to cross above the 200 or 50 EMA/ or SMA. By the
                 way, I use Elder Impulse and Keltner Channels, as well as Force Index. FYI - I've been toying around with both PPOs
                 and Range scans too - with so-so results.
                 Thanks! This has been really challenging!
                 LINK FOR CHART : http://stockcharts.com/h-sc/ui?s=BMRN&p=D&b=5&g=0&id=p45361054538&a=255350993
                  link                                                                                            answered Jan 29 '12 at 09:18
                                                                                                                          BearTrader
                                                                                                                          400 ● 1● 8● 15
                         I wonder if you would feel comfortable with a slight modification to your approach to catch an earlier entry. You have Slow
                         Stochastic on your chart - you could include it in your scan
                         and [min(7,Slow Stoch %K(14,3)) < 20]
                         That insures a good dip preceding entry; then, test for close above both emas:
8 of 10                                                                                                                                  11/22/2013 5:23 PM
How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...           http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
                         and [close > ema(13,close] and [close > ema(26,close]
                         (or test for just one or either one - watch your "or" syntax)
                         This could get you in before the emas cross over. If you don't want to give up the crossover, maybe use it as confirmation
                         after entry. Just an idea.
                                                                                                                              markd (Jan 29 '12 at 16:44
                         Thanks again - just tried out the above (scan listed below) and came up with 2 candidates - one of which I am already
                         trading! SWN. How funny. I can see that I can modify this scan a bit more so I'll let you know what I come up with too....
                         [type = stock] and [country = us] and[daily ema(60,daily volume) > 500000] and [daily high < yesterday's daily high] and
                         [yesterday's daily high < 2 days ago daily high] and [ADX Line(10) > 20.0]and [close >= 5] and [min(7,Slow Stoch %K(14,3)
                         < 20] and [close > ema(3,close)] and [close > ema(13,close)]
                                                                                                                         BearTrader (Jan 29 '12 at 17:06
                         BearTrader, looks like you tweaking some ideas and getting closer to what you want. Note I've given you another 10 points
                         so you can now save a chart and upload it. Links to charts are nice and other users can see how you set up the chart but if
                         you change the chart and save it the posted link will then pull up the new chart. Sometimes its nice just to have a picture
                         that doesn't change.
                         happy scanning
                                                                                                                               Gord (Jan 30 '12 at 13:45
                  [type = stock] and [country = us] and
            1
                  [daily ppo line(13,26,9) crosses 0] and
                  [daily ppo line(1,26,9) >= ‐1] and
                  [daily ppo line(1,13,9) <= 1]
                  link                                                                                              answered Feb 05 '12 at 10:25
                                                                                                                           ekwong
                                                                                                                           7.5k ● 29● 39
                 UPDATE #2: Somebody else just asked how to run a scan that displays stocks where the price is withing 2% of the
                 150 day moving average - so I changed it to +/- .3% of the 13 EMA and came up with this beauty - It's catching about
            1
                 20 stocks within the 13/ 26 EMA range - I'm getting closer.....I would appreciate some feedback if you have time (does
                 any of it seem redundant?)
                 [type = stock] and [daily ema(20,daily volume) > 500000]
                 and [close >= ema(13,close) * 0.997]
                 and [close <= ema(13,close) * 1.003] and [Close >=10] and [Close <=30]
                  link                                                          edited Feb 05 '12 at 10:34          answered Feb 05 '12 at 10:27
                                                                                                                           BearTrader
                                                                                                                           400 ● 1● 8● 15
                         This scan is fine. In the end you want to define your parameters -- whether the uptrend indicator is a 3x13 or 13x26, and
                         whether your value zone is 13-26 or some other combination. There's no right or wrong answer on this.
                                                                                                                            ekwong (Feb 05 '12 at 10:36
                         Thanks for the feedback and you are correct - I need to nail down my parameters once and for all - 3/ 13/ 26/ what have
9 of 10                                                                                                                                    11/22/2013 5:23 PM
How to scan for stocks in uptrend just as the 13 Day EMA crosses over t...   http://scan.stockcharts.com/questions/3969/how-to-scan-for-stocks-in-up...
                     you...Glad you approve.
                                                                                                                 BearTrader (Feb 05 '12 at 10:40
            1   2   next page »
           Your answer
           [hide preview]
            Login/Signup to Post Your Answer
                                                  about | faq | privacy | support | contact
10 of 10                                                                                                                           11/22/2013 5:23 PM