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


Halls of Shrewd'm / US Policy
Unthreaded | Threaded | Whole Thread (12) |
Post New
Author: hiphop   😊 😞
Number: of 4356 
Subject: Testing momentum screen using GTR1
Date: 08/29/2025 2:19 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 0
Hi All,

A friend of mine does some serious momentum investing, and wanted to see if GTR1 would be able to backtest it. I was hoping to use this as an excuse to go through GTR1 and figure out how to test such a thing...but I would appreciate any pointers or help with this, as I am a GTR1 neophyte.

Screen universe: META, AAPL, AMZN, MSFT, NFLX, NVDA, GOOGL, TSLA (this is a step I would love to replace by something like Nas100 top 7 by market cap or some such thing)

Timing signal: Russel 1000/(170 day average of Russel 1000)-1 (ETF for Russel 1000 is IWB)
if negative stay in CASH/BIL for month
else:
for each stock in universe, discard any whose price is lower than 5 months ago: Price(today)/Price(5Mon ago)-1
Rank remaining stocks by 50day EMA
Buy top 4, hold for month

Can anyone help me with this?

Thanks, G
Print the post


Author: lizgdal 🐝  😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/29/2025 3:29 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 4
I don't think gtr1 handles universes based on tickers. For example, this is a gtr1 error message:

"Historical data for ticker symbol 'MSFT' could not be downloaded from Yahoo! Finance."

Probably for the best, as using the Mag 7 tickers has a crystal ball effect. Nas100 top 7 by market cap is easy to do. Even this has data snooping bias, as we know it has performed well recently.

To add the timing, build a separate screen and import the signal, similar to BCC in:

https://gtr1.net/2013/?!!QlpoMTFBWSZTWZHgP0MAAtRfg...


The gtr1 glossary and GTR1 for Dummies are useful references, if you can find them.
Print the post


Author: lizgdal 🐝  😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/29/2025 7:21 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 7
An example of a screen used to generate a timing signal is:

https://gtr1.net/2013/?lf-1lp-1h1::SMADiff:gt0:SMA...

Russell 1000 returns are very close to the S&P 500, and so I would use the gtr1 index S5T. Maybe something like:

https://gtr1.net/2013/?lf-1lp-1h1::SMAsignal:gt0:S...

A signal based on the Russell 1000 could be done. Something like:

https://gtr1.net/2013/?!!QlpoMTFBWSZTWVmNyeUAAfnfg...
Print the post


Author: lizgdal 🐝  😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/30/2025 4:13 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 4
The steps to learn GTR1 might be:

A. Make your first GTR1 screen.
B. Use a calculated field.
C. Use an imported field.
D. Refine.

I will post detailed answers below. Starting with an existing working screen might be a shortcut. There is useful information at: http://mechinvesting.wikidot.com/backtesters

https://gtr1.net/2013/?~SP500MktCapWeight_BCC0:h63...
Print the post


Author: lizgdal 🐝  😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/30/2025 4:14 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 5
To create your first screen, a list of fields is needed.
A1. Go to https://gtr1.net/2013/
A2. Fill in the "Command line-only options" box with: list:*.*
A3. Run Screener
A4. Download Report

This lists most fields, but a few thousand are missing. For example: nas100.a

A5. Go to https://gtr1.net/2013/
A6. Fill in Steps: 0: with nas100.a = 1
A7. Run Backtest
A8. Congratulations, you've completed your first GTR1 screen backtest.
A9. Name and save your screen: Nas
https://gtr1.net/2013/?~Nas::nas100.a:et1
Print the post


Author: lizgdal 🐝  😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/30/2025 4:16 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 7
Now you want to filter based on Market Cap. Market Cap is a calculated field, and so a formula is needed. Formulas should only use fields and prices from the same data source (for example .a and aprc). The Market Cap formulas are:

MktCapS: product(sprc,shraq1.s)

MktCapC: product(cprc,cshoq1d.c)

MktCapA: linear(0.000001,product(aprc,if(styp.a=30!31,sho.a,cso.a)))

