Whenever a backtest is run, the output includes a short link to the
backtest, build from a 6-character alphanumeric code. These codes are
arbitrary, and have no meaning other than pointing back to a particular
screen. There is also a longer code for a backtest, which looks like
The part at the end ("
everything you need to know to reproduce the test run.
Common to all testers:
All codes are of the form:
:] [fftt] [mm] [options] TT [tester-dependent].
The TT is the two-letter uppercase code for the specific tester, which is listed with each tester description on the right. A name may be included before the code, followed by a colon. The name may consist of letters, numbers, underscore, dot, and dash. It can actually contain other characters as well, but they will be tilde-encoded (like the percent-encoding used in URLs, except with a tilde). The numbers at the beginning of the code, the fftt [mm], are interpreted as follows:
|fftt||Starting and ending ("from", "to") years of the backtest, two digits each (yes, that leads to Y2K-type problems - So sue me if I live until 2069). The default is the range over wich the backtest is valid.|
|mm||Starting month of the run, two digits, 01-12. Defaults to January.|
The general options at the beginning of the code mostly come from the trading simulator. They may appear in any order, though they should come after the year/month numbers. The options are:
||Run the test with HTML output. Normally, following the link won't actually run a test, but just present the setup screen ready for running.|
||Run the text with CSV output for exporting to a spreadsheet. This is implied if the tester is run from the command line, or a "*.csv" file is run.|
||Allow direct entry of screen codes, instead of the normal pulldown menus. That's why you're reading this guide.|
||List selections and gains for all months, not just trade months.|
||Holding period, between 1 and 24 months. The default is one month.|
||Number of screens, for testers that allow multiple screens.|
||Use the trading simulator. This allows the entry of the extra parameters below, and is implied if any of those are set.|
||Initial allocation, defaults to $10000.|
||Amount to add periodically|
||How often to add money|
||Rebalance period. Defaults to one month; may be 0 to never rebalance.|
||Short-term capital gains taxes|
||Long-term capital gains taxes|
||How often to take taxes out|
||How many days trades lag rankings|
The last part of the code is interpreted by the specific tester used. They generally share a common format of one or more screen codes followed by options. Screen codes are inside parentheses, in one of two forms. They may be the name of one of the standard MI screens or one of a handful of indices. Also, any backtest code can be used as a screen code; this code fragment may in turn contain other screen codes with their own backtest codes in parentheses. The global options listed above, including the date information, are not included - those options will come from the backtest using the code, and will be stripped from the code if found (allowing for easy cut-and-paste).
ST ss # #
Ss is a screen code, followed by two 1-or-2 digit numbers, which
are the ranks to buy. Note the two numbers are run together without any
spaces or other separators. A 2-digit code is easy, e.g.
is ranks 1-5. A 4-digit code is two 2-digit ranks,
1025 is ranks 10-25. A 3-digit code is a 1-digit rank
and a 2-digit rank. e.g.
110 is ranks 1-10.
This "from-to" rank encoding appears in many other testers as well.
T # # | ss)
X] rule [
X rule ...]
A screen is defined by a series of rules, separated by uppercase
X". Rules are made up of field names,
numbers, strings, and algebraic operators.
The first rule may be a screen code, or a database specifier marked by a
D" and a lowercase name.
The field names are made up of lowercase letters, digits, and underscores.
are listed in the Screen Builder Field Guide.
Numbers consist of digits and an optional decimal point. Strings are any
text surrounded by capital "
Q" (see below); all letters in
strings must be lowercase, and all special symbols must be properly
encoded. Operators (and a few other related symbols) are capital letters
with the following encodings:
Syntactically, a rule is any free-form concatenation of the above parts. But in reality, it must make sense to the computer.
Screen of Screens
SS ss [...] [#] [
m #] [(
s) #] [
First, the screen codes are listed for all screens used in the SOS. Next
comes the number of positions to use per screen. Then the maximum score
is preceded by a lowercase "
m" (defaults to the number of
positions). If the SOS must match a minimum number of screens, that
number is preceded by a lowercase "
s" (or a lowercase
u" if the screens should be unique). If there's a limit of
stocks to select, it's preceded by a lowercase "
not a one or an uppercase "
I"). This limit code is used in
BL ss [# #] [
p #] [
h #] ... [
For each screen in the blender, the following:
First, the screen code, optionally followed by the ranks for that screen (if the screen isn't a backtest code). Optionally, a percentage of the portfolio to allocate to that screen (defaults to split evenly) preceded by a lowercase "
p", and a holding period preceded by
By default, the blender (as opposed to the sceens within the blend) is
rebalanced annually. A different rebalance period may be specified with
b", which may be 0 to never rebalance.
OV ss ss pad # # [
First, the screen codes for the two screens to overlap. This is followed
by a single-digit pad code: 0=none, 1=first, 2=second, 3=both. Then the
ranks to hold in the Standard format. If there's a limit of stocks to
select, it's preceded by a lowercase "
HD ss [ss] # # [
s #] [
First, the screen code the the "buy" screen, followed by the "transition"
screen if there is one. Next are the ranks to buy. The "sell below"
rank, if any, is preceded by a lowercase "
s". If there's a
"sell below" rank for the transition screen, it's preceded by a lowercase
DZ ss tt (
t # | # #) [
First, the screen code, followed by the trading period. In "dozens" mode,
i.e. buy some number of stocks not already held, the number of stocks per
period is preceded by a lowercase "
t". In "dual semi" mode,
indicate the ranks to hold in the Standard format.
A rebalance code may be specified: "
n" for no rebalancing,
m" for margin rebalancing, "
c" for cash
rebalancing, and "
s" for cash rebalancing with a shown
balance. If no code is specified, it defaults to "
SW ss ss ss [# #]
c # [
First, the screen codes are listed for the index, the low screen, and the high screen. The index may be a regular screen code, or one of the following index codes:
||Dow Jones Industrial Average|
||S&P 500, dividend-adjusted|
After the screens are the ranks to buy/compare (unless the screens are
backtest codes, in which case all ranks are used). The number of periods
to look back is preceded by a lowecase "
p", and the
percentage cutoff for the index screen is preceded by a lowercase
c". The hold-'till-switch option is specified by a
AM ss [# #]
The all-months codes don't include the mm part of the standard code header, since there is no one month associated with the summary.
First a screen code, followed by the ranks to use. If the screen is a backtest code, no ranks are specified.
OP ss [# #]
v # (
t) # [
m #] ...
First, the screen code to pick options from. Next are the ranks to use
(unless the screen is a backtest code, in which case all ranks are used).
The volatility percentage is preceded by a lowercase "
Then for each option category:
First, an option code:
l (long stock),
P (write put),
v (covered call),
d (cash), or
t (T-bills). Next, the percentage
of the portfolio to put into this option type. For call and put options,
the %OTM is preceded by a lowercase "
o" and the number of
months out is preceded by a lowercase "
CB ss [...] [#] [
First, one or more screen codes, followed by the limit of stocks to
select, if any. The code "
s" indicates a seasonal crystal ball.
MV ss # # [
First, the screen code, followed by the ranks to consider. If there's
limit of stocks to select, it's preceded by a lowercase "
Relative Strength of Screens
RS ss [...] [# #] (
First, the screen codes are listed for all screens compared. Next are
the ranks to buy/compare (unless the screens are backtest codes, in which
case all ranks are used), then an "
s" for "seasonal" lookbacks
or an "
x" for regular lookbacks, followed by the number of
years or periods to look back.
FR ss ss # # [
o # #] [
First, the screen codes for the two screens to overlap, and the ranks to
consider for the freshmen test in the Standard format. Next comes the
ranks to use for the overlap, preceded by a lowercase "
If there's a limit of stocks to select, it's preceded by a lowercase
OO ss ss [
s] # # [
l #] ...
For each overlap to try, the following:
First, the screen codes for the two screens to overlap. A lowercase "
f" for a freshmen overlap, and a lowercase "
to pick the second overlapped stock. Then come the ranks to overlap in
Standard format (the
s option must
precede this). If there's a limit of stocks to select, it's preceded by
a lowercase "
Using the above, you can decode the backtest code
- Named "My Screen"
- From 2003
- To 2016
- List picked stocks
- Use the Relative Strength of Screens tester
Run the Hold-'Til-Drop tester with the code
- The HTD "buy" screen is FCF-26.
The HTD "transition" screen is from the SOS tester with the code
- 10 positions per screen
- Max score 10
- Buy positions 1-2 in the "buy" screen.
- Sell when below 10 on the "buy" screen and off the "transition" screen.
Run the Standard tester with the code "
(Small_Value)12", which is Small_Value 1-2.
- Non seasonal, 1 period look-back.
Nothing to it, really :-).