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.

Scans: How to get yesterday's indicator value using weekly data points

Hi All, I am a newbie and am having difficulty accessing weekly indicator values for N days ago (with 1 day ago being yesterday).

I have tried the following without much luck...

First try:

1 day ago weekly RSI(14)

Second try:
weekly RSI(14) 1 day ago

Third try:
yesterday's weekly RSI(14)

I understand that I can use "This week", "Last week" and "weekly" which will give me the indicator value using weekly data points. I just can't seem to get it to spit out a historical weekly value.

Any suggestions would be greatly appreciated.


  • The scan engine is intended to return *symbols* that meet the conditions you specify in your scan, not text or data.

    But, you can get specific values using the "rank by" statement. For instance,

    rank by [weekly RSI(14)]

    will display the value for weekly RSI in the result listing.

    For weekly RSI values x days ago, you could try a couple of things. Run the rank phrase above, but use the calendar tool to run the scan as of x days ago. Or, edit the rank phrase to

    rank by [x days ago weekly RSI(14)]

    Mixing time frames is kind of a tricky thing. I don't do it, so I am not sure whether the results are valid. You can test them by setting up a chart that includes the indicator, then setting the chart's end date to the scan date.
  • Hi Mark, thank you very much for your quick reply. I agree - scans are to return securities symbols and not data. I also agree that mixing time frames is tricky. Your suggestion to use "rank by" summarizes my issue perfectly.

    When added to the end of my scan, the engine accepts without syntax problems:
    rank by [4 days ago weekly RSI(14)]

    However if I try to use "4 days ago weekly RSI(14)" as part of a cross expression:
    [4 days ago weekly RSI(14) x 70.0]

    The engine chokes. It gives me the following error: "Mixed time periods specified: DAYS and WEEKLY".

    Any thoughts on how to get this cross to work? If "weekly" is replaced by "daily" in the cross expression it works fine... so strange!
  • Well, a couple of comments.

    The "rank by" function has its limitations. My understanding is, it was originally designed to accept simple values like an indicator, say RSI(14), and not statements that include operations. I think it now does accept some operations.

    The syntax checker will not flag grammatically correct but non-processable rank by formulations. As far as I know, if the rank by statement cannot be processed, but doesn't generate any other error, the scan engine will return results in alphabetical order.

    The second comment is, I would think the result of a crossover operator is really a true/false value, not a numerical value, so I'm surprised you get what looks like validly ranked result when the time frame modifiers agree.
Sign In or Register to comment.