#### Howdy, Stranger!

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

# 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

• 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...")
• thank you very much i will test it out and get back.This is such a wonderful forum