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.

Scan for Ratio - Relative Strength Ratio (not RSI)

I'm looking for a way to scan when a RS (Relative Strength) ratio (not RSI) breaks out from a Bollinger 20,2.0 upper band.

E.g. on Feb. 3rd, the ratio crossed over BB 20,2.0

I know how to scan for a MA Breakout, but not for a ratio.

Is there a way to do so?
Many thanks in advance!

Best Answer

  • markdmarkd mod
    Answer ✓
    If you want a set of scan statements to look at only one symbol, or several symbols, you can specify the symbol(s), as you might specify [group is sp500]. For instance, you could write a scan:

    [ [symbol is IBM] or [symbol is AAPL] ]

    and [close > 1 day ago close]

    It would return either IBM or AAPL, or both or none, depending on what happened to each stock that day versus the day before.

    But, this feature is really meant for alerts. For instance,

    [symbol is IBM]

    and [close x sma(50,close)]

    If IBM crosses its 50 MA, you would be notified.

    But you cannot do what you want to do - namely, specify data item(s) for one symbol to compare to a corresponding or different data item for another symbol to come up with a value. That's because the scan engine is designed to return symbols for which a condition is true, not values. For that, you have to get data and program it yourself.


  • Unfortunately, as far as I know, you cannot scan for any kind of RS ratio.

  • I thought that with a division math symbol you could do so.
    Can I divide between 2 MAs, like "MA 20 / MA 50"?
    If this is possible, then we might be able to divide one close over another close. Is that possible?
    E.g. ABC close / XYZ close, then we would get a ratio of the two closes.

    Just asking! My math skills are waaay back :)
  • Although you can do some fairly limited arithmetic calculations in a scan, the scan engine returns only symbols, not numbers.

    You could write a scan:

    [group is sp500]
    and [sma(20,close)/sma(50,close) > 1.05]

    That would get all symbols in the SP500 where the 20 ma is at least 5% greater than the 50 ma. But it would not return the numerical result, like 1.05321, or 1.063781, or whatever was the result for each symbol

  • I tried the same pattern but using symbols:

    [group is ETFNOUI] // ETF no hedge
    and ['XLY'/'XLK' > 1.05]
    // or with a different spelling
    // and [(symbol starts with 'XLY' / symbol starts with 'XLK') > 1.05]

    It says: The syntax is incorrect.

    Does that mean that I can't use a symbol as such, or maybe I can use the "close" of the symbol instead. Yet I don't know if it's possible to use the Close of a specific symbol. What do you think?

Sign In or Register to comment.