Scan for Relative Strength slope

hi, I want to scan for a raising Relative Strength (price of the stock divided by the $SPX price) over X number of days.

So I was thinking of using the slope function with something like this:

Slope(3, close/close($spx)) > 0

But I cannot make this work, I appreciate any guidance on how to determine the slope of this

Comments

  • markd
    markd mod
    edited May 2023
    Same thing here - the scan engine can't interpret "close($SPX)". It's not a function the developers coded for (i.e., capture a specific price for a specific symbol).
  • there is the price relative function in the candle glance list view, is there a way to call this variable out in the scan engine?

  • There is the PctRelative( ) function, explained here (scroll down):

    https://support.stockcharts.com/doku.php?id=scans:functions

    So, you could write

    [group is SP500]
    and [PctRelative(20,$spx) > 0]
    rank by PctRelative(20,$spx)

    and you would get a list of sp 500 stocks that are outperforming the index, in order by the per cent outperformance over the last 20 days.


    To get a positive slope, you might be able to put PctRelative inside sma( ), e.g.

    and [sma(20, PctRelative(20,$spx)) > 10 days ago sma(20, PctRelative(20,$spx))]

    I haven't tried it. If it works, you might be able to test the results against Price Relative indicator with parameters $symbol:$spx . I'm not sure if the calculation is the same, but the PR line should be in the same direction, I think.