Chapter 10: Using QuickHorse Scripting Files and Building Your Own
Scripting - Definition - Using text files to create DIRECTIONS for QuickHorse so that QuickHorse can run automatically to BACKTEST and SUPERTUNE for you while you are away from the computer.
WARNING!!! - This is a very advanced feature and can be almost like programming. It is NOT for everyone but we do want users to be aware of this feature and use it at your own risk/reward. We CAN NOT build scripts for you unless you would like to pay us for this service, and we can not correct the ones you create. We can provide examples, and you can use these examples to create your own. You will have to study and work at it.
Most of QuickHorse is "point and click", and, while you might not always know what you are doing, you are always doing something. It's pretty easy to point and click after all. Scripting is more difficult as it requires you to WRITE commands that QuickHorse will then read. It's like creating a recipe, giving step by step directions for making a cake.
Before beginning this Tutorial, please EXIT QuickHorse, the RESTART QuickHorse.
For purposes of this discussion we shall again return to our CC20001007 program which is a 13 race program. The user should then select the "Scripting" Menu Bar item.
See Figure 1 Below where Scripting has been selected by using the Menu Bar Item "Scripting".

Figure 1 - The Scripting Drop Down Menu
Scripting is an ADVANCED feature because most QuickHorse Users are not programmers, and scripting is like programming. We've tried to make it straightforward and have provided examples of some scripts you might find helpful, but if you want to create your own scripts, well, you will be on your own but hopefully the samples will lead you in the right direction. In addition, you can consult other QuickHorse users on the forum.
This tutorial explains how to edit, then select your scripts so that they will run while you go do something fun, like mow the grass! First, let's take a look at a sample script provided. Click on "Edit Script" and some sample script files will appear on the selection Menu.

Figure 2 - Sample Script Files
Select the line containing "SAMPLE". A notepad window will pop up and you will be looking at the script file.

Figure 3 - A Sample Script File - SAMPLE.SCRIPT
The first thing you should do is use the FORMAT feature of Notepad, to UNCHECK the WORD WRAP. You will then see each scripting command line by line the way QuickHorse will read it. After you've done that, then we can look at each line, and perhaps you'll get a feel for how to use script files.

