Reader Feedback
TSP  Trends
Subject: Trading System Project
Tue, 14 Feb 2006 16:17:23 +0000
Hi,
Attached are my results from the trading system project  Trends.
Thanks,
Plain Text Attachment [ Download File  Save to Yahoo! Briefcase ]
BRLC 10/21/2005 0.65 1186.439
BCRX 10/21/2005 0.293 535.183
RNWK 10/21/2005 0.263 480.613
IKAN 10/21/2005 0.259 472.315
BTUI 10/21/2005 0.25 456.466
ANSI 10/21/2005 0.211 385.759
CPTV 10/21/2005 0.21 383.348
PRLS 10/21/2005 0.208 380.568
VDSI 10/21/2005 0.205 374.042
LEXR 10/21/2005 0.203 371.639
MESA 10/21/2005 0.198 361.898
ICUI 10/21/2005 0.191 349.654
SNDK 10/21/2005 0.191 348.226
CAMP 10/21/2005 0.19 346.156
//Computes Strength and Weakness of stocks over a 20day period.
//Coded in Amibroker
Lag= Ref(Close,20);
for (i=19; i>0;, i)
{
Lag = Lag + (Ref(Close,i)  Lag)/20;
pctROC = (CloseLag)/Lag;
}
//365.25 / 20 * (PAV20)/AV20
YROC = (CloseLag)/Lag*100/20 * 365.25;
Y = Volume> 50000;
Filter = Y AND Close > 5.00;
AddColumn(pctROC, "(PAV)/AV", 1.3 );
AddColumn(YROC, "Yearly % ROC Filter", 1.3 ); 

Tue, 15 Nov 2005
10:48:59 +0100 (MET)
Dear Ed,
my results for the "Trend" exercise are close to yours:
Symbol (PAV)/AV Yearly % ROC
BRLC 0.659 1204
BCRX 0.358 654
BLSC 0.317 579
BTUI 0.299 547
RNWK 0.283 517
RWC 0.260 475
SNDK 0.250 457
TWTR 0.236 432
BFT 0.228 416
PRLS 0.225 410
SUPX 0.220 402
KNOT 0.215 392
BWNG 0.213 390
BRN 0.213 389
LEXR 0.211 386
ANSI 0.207 378
BABY 0.206 376
I used CSI data and my own backtesting environment, which I wrote
using C#.
I added an additional filter condition: Close * Volume > 4000 USD.
I notice that my results include RWC. You already mentioned that
your
results don't include RWC because your data source does not provide
enough
data rows for RWC.
I notice that my values for "(PAV)/AV" and "Yearly % ROC" sometimes
differ
slightly. I think the differences are so small that they might exist
because
I used different rounding algorithms or data types or because my
price data
differs from the price data you used.
I am thinking about one detail: You multiply by 365.25 to calculate
the
yearly ROC. We have only about 253 rows of data for a year because
there is
no data for weekends and some other days. So I am considering
multiplying by
the count of a year's data rows instead of 365.25 to compute the
yearly rateof change. This would not have any influence on the ranking but it
might be
more consistent with the "yearly" in the name "Yearly % ROC".
A small note: You write "list the top 15" but you list the top 16 as
answer.
(I am considering taking the feelings around embarrassment, which I
notice
inside me while writing you this unimportant small note, in today's
tribe
meeting.)
Thank you for your exercises!
Greetings, 
Thank you for the catch. 
Subject: Moment of now for calculations
Date: Fri, 11 Nov 2005 16:21:34 0600
Ed,
I put together an Excel spreadsheet to duplicate your math for
ranking
the stocks listed at:
http://www.seykota.com/tribe/TSP/Trends/Exercise_1/index.htm
I take the case of the top ranked stock, BRLC. In order to match
your
result of .659 for (P  AV) / AV and YPROC of 1203%, I must assume
that
I do not have access to the close on 10/21 for the purpose of
calculating the Lag, but I do have access to that close for the
purpose
of calculating (P  AV) / AV. That is, the P in this calculation is
the
close of 10/21, and the Lag is calculated using the close of 10/20.
This is like working from two separate moments of now, which is a
bit
confusing. If we calculate the Lag based on the close of 10/20 we
might
also consider calculating the other metrics as of that same close.
If we
decide that the moment of now when we begin to tally up the day's
metrics is after the close, then we could use a Lag incorporating
"today's" close.
In either case, I propose sticking with one moment of now to begin
calculating all the metrics using whatever data is available at that
time. You could either place your moment of now before the data for
10/21 is available or posit that now is after the close. If you
choose
the former, you might consider calculating everything using the bar
immediately prior to the current bar as the latest available
information. If you choose the latter, you might want to calculate
the
Lag using "today's" close in addition to calculating the other stats
as
of "today's" close. 
Use
the data you have available at the now of calculation. 
updated trend results
Date: Wed, 2 Nov 2005 13:31:42 0500
Hi Ed,
In my last email I mentioned that I, along with another person, had
been getting the value of 0.033 for my daily
pct ROC for BRLC whereas you show a value of 0.659. I think we're
closer than it seems as 0.033 * 20 (the period length)
equals 0.66, essentially your result.
Regards, 
OK 
Mon, 31
Oct 2005
Subject: TSP  Trend
Ed,
I have a match for the 16 stocks you list as the top 15. Our numbers
don't match exactly, which I believe is due to rounding. Funny, to
see KNOT on the list.
tsp_1  might be too big (EAS Nov 5)

