New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.
I'm trying to write a simple scan that shows only NYSE and Nasdaq stocks that have price above 4 week and 10week simple moving averages. I also want stocks that have a weekly volume above 2,500,000 (500,000 daily average)
Below is my written scan now - problem is it's finding tons of stocks that don't have the volume above 2,500,000 for the week. Any ideas on how to fix?? I thought this would be a pretty simple scan to write!!
[type = stock] AND [weekly SMA(4,weekly Close) > weekly SMA(10,WEEKLY Close)]
and [ exchange is NYSE ] or [exchange is NASD]
and [ weekly volume > 2500000 ]
0
Comments
If you turn on the "Advanced Editor" it will give you a warning about this. The editor button is above the scan writing window to the right (in the Scan Criteria bar). A check mark beside it indicates that it is on. You have to get used to it offering suggestions and warnings. They go away as you type, as long as what you type is correct.
So here's your scan corrected for brackets (the sp600 is just to limit hits):
[type = stock]
and [[ exchange is NYSE ] or [exchange is NASD]] // note "extra" parent brackets around the exchange requirements
//and [group is sp600]
and [ weekly volume > 2500000 ]
AND [weekly SMA(4,weekly Close) > weekly SMA(10,WEEKLY Close)]
Here's a link to a Support article about logical operators, including "or", about 2/3 down the page. "OR" can be tricky. If you don't enclose the alternatives in brackets, you get any symbol that matches ANY condition in the scan. That explains your hits with low volume - they were included because they matched at least one condition in your scan.
https://support.stockcharts.com/doku.php?id=scans:advanced_scan_syntax
Thanks in advance for any help - this technical writing is not my jam!!
Volume sounds like a coding error.
Price below the 10 sma may be an accurate result. Moving averages are lagging indicators, so a sharp drop in price can get below the averages. Also, keep in mind the weekly averages are "accurate" only on the weekend (after close of business Friday). The mid week values are base on partial data - e.g, the "weekly" bar on Wednesday close is calculated from only 3 days of data, not all 5. So the results midweek can differ from end of week results.
If you don't want those results where price is below an MA, you can code for it -
and [weekly close > weekly sma(10 weekly close)]
[type = stock]
and [[ exchange is NYSE ] or [exchange is NASD]] // note "extra" parent brackets around the exchange requirements
//and [group is sp600]
and [ weekly volume > 2500000 ]
AND [weekly SMA(4,weekly Close) > weekly SMA(10,WEEKLY Close)]
Or are you reading the volume on the results page?
The volume on the results page is daily. The results page doesn't "know" what is in your scan. The data displayed is a "hard-coded" selection of data from the scan database, which includes daily volume even if every condition in your scan tests weekly data. The volume data you see on the weekly chart should be correct.
Add
rank by [weekly volume]
as the last line of your code and the weekly volume will display in the last column of the results page.
So if you copy from //Start to //Finish you should be seeing what you want to see as far as I can tell.
Hopefully this makes sense to you and should provide the symbols from the NYSE or Nasdaq that have a weekly volume greater than 2500000, with a price that is above the weekly SMA 10 closing value, and the weekly SMA 4 closing value is greater than the weekly SMA 10 closing value. The results will be listed in Descending Weekly Volume order.
//Start
// this is the original scan
[type = stock]
and [[ exchange is NYSE ] or [exchange is NASD]] // note "extra" parent brackets around the exchange requirements
//and [group is sp600]
and [ weekly volume > 2500000 ]
AND [weekly SMA(4,weekly Close) > weekly SMA(10,WEEKLY Close)]
//I'm getting prices below the the 10 week. @markd suggests adding this line
and [weekly close > weekly sma(10 weekly close)]
//this line adds the current weekly volume value in the last column of the results page
rank by [weekly volume]
//Finish