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.

Ratios in Scans?

Are we allowed to place ratios inside of scans?

Specifically, can I replace this:
and [ema(65, close) > 30 days ago ema(65, close)]

with something like this:
and [ema(65, (close:VTI)) > 30 days ago ema(65, (close:VTI)]

So far, I'm getting errors. Am I doing something wrong or is this just not allowed?


  • The documentation (follow the "Instructions" link at the bottom of the advanced scan page) doesn't seem to include a ":" (ratio) operator, although there seems to be alot of demand for it. I think I remember reading that it hasn't been developed because it is a very calculation intensive operation.

    You might try scanning for ROC(65) values against the hard coded values for VTI's ROC(65) today and 30 days ago. It wouldn't give you the smoothing of the ema though.

    @Gord or @ekwong might have better ideas of how you might accomplish what you are looking for.
  • Thanks for the tips!
  • You can use this as your scan code. For simplicity, only stocks in DJI is scanned (as of Nov 14, 2015).

    [type = stock] AND
    [[group is 'DOW30'] OR [symbol is "VTI"]]

    rank by [ROC(30,ema(65,daily close))]

    You will see this as scan result:

    You can use this to verify:
  • Interesting. Hadn't thought of doing it that way.

    Specifically, I'm interested replicating this in my scan and then being sure a stock's EMA(65) for each of these four is ascending in recent days or weeks. Is this at all possible?!?!?
  • markdmarkd mod
    edited November 2015
    Pretty sure the answer is no. The scan engine doesn't like the ":" operator, it doesn't like the terms "$SECTOR" or "$SYMBOL" or "$INDUSTRY", and it doesn't let you specify a symbol like "VTI" within a scan function (like sma(65, "VTI") or sma(65, VTI close) or whatever.

    If you want to find stocks that suit your conditions, I think you have to follow @ekwong 's model, except you need a list to test each condition.

    So you might begin with a list of sector SPDRS (XLE, XLB, etc). that also included VTI, and then run ek's scan against it.

    For the sectors that come up above VTI, you would run the same scan condition against a list of industries for that sector than includes the sector SPDR, etc., then for stocks in the industries above the sector SPDR in an industry list that includes the industry $DJUS index.

    Complex process - and a lot of list making - but it's a complex query. Maybe some one else has a more direct approach.
  • That's quite helpful. Thanks for the detailed answer!
Sign In or Register to comment.