#### Howdy, Stranger!

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

# Scan script to find 52 week low within the past month.

I am having trouble figuring out how to write a script that will allow me to find stocks that have hit a 52 week low in the past month. Can anyone help?

• mod
You may be having some trouble because the way you are looking at the question mixes time frames - weekly and monthly.

So there are two ways to put things into one time frame. One would be to express the 52 week low and the one month look back period in terms of days. So 52 weeks would be 251 days (260 - 9 market holidays), and the one month look back could be either 20 or 21 (the actual number of trading days in all months is between 19 and 22).

So, if the lowest price in the last month is the same as the lowest price in the last year, those two prices are equal. So the scan would be:

and [min(251, low) = min(21, low)]

The other way to do it is to use the weekly time frame. A year is 52 weeks and a month is about 4 weeks - although months don't always begin or end when weeks begin and end. The syntax is a little more complex - note that each term, min() and low, both have to have the "weekly" modifier. Another catch is, to get accurate results, you have to run weekly time frame scans with dates that are the end of a week. If you run a weekly scan mid-week, say Thursday, the scan engine counts Thursday as the end of the week. So you would set the scan date to the prior Friday using the calendar tool above the scan window.

So the scan would be:

and [weekly min(4, weekly low) = weekly min(52, weekly low)]