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.

Does RANK BY only work with some indications?

Does RANK BY only work with some indications?

It seems to work properly with Percent, MACD Hist, and SCTR, but doesn't seem to work with PPO or PMO.

Is there a list of indications that can be used with the RANK BY instruction.

Best Answers

  • lmkwinlmkwin ✭✭
    Answer ✓
    I didn't know about the ASCENDING feature. It will come in handy for me.

    "Rank By Clauses
    You can optionally add a line to the very end of your scan that controls the order in which your scan results are displayed. That line must start with “RANK BY,” followed by the expression that you want your results sorted by. For example:

    RANK BY [close]
    This example would sort the scan results in descending order of current closing price.

    There are a few rules for Rank By clauses:

    There can only be one Rank By line per scan.
    The clause must be the last line of the scan.
    You can add “ascending” to the end of the clause to reverse the order of the scan results (e.g. “RANK BY [MACD Hist(12,26,9)] ASCENDING”).
    Note: The value of the Rank By expression is also added to the right side of the scan results table. This allows you to examine the value of any expression in your scan directly by making that expression the Rank By expression as well."
  • BigMBigM
    Answer ✓
    These scans seem to work properly:
    RANK BY [PctChange(1,close)] DESCENDING
    RANK BY [MACD HIST(12,26,9)] ascending
    RANK BY [SCTR] descending

    These scans do not seem to return the results ranked by these indications:
    RANK BY [PMO(35,20,10)] DESCENDING

    Everything else in the scan remains the same, these are the only changes that I make to the code.
  • lmkwinlmkwin ✭✭
    edited November 2020 Answer ✓
    You can probably eliminate the "Descending". All Rank By is in Descending order.

    When you run these, the Rank By information is added as it's own column in the results table.

    The PPO and PMO have extra information required.

    If you hit the Dropdown in the Technical Attributes, you'll find that there is no PPO or PMO. There is a PPO Line, PPO Signal, PPO Hist. There is a PMO Line, and a PMO Signal.

  • BigMBigM
    Answer ✓
    I didn’t think about the Line or Signal portion of the indication. I usually don’t let something like that slip by. I include Descending because occasionally I'll do an Ascending sort and I want to differentiate the two. Thanks for your help.
  • lmkwinlmkwin ✭✭
    Answer ✓
    "I usually don’t let something like that slip by."

    That's where this forum comes in VERY handy. I can tell you it happens to me all the time. My usual nemesis is the dreaded parenthesis.

    We're all in this together, glad to help.


  • Can you post your Rank By code that works, and post what doesn't? Sometimes something that doesn't work is a syntax issue.

    Bad thing about the Rank By is that is often won't throw an error message in the Check Syntax function.

Sign In or Register to comment.