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.

Can I check to see if Spy is above its 50 dma within a scan of other stocks?

Within a scan of a group of stocks, I would like to check to see if the ETF "Spy" is above its 50 day moving average. I know the following code will not accomplish that. But can someone tell me if it is possible and what code would do that? Thanks in advance.

['Spy' close > 'Spy' sma(50,close)]

BobS

Answers

  • markd
    markd mod
    edited 10:19AM

    I believe SPY would have to be in the list you scan, and one of the conditions of the scan would have to be

    and [close > sma(50,close)]

    But that would mean that only those stocks in your list that are also above their 50 ma would appear in your results. And, SPY would appear only if it met all your additional conditions for the group.

    In other words, only the symbols that match all your conditions appear in the results list.

    An advantage of putting an index symbol in a list is that the results will show which symbols are moving in concert with the index. If the index symbol shows up in the results, the other symbols are moving with it. If the index symbol does not show up, the other symbols are on their own.

    Also, if you include a 'rank by' statement for some measure, e.g., rank by ROC(63), you will see which symbols are outperforming or under performing the index for that measure.