B1. Go to the {Nas} screen. https://gtr1.net/2013/?~Nas::nas100.a:et1
B2. Click the Free-Form button.
B3. Copy and Paste the 3 Market Cap formula into the Field Labels box.
B4. Paste the following formula into the Steps box on a new line.
min(MktCapS,MktCapC,MktCapA) top 20
B5. Run Backtest
https://gtr1.net/2013/?~NasBig20::nas100.a:et1:min...
B6. Congratulations, you've used a calculated field.
B7. Name and save your screen: NasBig20
https://gtr1.net/2013/?~NasBig20::nas100.a:et1:min...

A spreadsheet listing calculated fields is useful. Just copy and paste when needed. For example: https://yorickm.com/Message.php?pid=35092774
Print the post


Author: lizgdal 🐝  😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/30/2025 4:18 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 7
Next, add a timing signal. Reference an existing screen if needed:
https://gtr1.net/2013/?!!QlpoMTFBWSZTWZHgP0MAAtRfg...

C1. Create a timing signal screen. Copy the signal URL. https://gtr1.net/2013/?lf-1lp-1h1::SMAsignal:gt0:S...
C2. Open the {NasBig20} screen. https://gtr1.net/2013/?~NasBig20::nas100.a:et1:min...
C3. Paste the signal URL into the Screen Reference box.
C4. Click Free-Form.
C5. Add a line in the Fields Labels box to import the signal.
TimingSignal: imports(0,SMAsignal,0,-99)
C6. Close all positions when TimingSignal < 0
C7. Run Backtest
C8. Congratulations, you've used an imported field.
C9. Name and save your screen: NasBig20timed
https://gtr1.net/2013/?~NasBig20timed::nas100.a:et...

Print the post


Author: Baltassar   😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/30/2025 4:52 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 0
An example of a screen used to generate a timing signal is:

How do you use this kind of SMA timing for a stock or index other than the one being traded. I have tried to work out the correct syntax by extracting the "SMADiff" component of BCC, but some detail eludes me.

I apologize for so egregiously attempting to pick your brain.

Baltassar
Print the post


Author: lizgdal 🐝  😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/30/2025 4:53 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 6
The screen {NasBig20timed} needs some refinements.

E. Choose one Market Cap formula to use.
F. Review the timing method. Is a daily or monthly signal used?
G. Add a screening step: Price(today) > Price(5Mon ago)
H. Calculate and sort by 50-day EMA. (gtr1 doesn't calculate EMA, so consider alternatives)
I. Consider other refinements.
Print the post


Author: Baltassar   😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/30/2025 4:56 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 0
I now also apologize for having failed to read on in the thread before asking my question, which you have in fact answered.

Much appreciated.

Baltassar
Print the post


Author: lizgdal 🐝  😊 😞
Number: of 4356 
Subject: Re: Testing momentum screen using GTR1
Date: 08/30/2025 5:35 PM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 4
The terminology can get confusing. fields have different values for each ticker. signals only have one value on each market date, and that value is applied to all stocks.

The reference screens' effect on the screen is limited to the imported values. The steps in the reference screen are NOT applied to the screen. For example, {NasBig20timed} uses TimingSignal < 0, while the reference screen has TimingSignal > 0.

https://gtr1.net/2013/?~NasBig20timed::nas100.a:et...


=== link ===
importf and imports
"The functions operate as follows: importf causes a new and separate backtest of the screen referenced by screen_number (i.e., the source screen) to be run in which the values of the field referenced by field_number or field_label are exported to a new temporary field file with default value equal to the value specified with default_value. ...

imports functions similarly, except that only one value is exported on each market date to the temporary field file, and that value is applied to all stocks in the course of the import."
https://yorickm.com/Message.php?pid=30354312
Print the post


Author: bacon   😊 😞
Number: of 55803 
Subject: Re: Testing momentum screen using GTR1
Date: 08/31/2025 9:17 AM
Post Reply | Report Post | Recommend It!
No. of Recommendations: 5
lizgdal, A most excellent tutorial.

Thank you.

Eric Hines
Print the post


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


Announcements
US Policy FAQ
Contact Shrewd'm
Contact the developer of these message boards.

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