# gtr1 pcntla behavior?

I’m seeing some behavior in the daily count of the number of stocks selected by a gtr1 screen that I don’t understand. The below screen is my attempt at counting the number of stocks with a market cap of between 30-40 percentile. Running that with the “Count Stocks” button and then clicking “Download report”, and then viewing the csv file produces the below counts. Why should there be zero stocks between the 30-40 percentile on 20210201?

All the best and thanks for the help!

abs( linear(1, pcntla(mcp, 1, step0), -35, 1) ) < 5

https://gtr1.net/2013/?s20030103lf-1lp-1h5::abs%28linear%281…

Variant,Date,Active,step0
0,20190201,7488,137
0,20190301,7472,141
0,20190401,7469,122
0,20190501,7489,122
0,20190701,7555,120
0,20190801,7574,98
0,20191001,7583,99
0,20191101,7589,81
0,20191115,7601,89
0,20200211,7601,54
0,20200213,7601,51
0,20200401,7554,63
0,20200501,7561,62
0,20200601,7553,87
0,20200701,7601,73
0,20200901,7650,69
0,20201001,7719,35
0,20201201,7857,6
0,20210201,8043,0 # ← 0 stocks with a percentile between 30-40?
0,20210301,8152,0
0,20210312,8201,0
0,20210401,8313,0
0,20210601,8568,0
0,20210701,8694,5
0,20210729,8801,0
0,20210901,8866,156
0,20211001,8995,111
0,20211004,9001,108
0,20211101,9065,123
0,20211201,9170,109
0,20220201,9374,5
0,20220301,9435,5
0,20220401,9480,111
0,20220601,9523,285
0,20220701,9541,280
0,20220801,9544,280
0,20220901,9555,268

p.s. pretty sure that there must be a simpler way to filter for the stocks in the 30-40 percentiles. Lmk if you have something simpler, thanks.

Using product(sprc,csoq1d.s) results in some odd counts for the dates from 20201130 to 20210611.
Using product(aprc,if(styp.a=30!31,sho.a,cso.a)) works as expected, with about 821 stocks passing each variant step1.

Create [mcp]: [[daily SI-adjusted Price; share_lag=1 days; quote_lag=1 days][SI (d) Common Shares Outstanding; lag=1 days]]
Create [pMC]: [% Rank (tie-averaged) by [mcp] (Asc) at step0]
step0: [pMC] >= param0
step1: [pMC] < param1
step2: [|[1
[pMC] - 35]|] < 5

Stocks passing from 20201130 to 20210611:

`````` FROM     TO
param0  param1  Active  step0  step1  step2
-99     10     8207   8207     4      0
10      20     8207   8204    121     0
20      30     8207   8082   3224     0
30      40     8207   4859     0      0
40      50     8207   4858    755     0
50      60     8207   4103    821     0
60      70     8207   3282    821     0
70      80     8207   2462    821     0
80      90     8207   1641    821     0
90      999    8207    820    820     0
``````

using product(sprc,csoq1d.s)
https://gtr1.net/2013/?s20201130e20210611::pMC:alp0:pMC:ltp1…

using product(aprc,if(styp.a=30!31,sho.a,cso.a))
https://gtr1.net/2013/?s20201130e20210611::pMC:alp0:pMC:ltp1…

2 Likes

The [mcp] field needs to be deblanked. Adding [mcp] > 0 fixes the code. Always deblank all fields.

``````param0  param1  Active  step0  step1  step2  step3
-99     10     8207   4859   4859    486     0
10      20     8207   4859   4372    486     0
20      30     8207   4859   3887    486     0
30      40     8207   4859   3401    486    486
40      50     8207   4859   2915    486     0
50      60     8207   4859   2429    486     0
60      70     8207   4859   1943    486     0
70      80     8207   4859   1457    486     0
80      90     8207   4859    971    486     0
90      999    8207   4859    485    485     0
``````

Create [mcp]: [[daily SI-adjusted Price; share_lag=1 days; quote_lag=1 days][SI (d) Common Shares Outstanding; lag=1 days]]
Create [pMC]: [% Rank (tie-averaged) by [mcp] (Asc) at step1]
step0: [mcp] > 0
step1: [pMC] >= param0
step2: [pMC] < param1
step3: [|[1
[pMC] - 35]|] < 5

https://gtr1.net/2013/?s20201130e20210611::mcp:gt0:pMC:alp0:…

1 Like

Deblanking is a keyword carried over from Radiscript. GTR1 fills missing values (blanks) with Default Values. For example, csoq1d.s [SI (d) Common Shares Outstanding] Default Value is -999999.

sprc is nominally zero for investments not covered by SI.

gtr1_glossary:
“As shown, this version of sprc takes no arguments. For each investment on market date d, sprc retrieves its effective value in gtos.s and multiplies this by its current g-price, assigning the result to the calling field. Investments not covered by Market Guide or SI on the current trading date are assigned field values of zero, since the default value for gtos.s is zero. Field values produced by this version of sprc are commensurable with any field file with extension .s and zero lag.”

1 Like