OK 
Subject: TSPTrends
Date: Sun, 30 Oct 2005 11:45:13 +0100
Dear Ed,
Thanks for your impressive work and initiative in the TT and TSP.
This is the formula I use in Metastock for the TSPTrends tutorial:
{EDROC20}(CRef(Mov(C,39,E),1))/20/Ref(Mov(C,39,E),1)*36525;
{(todays close – yesterdays EMA (2*201) of the close)/20/(yesterdays EMA
(2*201) of the close)*36525}
Taking the prices from yahoo I get this Yearly % ROC;
BRLC (Oct 21): 1204.27
BCRX (Oct 21): 653.98
Something is wrong here. But I can’t find what. 

Thu, 27 Oct 2005
My code for doing the pct ROC calculation is shown,
line by line (copy and pasted) below. Still the result
I get for pctROC is 0.0330, not the value of 0.659
that you an others have gotten. Though 0.0330 is what
one other person got.
rocLen = 20
lag = getClose(0)
pctROC = 0.0
endIdx = getNumDays()  1
for i = roclen to endIdx
diff = getClose(i)  lag
roc = diff / rocLen
pctROC = roc / lag
lag = lag + roc
next
Would you please show your code for the calculation.
I've got to be missing something simple here.
Thanks,
Robert 
.033 * 20 ~ .659 
Wed, 26
Oct 2005
Rates of Change
Ed,
I am trying to match your result for BRLC to get a feel for this
project. My data for BRLC starts on 20030916. My results don't match
yours. Here is my procedure:
1. I calculate the 20 day lag as follows: Yesterday's lag + (today's
closeyesterday's lag)/ 20 (do you use 20 or 10.5, derived from
20+1/2)
2. Next I calculate the difference between Today's close and today's
lag
3. Then I calculate the ROC per day, by dividing today's difference/
20
4. Then I calculate the ROC per day in percentage terms, by dividing
today's ROC/ today's lag
5. Lastly I multiply the %ROC per day by 365.25 to get a %ROC per
year (I know this is non compounding)
I am wondering where my mistake is.
see my spreadsheet: brlc.xls

You might try
putting step 1 last.
Update the lag
after you use it to compute ROC.
From the numbers
on your spreadsheet:
(P  AV)/AV = (6.2
 3.736) / 3.736 using the lag before updating it
= .6595
= 65.95 percent by which price exceeds lag
/ 20
= 3.2976 estimate of daily percent change basis 20 days
* 365.25
= 1204.46 estimate of yearly percent change basis 365.25 days 
Wed, 26
Oct 2005
Questions re PCT ROC calculation
Hi Ed,
The following is pseudocode that represents my calculation of the
percent ROC (pctROC) per the assignment. This code
seems to match your example.

