Howdy, Stranger!

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

scanning for 4 out of the last 5 days

If I wanted to scan for a list of stocks where the price rose yesterday AND volume has risen for 4 out of the last 5 days how would I do that? I tried stringing together a set of and/or statements but I couldn't ever get it to work. So I think something is wrong with how I am coupling them. I understand I would get a large list if this were the only thing in the scan, this is a portion of the query I can't figure out. Any help would be appreciated.

• mod
You would have to figure out all possible combinations of up and down days and group them will "or" statements. The trick with or statements is to watch your brackets. In this case, put double brackets around the five volume relationship statements - so they are treated as one statement; then another set of brackets around ALL the volume relationship statements, so the sequence of "or" conditions is also treated as one statement.

So it would look like this:

// universe of stocks
[group is sp500]

and

[

// 4 days ago is lower volume (today is first day, so "four days ago" is fifth day)
[[4 days ago volume < 5 days ago volume]
and [3 days ago volume > 4 days ago volume]
and [2 days ago volume > 3 days ago volume]
and [1 day ago volume > 2 days ago volume]
and [volume > 1 day ago volume]]

or

// 3 days ago is lower volume
[[4 days ago volume > 5 days ago volume]
and [3 days ago volume < 4 days ago volume]
and [2 days ago volume > 3 days ago volume]
and [1 day ago volume > 2 days ago volume]
and [volume > 1 day ago volume]]

or

// 2 days ago is lower volume
[[4 days ago volume > 5 days ago volume]
and [3 days ago volume > 4 days ago volume]
and [2 days ago volume < 3 days ago volume]
and [1 day ago volume > 2 days ago volume]
and [volume > 1 day ago volume]]

or

// 1 day ago is lower volume
[[4 days ago volume > 5 days ago volume]
and [3 days ago volume > 4 days ago volume]
and [2 days ago volume > 3 days ago volume]
and [1 day ago volume < 2 days ago volume]
and [volume > 1 day ago volume]]

or

// today (day 1 of 5 days) is lower volume
[[4 days ago volume < 5 days ago volume]
and [3 days ago volume > 4 days ago volume]
and [2 days ago volume > 3 days ago volume]
and [1 day ago volume > 2 days ago volume]
and [volume < 1 day ago volume]]
edit should read "and [volume > 1 day ago volume]]
]

• Thanks markd. I think I tried that combination, but I can't be certain of it because I was bleary eyed by the time I gave up last night. It's funny how you and I even labeled each grouping almost identically. Great minds think alike indeed!! It is possible I might not have done the extra bracket around each grouping though, so there is hope my friend! I will let you know if it works for me. I kept getting results where I know a stock met the criteria but it wasn't showing up.
• mod
edited June 2015
You probably know to do this, but if you know the missing stock matches the volume criteria, double check that it meets all other "universe" criteria you might have, like membership in a group or list or industry, or market cap, or SCTR rank, etc. Some to these can change unexpectedly.
• Thanks again Mark. The scan works fine now. I was leaving off the very first bracket in the chained and/or sequence and the very last bracket.
• In case you use this for anything the last group has an error in it. There are two days that have lower volume out of the group.
• mod