Figure 4 - Word Wrap TURNED OFF
Now that Word Wrap has been turned off, let's talk about QuickHorse's Scripting "language".
First, QuickHorse ignores all lines that begin with an ASTERISK character '*'. Notice the first 8 lines of this script file begin with an asterisk. These are referred to as COMMENT LINES and you can use them freely as notes to yourself. The 10th line is a BLANK LINE, and QuickHorse will ALSO IGNORE all blank lines. So, you may use BLANK LINES to create spacing in your script file. You should read all the comment lines of our sample script files because they describe what the real script file lines do. What are "real" script file lines?
Those that don't have an asterisk at the beginning and are not BLANK. These are SCRIPT COMMANDS which QuickHorse will perform when you "Run a Script File". And these commands are what YOU MUST UNDERSTAND in order to use scripting properly. Not using them properly can result in QuickHorse doing things wrong, or even BOMBING OUT!!!
The scripting commands are shown in BOLD letters, then each is explained. For examples of how it is used, see the sample script files included in QuickHorse. There is also one example included for each description below. That sample is in BOLD letters after the "Ex:" characters. The best way to learn scripting is by using our sample scripts and making changes to them. When you do, make sure you RENAME the scripts to some name that you create as these scripts are included in the UPDATE versions of QuickHorse. If you don't create your own scripts and use these names, like sample.script, then all your changes will be overwritten next time you download. Use notepad to change the name!! And be careful when using NOTEPAD as it defaults to placing a ".TXT" after every file, unless you change the file type box to ALL FILES.
Renaming Example: You EDIT sample.script. You want to change the name to pimlico.script because you've changed it to work with Pimlico. Do a SAVE AS, and a window will popup allowing you to change the name. Change the name to pimlico.script, then look below that name for the FILE TYPE box, and it will probably say *.txt, so change this to ALL FILES before you SAVE!! Otherwise your file will be called pimlico.script.txt and QuickHorse will NOT find it.
Script File Commands:
backtest surfaces - This command allows you to specify one or more surfaces, ie, DIRT or TURF, to tune track profiles. Example backtest surfaces DIRT distances 5f 6f grades A CO
backtest distances - This command allows you to specify a single distance, and all/some grades at that distance to SUPERTUNE several track profiles with only one scripting command. Ex: tune distance 5f 6f grades S CO A will tune the track profiles for 5f S, 5f CO, and 5f A, along with 6f S, 6f CO, and 6f A, etc...
backtest grades - This command allows you to specify a single grade or many grades to SUPERTUNE several track profiles with only one scripting command. Ex: tune grades S CO A will tune the track profiles for Special Weights, Optional Claiming and Allowance races.
begin date - for BACKTEST/SUPERTUNE the starting date which defines what programs you wish to use. You may enter the mm/dd/yy value, for example, 05/16/03 or if you leave it blank, then it represents either the most recent date which is today's date, or the date of the oldest program you have. This depends on the value of the "set fwd" command (see "set fwd"). Ex: begin date 05/01/03
begin date minus - for BACKTEST/SUPERTUNE , rather than specific a date, you use "minus 10" to indicate 10 days before today's date. Ex: begin date minus 40
convert - perform a convert of the race programs/results charts which have been downloaded from the Internet. You must specify either a REBUILD or UPDATE. Ex: convert update will convert new programs/charts, and convert rebuild will rebuild your entire database using your .TAB files and any new programs/charts.
dist - this command is used to select which track profiles you wish to SUPERTUNE or BACKTEST. You simply set dist no or dist yes. Setting dist no is the same as setting DISTANCE to no on the TRACK PROFILE setup display on the CONVERT menu. Ex: dist yes
end date - for BACKTEST/SUPERTUNE the ending date which defines what programs you wish to use. It is entered in the same way the "begin date" is entered, and if left blank, represents the most recent or the oldest date of your data depending on the value of the "set fwd" command (see "set fwd"). Ex: end date 05/16/03
end date minus - for BACKTEST/SUPERTUNE, rather than a specific date, you can specify "minus 10", for example, to mean the end date is today's date minus 10 days. Any number of days can be used. Ex: end date minus 10
grade - this command is used to select which track profiles you wish to SUPERTUNE or BACKTEST. You simply set grade no or grade yes. Setting grade no is the same as setting GRADE to no on the TRACK PROFILE setup display on the CONVERT menu. Ex: grade yes
initialize - This command will reset all the Weighting factors for a particular method to 1.0. You might use it prior to SUPERTUNING with your script file, but it is NEVER necessary. You may also set individual weighting factors using the set command along with the name of the weighting factor to use. See sample script files for those individual names. To use the initialize command, simply specify the name of the method. If you wish to initialize one of your own methods, use its name, but also put method = before the name. Otherwise, the method names to use are STANDARD, KNIFE, KNIFEADAPTED, MORGAN, and CONSENSUS. Ex: initialize MORGAN Ex: You own method initialize method = mymethod
method - the method of display in BACKTEST or SUPERTUNE. This has NOTHING TO DO WITH METHOD BUILDING!! Valid settings are A, B, or C, just as you do on the BACKTEST display. When using a B, you must also follow that up with a number from 1 to 8. Ex: method B 1
number of backtest races - this is pretty self explanatory. It's simply that NUMBER RACES setting you've been clicking in on the BACKTEST display. Ex: number of backtest races 200 means a maximum of 200 races will be used, but no races will be used outside of the begin and end dates, so you may get less than 200 races.
profile - the profile command allows you to specify the folder where your initialization data and weighting factors will come from. The folder name must exist and will begin with the letters "TP_" and end with the name you provide in the command. Ex: profile testvalues This command will select, and create if necessary, the folder tp_testvalues. All track profiles created after this point in the script file by way of SUPERTUNE will be created in this folder.
program mask - this command tells QuickHorse which race programs (track/performance) to use when BACKTESTING/SUPERTUNING. When you use QuickHorse, you first selected a TRACK, then you selected a race program, which was either Evening or Matinee, and BACKTEST/SUPERTUNE worked with these programs. This command is the way the scripting process makes these selections. Ex: program mask gg????????e means use all evening performances at Gulf Greyhound Park. You may change our sample scripts to fit your track by simply changing the TRACK ID.
quit - you may insert this command ANYWHERE within a script you are testing, to STOP IT! It is best, when building a script to write some of it, then test it, then write more, then test it. If you wish to learn from the scripts we've provided, then simply put the quit command anywhere in it to make it stop at any point, so that you can see what its done.
select track - This command selects the TRACK to be used for subsequent Scripting Commands. Simply specify the track id, for example, PIM is Pimlico.
set fwd - Set the direction of BACKTEST/SUPERTUNE from "begin date" forward to "end date" or "begin date" backward to "end date". A "set fwd 1" means that BACKTEST/SUPERTUNE will process races from the "begin date" FORWARD day by day to the "end date". This means that the "begin date" is earlier than the "end date". A "set fwd 0" means that BACKTEST/SUPERTUNE will process races from the "begin date" backward day by day to the "end date". This will tell QuickHorse that the "begin date" you enter will be the most recent date, and that the "end date" you enter will be the earlier date. Some users don't care the order in which the results are tested, and some do. The fastest method is "set fwd 0". Ex: set fwd 0 or set fwd 1
style - this command selects the Method you wish to SUPERTUNE/BACKTEST or Handicap. Simply specify the method, STANDARD, or your own Custom Method name. If you are using your own method, use method = before the name of the method. Ex: style method = mymethod or style STANDARD
surface - this command is used to select which track profiles you wish to SUPERTUNE or BACKTEST. You simply set surface no or surface yes. Setting surface no is the same as setting SURFACE to no on the TRACK PROFILE setup display. Ex: surface yes
target - for a supertune operation, target is the A, B, C, D, etc. which corresponds to a "Target Value", that value you wish to MAXIMIZE when SUPERTUNING - See SUPERTUNE. Ex: target E means the value to maximize is the "wager 1 win %"
tune - This command SUPERTUNES the currently selected method (see style command) and uses the multiple setup commands (races, dates, perf, grade, dist, etc.). Without any other words with this command, the assumption is you wish to tune everything to create one track profile. However, you may tune various distances and grades using the following command.
tune surfaces - This command allows you to specify one or more surfaces, ie, DIRT or TURF, to tune track profiles. You may use this single line to designate all Surfaces, Distances, and grades to be tuned in a single method. However, the length of the line should be kept to a maximum of 200 characters. Example tune surfaces DIRT distances 5f 6f grades A CO
tune distances - This command allows you to specify a single distance, and all/some grades at that distance to SUPERTUNE several track profiles with only one scripting command. Ex: tune distance 5f 6f grades S CO A will tune the track profiles for 5f S, 5f CO, and 5f A, along with 6f S, 6f CO, and 6f A, etc...
tune grades - This command allows you to specify a single grade or many grades to SUPERTUNE several track profiles with only one scripting command. Ex: tune grades S CO A will tune the track profiles for Special Weights, Optional Claiming and Allowance races.
wager - simply set your wager as you did on the BACKTEST/SUPERTUNE displays but afterwards, enter the actual cost of the wager you wish to make. Ex: wager 12345/12345/12345 $1 means the wager you wish to BACKTEST/SUPERTUNE is a 12345 trifecta box using QuickHorse's first 5 top picks for each race with a $1 wager.
As always we invite your questions and comments via e-mail - mikeg@quickreckoning.com
Copyright 2006 QuickReckoning.com Last Updated on - 03/23/2006