C: array of closes, indexed starting at 0
lag = C[0]
roclen = 20
for i=roclen to C.size1
diff = C[i]  lag
amount by which price leads the lag
roc = diff / roclen
daily increment
pctROC = roc / diff
try this instead: pctROC = roc / lag
lag = lag + diff / roclen
or, lag = lag + roc
next i
return pctROC

:
For stock BRLC my pctROC value is 0.0330 which matches one
contributors value whereas your pctROC value for the same stock is
0.659.
Questions:
1. As my results don't match yours and I believe I've coded your
example correctly, will you please elaborate on how you calculate
pctROC.
2. You state the formula for daily pctROC as (PAV)/AV. Will you
please define the variables and show how you got the value 0.659.
Thanks,
Robert 
For your pctROC = roc / diff,
consider using pctROC = roc / lag.
For more on this, see the item avove. 
Mon, 24
Oct 2005
Using Cash Flow Screen +
Some Services Do Not BackPost New Listings +
Computing ROC from Lags
Ed,
It seems I send my last results before the exercise settles into
steady state.
Thank you for suggesting that I might do a cash flow screen.
I use a 20day lag of cash flow and require that to be at least
$250,000/day. I get the list you post to the site with one
exception. I show RWC as a strong stock. Its chart confirms its
strength. I note that some online charting sites give differing
amounts of history for RWC. It seems that some databases do not
include price history prior to October 14 when RWC lists on the
AMEX. Other databases (e.g. CSI) have price data before RWC lists on
the AMEX.
I also notice one small difference in the (PAV)/AV values. The
match is better than I expect given the number of possible sources
of errors.
I wonder how you calculate the Yearly %ROC values. My first approach
is to calculate the daily rate of change and then compound that by
the number of trading days in a year. This doesn't match your
metrics at all. I choose to use ((PAV)/AV)/20)*365.25*100 which
matches your results closely and (as you can see below) not exactly.
Another difference that you can't see here is that my charts show
volume that seems to be about half the volume on your charts.
The online charting services that I check seem to match my volume
data. Does your data provider double count volume?
Symbol 
(PAV)/AV 
%ROC 
BRLC 
0.659 
1204+ 
BCRX 
0.358 
654+ 
BLSC 
0.317 
579 
BTUI 
0.299 
547 
RNWK 
0.283 
517+ 
RWC 
0.260 
475 
SNDK 
0.250 
457+ 
TWTR 
0.236 
432+ 
BFT 
0.228 
416 
PRLS 
0.225 
410 
SUPX 
0.220 
402 
KNOT 
0.215 
392 
BWNG 
0.213 
390+ 
BRN 
0.213 
390+ 
LEXR 
0.211 
386+ 
ANSI 
0.207 
378 
BABY 
0.206 
376 

Yes, I notice RWC has only a few days of data on Worden and on Track
Data. I screen on having a year's worth of data, so I do not
capture RWC from these sources.
I calculate yearly percentage ROC just as you
surmise:
YPROC = 365.25 / 20 * (PAV_{20})/AV_{20}
Since alternative methods are all monotonic
relative to this one, and since the only use of YPROC is to generate
a flat list, and since YPROC is a gross approximation / prediction,
I use a simple method.
Good catch on the volume. The error is in my
code; the source is moving the volume number halfway down the
scale, to make room for the prices above, and forgetting to cut the
value in half. It now sands correctly. 
Sun, 23 Oct 2005
Getting the Same List Plus Some
Thin Stocks
Trying to Filter Out Stocks
with CSI
Ed,
This is an interesting project. I am learning more about my
database(CSI).
There doesn't appear to be a way to exclude securities that trade on
OTC
bulletin board or on the pink sheets.
The price data often do not accurately reflect restructurings... Viz
the sharp drops in VCO and SPCHB.
Here's a list of strong and weak instruments without filtering for
liquidity, etc.
"Strong" stocks
Symbol 
Close

