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.

How do I scan for symbols with CLOSE < SMA(50,CLOSE) ??

I tried many different versions, NONE work.
I've created many scans before and they all work, but the simple scan of Close < SMA(50,Close) does not work. 90% of the symbols coming thru have a close > than the SMA(50), contrary to what I am scanning for.
Each scan has only this one condition. I tried

[ Type is Stock ]
and
[ [group is SP500]
or [group is SP400]
or [group is SP600]
or [group is NASDAQ100]
]

and [ today's Close < today's SMA(50,Close) ]
alternatively, I tried
and [ yesterday's Close < yesterday's SMA(50,Close) ]
alternatively, I tried
and [ Close < SMA(50,Close) ]
alternatively, I tried
and [ today's Close < 1 day ago SMA(50,Close) ]
alternatively, I tried
and [ today's daily Close < yesterday's daily SMA(50,Close) ]
etc, etc, etc, I tried many different versions, including the reverse, SMA(50,Close) > Close.

All my scan alternatives get the OK from "Check Syntax", so the code is correct.

This is such a simple scan, but it is not finding symbols with the CLOSE < than the SMA(50) of the close.

Your assistance is greatly appreciated.

Thank you.

Best Answer

  • lmkwinlmkwin ✭✭
    edited November 2021 Answer ✓
    When I run this:

    [ Type is Stock ]
    and
    [ [group is SP500]
    or [group is SP400]
    or [group is SP600]
    or [group is NASDAQ100]
    ]

    and [ today's Close < today's SMA(50,Close) ]

    I get 368 hits. Adding a Rank by


    Rank by [today's SMA(50,Close)]

    Will list the SMA 50 value in the results

    Changing the Rank By to

    rank by [close - today's SMA(50,Close)]

    will show the difference in value between the close and the SMA 50. If the close is below the 50 sma the number should be negative.


    [ Type is Stock ]
    and
    [ [group is SP500]
    or [group is SP400]
    or [group is SP600]
    or [group is NASDAQ100]
    ]

    and [ today's Close < today's SMA(50,Close) ]

    Rank by [today's SMA(50,Close)]

    //rank by [close - today's SMA(50,Close)]

Answers

  • markdmarkd mod
    edited November 2021
    I ran this with the first choice and it returned 366 symbols (about noon time, 11/12). I saved the results to the list and applied the stockcharts default chart style. I randomly sampled charts from several different pages of results and they were all correct. But, many had closes very close to the 50 SMA. That made me think that your chart style for results may have an *EMA* instead of and SMA. They are different enough that when prices are close you could get different results - some closes above the EMA that are below the SMA.
  • Thanks for your comment.
    I am using the 50 SMA (not EMA).
    I also ran this today with the first code [today's Close < today's SMA(50,Close)] at about 3:40 PM NY time. 379 symbols came thru. For example, first 10 symbols coming thru were: AAPL, ABC, ACA, ACC, ACIW, ADBE, ADSK, ADUS, AEE, AEL

    Symbol Price ($ only) SMA(50)
    AAPL $149 147.11
    ABC $125 122.00
    ACA $ 55 51.65
    ACC $ 53 50.97
    ACIW $ 35 31.47
    ADBE $657 628.47
    ADSK $329 296.66
    ADUS $102 85.86
    AEE $ 84 83.94
    AEL $ 37 31.75

    In each of the above 10 sample symbols the Close was HIGHER than the SMA(50) of the Close, in some cases substantially higher, i.e ADBE, ADSK, AEL, etc
    The code requires that the Close is supposed to be LOWER than the SMA(50) of the close!!
    Please advise.
    Thank you for your help.
  • markdmarkd mod
    edited November 2021
    Well, this is peculiar because I believe you but I can't duplicate your results.

    The symbols you list are NOT in my results at all. The first 10 I get are

    A, AAN, AAT, ABG, ADS, AEP, AGYS, AIZ, ALGT, ALK

    Maybe it's a browser problem. Try deleting any lists you may have used to save your results, then clear your browser's cache - or try a different browser altogether and see if that helps. Probably wouldn't hurt to reboot, too, if you haven't since the last time you ran the scan.

    P.S. - lmkwin's method is a very efficient way to check your results (rather than randomly checking). When you add the rank by statement, "rank by [close - today's SMA(50,Close)]", ignore the syntax error. It works fine.
  • lmkwinlmkwin ✭✭
    edited November 2021
    I had something unusual happen to me two days ago with the scanner. I did a rank by on List A and the used the 'Replace an Existing ChartList with these results' option on the results. I replaced List A with the results of the scan of List A.

    List A is my public chartlist. It had a sort on it already.

    The resulting List A had a bunch of mismatched Symbols with Names. They were all correct symbols and correct names. They were just mismatched on many. So the Name in the list was for one symbol in the list but the symbol was not for that name.

    I noticed it yesterday, and was able to replicate it. So I then copied List A to a new List B. Ran the sort on List B and then Replaced List A with the results and it worked fine.

    I didn't clear the cache that time but I have had clearing the cache work on most all other issues where something peculiar was occurring.
  • I've had corrupted lists before, although it was long ago. Sometimes servers have disk errors - the wrong things get written or the the disk addresses get corrupted or there is a physical error on the disk. Support did identify the issue and corrected it. But I don't think that's what's going on with Sailor.
  • Imkwin and markd, thank you for your help and suggestions. Very helpful!! I deleted the old scan dump chart lists and created a new scan with the same code from scratch. Rather than typing each letter of the code I selected the suggested code (clicked on 'close' after typing 'cl') in the new scan. The text of the old scan and new scan look identical, but the new scan works and the old scan did not. Very strange. I tried it with Chrome and Edge, the new scan works on both browsers. Even though the text of both scans looks identical and both pass the Syntax Check, somehow the code in the old scan must have been corrupted. I usually type the entire code (much faster), instead of selecting the suggested highlighted code. Thanks again!
  • It's great that we have this forum to work together to ask and answer questions and deal with issues.
  • I just logged on to suggest that you delete the old scan and re-write it from scratch with a new name. I did not think to suggest using the advanced editor prompts, but that is probably a good idea. It may be that the editor (original and/or advanced) anticipates your keystrokes in the background and sometimes guesses wrong. Glad you worked it out!
Sign In or Register to comment.