#### Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Options

# create scan for stocks rising above their monthly moving average

i am a long term investor that buys stocks that have fallen dramatically. I am looking to create a scan that shows me stocks that have moved above their 10 month moving average line which usually has been in decline for 2 years or more. Would love help with this

• Options
mod
edited March 2017
Crossing the monthly 10 MA is straightforward:

and [monthly close x monthly sma(10, monthly close)]

Getting the dramatic drop requires some playing around. You could just test that monthly MA 10 is lower than two years ago, but that can happen in a number of ways. Run this and you will see:

and [monthly sma(10, monthly close) < 24 months ago sma(10, monthly close)]

There are probably many ways to improve the results. One way might be adding Fast Stochastics and playing with the parameters. Stochastics tells you where price is in its range over some period of time. The higher the value (0-100) the higher it is, and vice versa.

So, if you want a decline, you test first that it was high some time ago:

and [24 months ago monthly max(12, monthly Fast Stoch %K(24, 1)) > 80]

So that says, some time in the 12 month period beginning 2 years (24 months) ago, at least one monthly close (maybe more) was in the top 80 per cent of the preceding 2 year range.

Then test for recent lows:

and [monthly min(6, monthly Fast Stoch %K(24,1)) < 20]

That says, the lowest monthly close in the last six months was in the lowest 20 per cent of the prior two year range.

You can play with the look back parameters, 6, 12, 24 - make them larger or smaller - to see what happens.

Note that the scan engine allows you to run a monthly scan any time, but if you run it from a mid-month date, a hit may not still be a hit at the end of the month (both the MA value and close value will have changed). You get true results only when you run the scan as of the last close of the month. You can use the calendar tool to select your run dates for back testing (at the top of the Advanced scan page, click on the "0" in "Starting 0 days before...")
• Options
thank you very much i will test it out and get back.This is such a wonderful forum
• Options
@markd I am having issues with scanning for normal stocks above the 200 SMA. For instance look at BA or FDX, when I even try a vague scan it brings back no results or something not even close.

example:

[type = stock]
AND [country = US]
and [DAILY volume > 750,000]
and [monthly close > monthly sma(200, monthly close)]
• Options
mod
edited June 2020
Probably a data issue. 200 months is 16 + years. The scan engine may not be able to handle that.

P.S. it is a data issue:

"Our Scan Engine contains 3000 daily data points (roughly 12 years) for each of the 50,000+ different stocks, indices and mutual funds that we track. "

If you are looking for monthly close above the daily 200 MA, write the scan for daily close above the MA and set the scan date for the last trading day of the previous month.