Lag 
NROC 
Name 
URSI 
11.00 
5.65 
0.0473 
United Road 
BRLC 
6.20 
3.74 
0.0330 
BRILLIAN 
BTAHY 
5.30 
3.41 
0.0276 
Biota 
SVCF 
28.00 
18.94 
0.0239 
SERVICE 1ST 
UITH 
9.00 
6.27 
0.0217 
Uintah 
UFSM 
13.00 
9.22 
0.0205 
Ultimate 
BCRX 
15.33 
11.29 
0.0179 
Biocryst 
BLSC 
8.55 
6.49 
0.0159 
BioLogic 
GRRB 
14.00 
10.73 
0.0153 
GRANDSOUTH 
BTUI 
12.12 
9.33 
0.0150 
BTU 
CYFC 
19.50 
15.04 
0.0148 
COMMUNITY 
YAVL 
86.00 
66.46 
0.0147 
Yadkin 
RNWK 
7.97 
6.21 
0.0142 
Real Networks 
UABK 
18.00 
14.13 
0.0137 
UNITED 
KNTF 
5.40 
4.26 
0.0133 
Knight 
RWC 
5.42 
4.30 
0.0130 
Relm 
SNDK 
56.45 
45.16 
0.0125 
Sandisk 
SOBI 
9.15 
7.33 
0.0124 
Sobieski 
IKAN 
14.96 
12.08 
0.0119 
IKANOS 
TWTR 
5.15 
4.17 
0.0118 
Tweeter 
"Weak" stocks
Symbol 
Close 
Lag 
NROC 
Name 
TGTL 
9.00 
13.17 
0.0158 
Tiger 
TMG 
5.42 
7.94 
0.0159 
Transmontaigne 
XXIA 
10.25 
15.20 
0.0163 
IXIA 
AGP 
17.21 
25.56 
0.0163 
AMERIGROUP 
WPTE 
6.50 
9.69 
0.0165 
WPT 
DCAI 
9.28 
13.84 
0.0165 
Dialysis 
PLB 
6.60 
10.02 
0.0171 
American 
PKTR 
7.46 
11.85 
0.0185 
Packeteer 
MOVI 
7.49 
12.18 
0.0193 
Movie 
ANTP 
8.81 
14.50 
0.0196 
Phazar 
RSTG 
8.45 
14.10 
0.0200 
RASER 
BKF 
16.79 
28.40 
0.0204 
BKF 
CYPB 
5.04 
8.53 
0.0205 
Cypress 
DPH+A 
5.25 
9.00 
0.0208 
DELPHI 
VCO 
30.40 
58.05 
0.0238 
Vina 
ENWV 
10.60 
20.75 
0.0245 
ENDWAVE 
PGTVN 
13.13 
26.78 
0.0255 
PEGASUS 
SPCHB 
13.15 
36.54 
0.0320 
Sport 
NOMX 
5.00 
860.70 
0.0497 
NorMexSteel 

Yes, you seem to get all the stocks I get, in the same order.
I have the matches, above, in boldface. You are also getting some
other stocks that seem pretty thin (trade by appointment only): URSI,
BTAHY, SVCF, etc. Maybe you can do a cash flow screen: CF =
volume * price.
Also, I am getting different metrics for lag
and NROC, although our series appear monotonic to each other. 
Sun, 23
Oct 2005
TSP: ranked list of Top and Bottom 10 stocks
Hi Ed,
Here's my results for Top and Bottom 10 stocks ranked according to a
20 day ROC. The symbol and ROC are listed.
 Strongest
BRKA 
100.0 
RCCCP 
6.5 
SWBC 
5.85 
SEB 
5.527 
ALMOP 
1.844 
BRKB 
1.8 
YAVL 
1.472 
SBZ 
1.2365 
GOOG 
1.2270 
CME 
1.07 
 Weakest
XMSRZ 
12.171 
NVR 
7.2625 
FO+A 
4.05 
GBTVO 
3 
VCO 
2.7295 
TPL 
2.2125 
SPCHB 
2.093 
WTM 
2.0 
WPO 
1.9050 
CYAL 
1.7905 

You
might consider pulling up the charts on some of your strongest stocks.
I show no matches between your list and mine. 
