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.

weekly scans

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 ]

Comments

  • markdmarkd mod
    edited January 2023
    The problem is you have an "or" operator with terms that are not enclosed in brackets.

    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
  • Thank you Mark! I figured it was something easy. I'll definetely turn on advanced editor -
  • Hhm I just fixed the extra brackets around the exchanges and still getting stocks with low volume. I'm also getting stocks with price below the 10sma even though the 4 week sma is above the 10 sma. Is there a another line I need that has price above both 4 and 10 sma and 4 is above 10 sma? All on weekly charts?
    Thanks in advance for any help - this technical writing is not my jam!!
  • Please Copy your scan code from the editor and paste it into the comment box on this thread to make troubleshooting easier.
  • markdmarkd mod
    edited January 2023
    @lmkwin is right. Much easier if you post the entire scan.

    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)]
  • Sorry friends- here is the copy of my scan. One other thought I had - I'm assuming I can only run this scan after the close on Friday to make it a weekly scan?? thanks in advance for ideas!

    [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)]
  • Oops just saw the note above about running this scan on Friday's only. disregard that comment... Now if we can just figure out volume?
  • Are you getting weekly volume from the weekly chart?

    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.
  • lmkwinlmkwin ✭✭
    edited January 2023
    You can run a weekly scan anytime, just be aware that the current weekly bar isn't complete until close on Friday. It's like running monthly scans. Monthly bar isn't complete until end of day last day of the month.


    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
Sign In or Register to comment.