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.

Rank by column doesn't come up

When I run this scan (with or without the brackets) it seems as if the rank by request is ignored.

[type is stock] and [country = us]
and [market cap > 12000] // ---- Todays 925 highest capitalized stocks
and [108 month ago monthly close > 124 month ago monthly close] // ---- Appreciated from top to bottom of 2007-2009 decline
rank by [108 month ago monthly close/124 month ago monthly close]

Comments

  • Unfortunately, the "rank by" statement is intended to be used only with individual indicators (e.g. MACD or ROC, etc.) or simple values (e.g. close or market cap, etc.) I learned this from Support when I wrote a similar complex statement that appeared to work until I looked at the results more closely.

    The documentation doesn't say so explicitly, but "rank by" will not correctly evaluate anything with an operator like +, -, *, / etc. (except maybe by chance). But, the syntax checker does not flag complex expressions as errors with rank by statements if they are syntactically correct.

    http://stockcharts.com/docs/doku.php?id=scans:advanced_scan_syntax


  • edited March 21
    Wow! I've been using it for years and using the sorts to prioritize my investigation of individual stocks. I'm guessing you're overstating the results a little. It seems that this rank by
    ' rank by [ [ [0 day ago close/2 day ago close]*100] -100 ]
    was successful in turning the division into a percentage.
    I never investigated the accuracy of the division though.

    Interesting.. I just changed my rank by to
    rank by [ [[108 month ago monthly close/124 month ago monthly close]*100] -100 ]
    and it worked. I may try some easier data to track to check the arithmetic - but need to go now.

    Thanks
  • This is a check by Spreadsheet on one calculation involving division, multiplication, and subtraction. I still don't understand why the original formula wouldn't work


  • markdmarkd mod
    edited March 22
    Looking back, it seems I have overstated it somewhat. Here's a quote from Support re rank by (dated Nov 2016)

    "It was designed to accept a single scan expression, and has been updated to accept expressions with simple—very simple—mathematical operations... it isn't designed to handle sophisticated operations like the one you created.

    It will try, but our developers tell me the results can be hit or miss. ... At this point, the feature is not supposed to perform elaborate sequences (although that is clearly where we are headed with it). It's unclear if it can perform the operations as written in its current state (I think "as written" refers to my rank by that didn't work). So, it's best to limit Rank By to basic expressions and math for now."

    So, it will in fact do "simple" operations. But I'm not sure how far you can stretch "simple".
  • edited March 22
    Thanks again. I'll be sure to check if/when I get more complex.
    It might be helpful (and I realize it may be asking too much) if you shared your rank by expression, so I (and whoever else is following this) could see something that didn't work.
    And I just can't help but wonder why it would accept
    ' [ [[108 month ago monthly close/124 month ago monthly close]*100] -100 ] '
    but not
    ' [108 month ago monthly close/124 month ago monthly close] '
    `
    I'm not sure what would happen to this forum if you quit being so active. But thanks one more time.
  • markdmarkd mod
    edited March 22
    Thanks for the kind words.

    Here's one version that didn't work:

    rank by [Fast Stoch %K(251,1) * 4] + [Fast Stoch %K(63,1) * 3] + [Fast Stoch %K(21,1) * 2] + Fast Stoch %K(10,1)

    This was an attempt to order a list by weighting symbols by their position in each price channel (of the length corresponding to the Fast K parameter). It was an experiment. I expected it would put better performing stocks over longer time frames on top. At the time my thought was that SCTR seemed to over-weight current performance so I wanted to see if there was another way to go about it. The result was symbols in alpha order. I haven't re-tested it.

    Re your wondering, I guess that's what they mean about "hit and miss". Maybe try some superfluous brackets and multiply by 1?
  • edited March 24
    I think SCTR will be high if the stock appreciated a lot in recent weeks or even days, regardless of earlier performance.
    Here's something I did to accomplish something similar. This doesn't rank, but I scan within the chartlist using other parameters. As simple as this is, I'm a little uncomfortable sharing it publicly.
    `
    `
    ##__ 0080a _______ LTP__ Find the Long Term Growth Stocks ____________________________

    *******
    Edit, Gord
    Scan text removed at the request of the user.
    *******
  • I like it. I tried it back-dated to 12/31/13 and on casual inspection I would say a very good percentage continued to climb, probably above the general market rate. Nice.
  • edited March 23
    Is there a way to delete this scan from the forum? Could you do it for me?
  • I guess that's a no
  • Please check your s.c.a.n. Inbox. Click on your s.c.a.n. name at the top right of the screen.
Sign In or Register to comment.