Is there a way to scan for stocks in weak sectors?

I am trying to use a MACD bearish crossover scan to find stocks only in the 3 weakest sectors. Is there a condition that looks for sector weakness?

So far my code is:

[country = US]
and [macd line(12,26,9) > 0]
and [macd line(12,26,9) <= macd signal(12,26,9)]
and [yesterdays macd line(12,26,9) > yesterdays macd signal(12,26,9)]
and [2 days ago macd line(12,26,9) > 2 days ago macd signal(12,26,9)]
and [3 days ago macd line(12,26,9) > 3 days ago macd signal(12,26,9)]
and [ATR > 2]

Comments

  • markd
    markd mod
    edited May 2024
    I think you would want to find the weakest sectors in a separate scan.

    First you would have to have some measure of weakness, maybe per cent change over three months.

    Then you would need a list that includes all the sector SPDR ETFs, or other kind of sector indexes. Your scan to find the weakest sectors would be a simple 'rank by' statement using your choice of strength/weakness measure.

    For instance
    // begin scan

    // rank sectors by 3 month per cent change

    [favorites list is 133] // Sector SPDRs daily (substitute your list)
    rank by PctChange(60,close)

    // end of scan

    Then add the bottom 3 results to the scan you have above with an "OR" statement. Select the sectors from the "Sectors and Indexes" drop down, and edit
    // Start scan

    // you don't need "country is US" if you name the sectors

    [ // begin OR statment

    [group is HealthCareSector]
    OR
    [group is TechnologySector]
    OR
    [group is RealEstateSector]

    ] // end OR statement

    and [macd line(12,26,9) <= macd signal(12,26,9)]
    and [yesterdays macd line(12,26,9) > yesterdays macd signal(12,26,9)]

    ... etc.

    At the top, after the sectors "OR" statement, you may want to add some other ticker properties to limit the results, e.g. volume and/or market cap, like

    and [market cap > 1000]
    and [sma(20, volume) > 1000000]

    or whatever you are interested in.