I've been reading a lot and still haven't quite found the scan code I'm seeking. 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.
I see a lot of crossover code on this forum, but when I run these scans, invariably, the stocks are already well into their uptrend and, sometimes, even too far above the 13-Day EMA for me to go long — so they just go into a watch list for a possible pullback to the 13/26 EMA zone.
So here is what I came up with:
[type = stock] and
[country = us] and
[daily volume > 500000] and
[close > 20.00] and
[close < ema(13)] and
[close >= ema(26)]
Can you help me tweak it so I get better results?
A couple of comments. Are you matching your scan parameters to your trading time frame? If you want to capture the very beginning of a trend the 13 and 26 EMAs won't work because it takes quite a few days to turn them. On 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 it 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,
[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 uptrend, 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 percent changes for in-the-money options can be pretty good, although that cuts both ways.
To see all the responses to this question, go to the original post on s.c.a.n.