Hi, Shrewd!        Login  
Shrewd'm.com 
A merry & shrewd investing community
Best Of MI | Best Of | Favourites & Replies | All Boards | Post of the Week! | How To Invest
Search MI
Shrewd'm.com Merry shrewd investors
Best Of MI | Best Of | Favourites & Replies | All Boards | Post of the Week! | How To Invest
Search MI


Investment Strategies / Mechanical Investing
Unthreaded | Threaded | Whole Thread (5) |
Post New
Author: musselmant   😊 😞
Number: of 5822 
Subject: how to create a sum of ranks in GTR
Date: 06/27/26 11:27 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 0
I am trying to create a ranking system in gtr-speak, where the sum of two ranks based is used to pick from your prior criteria of stocks.

Can someone post a sample gtr? Too hard for me to create from scratch.
Print the post


Author: RAMc   😊 😞
Number: of 5822 
Subject: Re: how to create a sum of ranks in GTR
Date: 06/27/26 4:21 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 4
Musselmant: “I am trying to create a ranking system in gtr-speak, where the sum of two ranks based is used to pick from your prior criteria of stocks.

Use the Fields.
Name each of your ranks and put the name in Field Labels with the definition of the field in the Expressions.
Your expression if complex may be built up in multiple parts
Label Expression
Criteria1 GTRese ie if(shraq1.s=null,MktCap,product(sprc(0,1),shraq1.s))
rkOne rank(criteria1,1,step3)
rkTwo rank(criteria2,1,step3)

Good example is MarginofBuffets version of O’Shaughnessy’s Trending Value Screen
https://gtr1.net/2013/?!!QlpoMTFBWSZTWQ864ZgAAeYfg...

PS Trending Value went flat shortly after his book was published in 2012 but it has slightly outperformed overall. 20130103 till 20251128 CAGR 11.4%

Print the post


Author: RAMc   😊 😞
Number: of 5822 
Subject: Re: how to create a sum of ranks in GTR
Date: 06/27/26 4:35 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 4
Didn’t finish that:
Then average the two ranks together:
FinalRank Linear(0.5,rkOne,0.5,rkTwo)
Then put the Final Rank in the Screen’s Steps: FinalRank top N or top N%
Print the post


Author: lizgdal   😊 😞
Number: of 5822 
Subject: Re: how to create a sum of ranks in GTR
Date: 06/28/26 6:54 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 5
Just FYI, if needed, you can speed up the backtests by using imports or importf. (Build a separate screen that calculates the field (using -1 lag), and paste the field-calculating URL into the new screen.) For example:
https://gtr1.net/2013/?~EYmedium:h21f0.4::styp.a:e...

Another example, the screen {PEfMo26import} is the same as {PEfMo26} but uses import. Testing this (with -nocache) shows using importf speeds up the backtest:

{PEfMo26} Clock: 973
{PEfMo26import} Clock: 299

https://gtr1.net/2013/?~PEfMo26import:h19f0.4::rPE...

https://gtr1.net/2013/?~PEfMo26:h19f0.4::Q1End:gt0...


Author: rgearyiii
Subject: How not to backtest Sum-of-Ranks
Date: 12/23/2016
"... The advice I refer to is this: Always encapsulate complex calculations inside their own backtests and import the results into other backtests using either importf (for regular field values), imports (for signal fields) or picktally. ... However, the focus of this post is on the performance advantages to what I recommend. ...

This first version uses the ill-advised method of calculating everything within one backtest, where "everything" includes the percentile ranks for RRS with twelve different lookbacks:... You can force the backtest to run without cache files by including "-nocache" as a command line-only option... Clock: 45175 ...

This next version uses the method I recommend, where each ranked field is ranked within its own backtest and the ranks are imported with importf:... Clock: 4623 ...

The reason the second version performs so much better is the way the importf function works: It causes the referenced screen to save the requested field`s values to a hidden intermediate field file, and the backtest that makes the importf call then reads that field file like any other. For a calculation as intensive as RRS, reading the calculations from a file is faster than re-calculating them from stock prices..."
https://yorickm.com/Message.php?pid=32529357

Print the post


Author: lizgdal   😊 😞
Number: of 5822 
Subject: Re: how to create a sum of ranks in GTR
Date: 06/28/26 7:03 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 4
Note that importf does not deblank any fields, even if they are deblanked in the imported screen. Use the default value in importf to deblank. For example, this importf uses a default value of -9999. Use rPE>0 to deblank in the main screen.
importf(0,rPE,-9999)

Also, I have found using rank as late as possible in the main screen has better results generally. Apply any extra criteria before the rank step if possible.
Print the post


Post New
Unthreaded | Threaded | Whole Thread (5) |


Announcements
Mechanical Investing FAQ
Contact Shrewd'm
Contact the developer of these message boards.

Best Of MI | Best Of | Favourites & Replies | All Boards | Followed Shrewds