Tuesday, 28 July 2015

Bet Selector Task Scheduling

You can now schedule Bet Selector to download form at a certain time each day, get scratchings and results at a certain time etc. These tasks are done completely in the background with no pops ups to tell you what is going on (reason being that it is intended for unattended use when you may not even be logged into your computer so we don’t want pop-ups trying to get in the way of it working).

Three functions can now be scheduled to automatically occur each day, namely Bestform form downloads, Sportsbet fixed price updates and Tattsbet price, scratching and result updates. Special command line arguments are used when firing up Bet Selector to tell it what to do and the scheduling part is taken care of by the Windows Task Scheduler. This will work even if you are away and logged off your computer (but it must be left running and connected to the Internet).

Using the Bet Selector Command Line


The special command lines can also be called from other programs and specially configured shortcuts on your desktop but they are really designed to be called from the Windows Task Scheduler as described in detail below.

Let's start with the command lines. The one for downloading the current days form is as follows:

C:\Price\BETSEL.EXE AUTO FORM

Basically the above is the normal command for calling Bet Selector but with two additional arguments viz the words AUTO and FORM. Note that each of these words has a space before it. The word AUTO is used in all examples and tells bet Selector that the command line is designed for automation. The word FORM tells Bet Selector that the task to be automated is the downloading of form files.

The above only downloads form for the current day but you can download form for tomorrow as follows:

C:\Price\BETSEL.EXE AUTO FORM+1

You can also download form two days in advance using the following:

C:\Price\BETSEL.EXE AUTO FORM+2

The command line for updating Sportsbet fixed prices is as follows:

C:\Price\BETSEL.EXE AUTO BOOK

As above, the word AUTO is used in all examples and tells bet Selector that the command line is designed for automation. The word BOOK tells Bet Selector that the task to be automated is the downloading of Sportsbet fixed prices. Note you can only download prices for the current day.

The command line for updating Tattsbet information is as follows:

C:\Price\BETSEL.EXE AUTO TAB

As above, the word AUTO is used in all examples and tells bet Selector that the command line is designed for automation. The word TAB tells Bet Selector that the task to be automated is the downloading of Tattsbet information. Currently the above only supports the current day but options to download tomorrow and the day after tomorrow will be added later.

Please note that for the purpose of the above calls, Bet Selector will treat the current day as going from 3:30am in the morning to 3:30am the next morning. The reason for this is so you can collect TAB data at say 2.00am or 3.00am and still get the previous day which is relevant when Hong Kong meetings often run a race or two past midnight our time.

Note also that you can combine any of the above functions into one call although it would normally be best to schedule the tasks totally separate from one another. Once exception is when automatically getting Sportsbet info as following it with an automatic TAB update is basically what happens in Race TAB Live when you use the Sportsbet option. The command line to do this is as follows:

C:\Price\BETSEL.EXE AUTO BOOK TAB

Note the program will always do the TAB update last regardless of which way you order the arguments. You can also combine downloading form for the day and doing the TAB update using the following command line:

C:\Price\BETSEL.EXE AUTO FORM TAB

Note the program will always do the form download first regardless of which way you order the arguments. Note also it is best not to try doing both form downloads and TAB updated for any day other than the current day.

Task Scheduling Overview


Now to the scheduling of the above functions which is done by the Windows Task Scheduler. The Windows Task Scheduler is very powerful as it allows you to schedule things to be done say once a day at a certain time. The essentials on how to use it to automate the above functions will be outlined below. If you want to learn more I suggest you Google "Windows Task Scheduler".

To locate and run the Windows Task Scheduler just enter "Task Scheduler" in the search bar off the Start menu. Then click "Create Task" in the right-hand Actions pane. Note if you click "Create Basic Task" then you won't get full control over creating the task and will have to go back in and edit the tasks properties - hence it is best to go straight to "Create Task".

You will be presented with a popup displaying a number of TABs for creating your task. These are General, Triggers, Actions, Conditions and Settings. These are to be set as follows.

General Properties


First type in a name. I suggest you start all names with BS followed by the arguments. This way they will be easy to locate later in the task list and you can see at a glance what they do. For example use bsautoform for a task to automatically download form and bsautotab for a task to automatically download TAB data.

Then go down to the "Security options" and click the "Run whether user is logged on or not" radio button. Also make sure you tick the "Run with highest privileges" check-box.

Finally under "General" at the bottom where it says "Configure for:" make sure the correct version of Windows is selected. Then click the "Triggers" TAB (not OK).

Trigger Properties


Click the "New..." button to set a trigger for the first time. Leave the top drop down on "On a schedule" and click the "Daily" radio button (if not already selected). Then set the time at which you want the task to be run each day. Then go down to "Advanced settings" and tick "Stop task if it runs longer than:" and select "30 minutes" - this is important because if a task drags on because of internet issues or if the program freezes for some reason then you don’t want it left "open" as it will stop future tasks from running. The only other check-box in the advanced section that should be ticked is "Enabled".

Note that you can add more than one trigger which is handy for example if you want to automatically schedule TAB updates at a few different times a day. This avoids you having to set up multiple task for each time - you just have one task with multiple triggers set.

Scheduling tasks to occur exactly on the hour might best be avoided in case lots of other users all attempt to do the same thing. So rather than everyone scheduling end of day TAB updates at say 10pm or next day form updates at say 10pm it would be better to set a slightly different time like 10:11pm etc.

Important: Please do not unnecessarily schedule tasks to run more than you absolutely need to. Providers like Bestform, Tattsbet and Sportsbet may block your access if you access their data with too high a frequency.

Action Properties


Click the "New..." button to set an action for the first time. Leave the top drop down on "Start a program" and enter the following in the "Program/script" box:

C:\Price\BETSEL.EXE

Then enter the arguments in the next box for example AUTO FORM to automate form downloading from Bestform. Note you can also enter the full Bet Selector command line with AUTO and FORM on the end like in the earlier examples and you will just be asked to confirm the arguments.

Finally there is a box that says "Start in (optional)". This could be considered an optional setting that is used when you want to run the program in a separate location to where it resides (something it is best not to try with Bet Selector). However it is recommended that you enter the actual path the program resides in. This is just the beginning of the full path listed above for example C:\Price

Important: If you do not set "Start in" then the Task Scheduler may attempt to run the program in the Windows folder which you definitely do not want to occur.

Conditional Properties


Tick "Wake the computer to run this task". This should ensure your scheduled tasks run even if the computer is asleep. If you have problems with this not working then go into Control Panel and edit your Power Management settings by selecting the option to "Never put your computer to sleep".

Troubleshooting


Scheduling Bet Selector to do things is designed for when you are away from your computer or for times like during the night when you are not using it. Note that if you leave Bet Selector running (even if idle) then scheduled tasks most likely will not work. So make sure Bet Selector is closed during times when you want scheduled tasks to run.

There are other reasons why scheduling something might not work and following is a recap on some of the more important settings that if incorrect could cause tasks not to run:

  • Under "General Properties" make sure you select the "Run whether user is logged on or not" radio button and the "Run with highest privileges" check-box
  • Under "Action Properties" make sure you enter C:\Price (or whatever else your default location is) in "Start in"
  • Under "Conditional Properties" make sure you select "Wake the computer to run this task".

Note that once you locate the Task Scheduler (eg via Start>Search) you can right click it and select "Pin to Start Menu" so it is always easy to find. That way you will only be a couple moue clicks away from checking, changing or adding properties.

Monday, 20 July 2015

How to Test Ratings and Rankings

The most common test you are likely to want to do is to test for top rated horses. All ratings have ranking variables available in Expert Mode so the rule to test for the top rated is simply to require the ranking equals one.

To date there have been 3 sets of ratings, namely Main , Better and Plus. Better is a variation of the main predictive rating that emphasizes class and Plus is a variation of the main predictive rating that emphasizes consistency.

Now with the Ultimate Professional upgrade we have 3 more sets, namely avBase based variations of Main, Better and Plus.  These are based on the avBase class values compared to the original 3 sets of ratings which are based on  par-times. The benefits of using avBase figures is that they class a race based on the recent ratings of all horses in the race (mathematically weighted towards the higher ratings). The best way to think of the difference is that the original ratings are time based and the avBase ones class based.

In this post we will look at how you test rating rankings and also look at testing other rankings for things like pre-post markets, AAP ratings, TAB markets and more.

Testing Bet Selector Ratings by Ranking


The original "Main" rating rank is saved in the variable H:POS so the rule to test for the top rated is as follows:

H:POS=1

Note the "H:" prefix indicates this ranking is actually saved in the horse data file for each meeting. This is the only ranking saved in this way as it was the original ranking back in the days when the program only had one rating (of course it has been improved along the way but it is still saved in the horse data files).

All other ratings are calculated on the fly so to speak and have variable names as follows:

  • BRRANK - Better Ratings Rank
  • PRRANK - Plus Ratings Rank
  • AVB1R - AVB Main Ratings Rank
  • AVB2R - AVB Better Ratings Rank
  • AVB3R - AVB Plus Ratings Rank

So to test for the original Better Ratings top horse the rule is as follows:

BRRANK =1

Note that in Expert Mode it is preferable to use the above rather than the old way of putting BR$1 in your system name. Note also you can use the special "Within" functions to test for rankings within a range like in the following rule:

Within(BRRANK,1,3)

To test for the new avBase Better ratings top horse the rule is:

AVB2R=1

You may wish to remember that AVB stand for avBase based, the letter R on the end stands for ranking and the number refers to the rating type (1 for Main, 2 for Better and 3 for Plus).

In total there are six rating ranking variables you can use as outlined above. Please note that the avBase ones will only work correctly if you regularly download form each day from Bestform and regularly update your TAB results (downloading the master TAB result files after the end of each month and running a test over all the past months races with "force results checking" ticked is important in this regard).

Important: Make sure you never delete meetings.

Tip: The avBase ratings for each past race used to formulate the avBase ratings can be viewed in the AB column in Extra Form. The only past runs that should be missing AB figures are barrier trials and non-Bet Selector meetings (eg international races). If you find any recent Australian or New Zealand runs without AB figures then you may have to re-download these meetings or at least refresh their results.

Finally there are three more Bet Selector rating related rankings you might like to test for, namely if you want to pick the horse with the top base rating before bonuses and penalties, the horse with the top peak distance rating or the horse with the highest last start rating. Variables for these are as follows:

  • BSRANK - Base Rating Rank
  • PKRANK - Peak Rating Rank
  • LSRANK - Last Start Rating Rank

Testing Bet Selector Ratings by Value


Testing rankings is the easiest way to pick selected rated positions but there are also rated margin and/or price variables for most ratings. For example associated withe Main rating rank H:POS there are the following additional variables:

  • H:PRICE - Rated Price
  • H:LEN - Predicted Lengths

Note that H:PRICE is a text variable (as it used to display in bookie format like 5/2) so to convert it to a rated dividend you must use BOOK2DIV(H:PRICE).

Rated value/price variables for the other ratings are as follows:

  • BRVAL - Better Ratings Value
  • PRVAL - Plus Ratings Value
  • BRDIV - Better Ratings Rated Price
  • PRDIV - Plus Ratings Rated Price
  • AVB1V - AVB Main Ratings Value
  • AVB2V - AVB Better Ratings Value
  • AVB3V - AVB Plus Ratings Value

Remember when using a value variable you must compare it to a number to create a rule or use it inside the Within function. Here are some example rules that require rating values to be above a certain number:

BRVAL>95
PRVAL>55

The first example above tests for Better Rating values above 95 while the second example tests for Plus Ratings values above 55.

You normally would not test for an exact value as rating values are usually (real) decimal point numbers. The exception are Better Ratings which are (integer) whole number values up to 100. Following are some examples of exact value tests:

BRVAL=100
BRVAL=99

The first example above tests for Better Rating values of exactly 100 while the second example tests for Better Rating values of exactly 99. Note that testing for 100 is not quite the same as testing for the top rated horse as sometimes there is more than one horse rated 100 in a race.

Finally you can use the Within function to test for ranges as in teh following examples:

Within(BRVAL,95,99)
Within(AVB2V,97,99)

The first example above tests for Better Rating values between 95 and 99 (inclusive) while the second example tests for avBase based Better Rating values of between 97 and  99 (inclusive).

Testing Other Ratings and Rankings


Bestform downloads include two additional ratings namely the AAP 100 point ratings like you see in many newspaper form guides and the official handicapper ratings that can be found on Racing Australia's web site.

The ranking variables for these are as follows:

  • HCRANK - Official Hcp Rating Rank
  • RDRANK - AAP Dry Rating Rank
  • RWRANK - AAP Wet Rating Rank

Note there are additional variables for the actual ratings themselves as follows:

  • HCP - Official Handicapper Rating
  • RTGDRY - AAP 100 Point Dry Rating
  • RTGWET - AAP 100 Point Wet Rating

Note that where possible you should use the AAP 100 point rankings in rules as they are adjusted for scratchings whereas the ratings are not. Rules to pick the top AAP rated horse on dry and wet tracks respectively are as follows:

RDRANK=1
RWRANK=1

If you want a rule to pick the top AAP rated horse using the dry ratings for dry tracks and wet ratings for wet tracks then the rule is as follows:

IF(GCODE$"SH",RWRANK,RDRANK)=1

Note the above treats slow/soft and heavy tracks as wet and others as dry.

Ranking variables exist for lots of other things too like the early newspaper market in the Bestform downloads, early/final TAB prices, Sportsbet fixed prices, win and place strike rates and more.

  • MPRANK - Early Market Price Rank
  • APRANK - API Rank
  • WPRANK - Win % Rank
  • PPRANK - Plc % Rank
  • SPRANK - Starting Price Rank

Testing Fixed Prices and Rankings


Sportsbet fixed price market rankings and prices can also be tested but only if collected each day via the Sportsbet option in the Race DayLive part of the program. The available variables are as follows:

  • SB1W - Sportsbet 1st Market Win Price
  • SB1P - Sportsbet 1st Market Place Price
  • SB2W - Sportsbet 2nd Market Win Price
  • SB2P - Sportsbet 2nd Market Place Price
  • SB1WR - Sportsbet 1st Market Win Rank
  • SB1PR - Sportsbet 1st Market Place Rank
  • SB2WR - Sportsbet 2nd Market Win Rank
  • SB2PR - Sportsbet 2nd Market Place Rank

Similarly Tattsbet fixed price market rankings and prices can also be tested but only if collected each day via the Tattsbet option in the Race Day Live part of the program. The available variables are as follows:

  • TB1W - Tattsbet 1st Market Win Price
  • TB1P - Tattsbet 1st Market Place Price
  • TB2W - Tattsbet 2nd Market Win Price
  • TB2P - Tattsbet 2nd Market Place Price
  • TB1WR - Tattsbet 1st Market Win Rank
  • TB1PR - Tattsbet 1st Market Place Rank
  • TB2WR - Tattsbet 2nd Market Win Rank
  • TB2PR - Tattsbet 2nd Market Place Rank

In addition to the above we have TBWIN (Tattsbet Tote Win Price) and TBPLC (Tattsbet Tote Plc Price). All this data is saved when you run Race Day Live and also when you collect TAB data via the AUTO TAB scheduler option. TBPLC will be of particular interest to those of you who want to access the place div for every horse in a race but remember it will only be available if you have collected the data.

You will note the numbers 1 and 2 above which refer to the "first" and "second" Sportsbet market. These are collected and displayed in Race Day Live and the way it works is that the SB1 price variables are set the first time you collect data for the day and then on subsequent use the SB2 prices are set. Note however the SB1 market is automatically set regardless if not previously set plus after the first collection of prices you get prompted if you really want to collect a second set (normally you answer Yes but you could answer No if you wanted all "first" prices to be reset).

Typically you would collect your first set of prices after scratchings and track conditions are known say around 10am. Then during the day you could update the second set of prices or you could just leave things until after the races when the results are in so you can then test morning markets against final markets.

Note that during the day you may see a warning pop up indicating if any races don’t have fixed prices available. Note also that final prices can only be collected on the day or the very next day. After that they are no longer available so you need to remember to collect them each day or use the new scheduling features to collect them automatically each night.

Concluding Remarks


All the above variables are available in the drop down lists in the Expert Mode editor so you do not have to remember them all. The Main Rating ones saved in the horse data files are in the "Horse File Data" drop down list while the remainder are in the "More Horse Data" drop down list which is split into sections to make it easier to read (eg strike rates, ratings and rankings, Bestform data and Sportsbet data).

Note: There is a "List All Items" button on the far right of the Expert Mode editor that you can use to view and/or print out a full list of all available variables (not just horse ones but also the meeting, race and form ones).

As rating variables are either rankings (eg 1-24), ratings (eg points of kgs) or rated prices (eg dollar amounts), they all return numbers which are easy to use in rules. Just think of it as you would in plain English. For example if you want a ranking to equal one your rule is simply the ranking variable followed by an equals sign followed by the number 1 (eg H:POS=1 or AVB2R=1). If you want the top 3 rankings then this is the same as saying you want the ranking to be less than 4 so you would use the ranking variable followed by a less than sign followed by the number 4 (eg H:POS<4 or AVB2R<4).

Keep in mind there is a special "Within" function for testing ranges where you need to set both a minimum and maximum value for a ranking, rating or price. It has three arguments namely the variable you want to test followed by the minimum bound followed by the maximum bound. For example to test for Main Rating rankings of 2 or 3 you would use Within(H:POS,2,3) as your rule.

Remember you can have as many rules as you like one line after the other. Two you will most likely use are as follows for picking Saturdays and metrops receptively:

1.DAYCODE$"7"
1.LOCATION$"SMBAW"

Note the above rules are character based not number based. The DAYCODE variable is a character representation of the day of the week (eg 7 for Saturday) while the LOCATION variable is a character representation of the city code (eg S for Sydney). The dollar sign is an operator (a bit like an equals sign) that in English translation means "is contained in" - so the above rules test if the contents of the variable on the left is contained in the character string on the right.

Another special variable you might often use is GNUM that represents the track condition grading (eg 1-10). Note it is a number so it needs to be compared to numbers like in the following examples:

2.GNUM<5
2.Within(GNUM,3,4)

Note meeting rules can be prefixed with "1." and race rules with "2." to speed up testing. For more details on this and other rule writing examples please check out the earlier Expert Mode blog posts via the right hand menu.

Saturday, 4 July 2015

Selecting Second, Third and Fourth

Normally in system tests the second, third and fourth picks come from a number of top rated horses (the default number is 6 top rated runners in non-Expert Mode systems). In Expert Mode in Bet Selector Ultimate Professional however you can have separate rules for each of the second, third and fourth placings.

An example will help illustrate this. Your main system rules are used to pick horses to win but for the placings you might want to use the top 4 in the AAP early market for second,the top 6 in the AAP early market for third and the top 8 in the AAP early market for fourth. To implement this the final lines of your Expert Mode system would be as follows:

B.MPRANK<=4
C.MPRANK<=6
D.MPRANK<=8

Note that the B line picks horses for second, the C line picks horses for third and the D line picks horses for fourth. Just use the respective letter (in upper case) followed by a full stop followed by your rule. Note also that you do not have to use the same ranking in each rule as virtually anything can be used to select each of the second, third and fourth picks (when I say anything I mean any horse based rule as it would not make sense to use a meeting or race selection rule).

Something that might not be obvious is that if you leave out a line then all horses in the race are included for the position in question. Think of it like you do rules for the win where if no rules are present then all horses in the race are selected. Note that just because we use letters B, C and D to pick second, third and fourth this does not imply there is such a thing as letter A (there is not as Expert Mode as described in posts up until now is all about picking win selections anyway).

The other thing worth mentioning is that you can actually have more than one rule (line) for each placing. This means you can build quite complex rule setting for each placing if you really want to.

For readability and to ensure Expert Mode interprets your rules correctly please make sure the above mentioned rules come last in your Expert Mode system. And make sure the B ones come before the C ones and the C ones come before the D ones.



Monday, 29 June 2015

External Data Lookup

Another major addition only in Bet Selector Ultimate Professional is the ability to access data from external files. This is done via a Lookup function that can be used in MyCalc as well as in Expert Mode.

For example you might have your own jockey ratings file that you would like to use or perhaps a file of class ratings or even a file of horse ratings. While a lot of work has gone on behind the scenes to make this work, the way you implement it is quite simple. First you need a comma separated values (CSV) file with two columns - the first column contains a character string you wish to search on and the second column the numeric value you wish returned in the event of a successful search.

In all cases the file is saved in text format and commas are used to separate the names from the values. Note this means you cannot have more than one comma on a line. Files must be saved in your Price folder and to stop Bet Selector confusing them with normal system CSV files (eg for System Analyser) you must end them in "-d.csv". So for example a jockey ratings file could be saved using the name "jockeys-d.csv" while for race classes you might uses "classes-d.csv" as a name. Think of the "d" referring to "data" if you need a way to remember it.

The above files can be manually created in Notepad but you can also create them in Excel (or any spreadsheet program for that matter) by simply putting the character strings in the first column and numbers in the second column. Then use "Save As" to save as a CSV file and the text based format with commas between the two columns will automatically be created for you plus it will automatically have the .csv extension. Note there is no need to use quotes around the items in the first column.

This new feature can also be used if you just want to pick horses ridden by a jockey from a list of top jockeys or if you just want to pick races only in say country Victoria. The remainder of this post examines how you do this.

The Lookup Function


A special "Lookup" function has been created to locate the desired data in the first column of the file and return the number in the second column. For example the following when used to look up jockey names in a jockey ratings file will return the actual rating for the jockey being looked up:

Lookup(H:JOCKEY,"jockeys-d.csv")

Note the first argument in the Lookup function is what you are searching for in the first column of the file (eg from the drop down lists in MyCalc/Expert Mode) and the second argument is the name of the file which must be in quotes.

The above could be added to other things in a calculation to create your own ratings for example but it is more likely you would use it directly in an Expert Mode rule by comparing it to something (eg less than a value or greater than a value etc). For example  a rule to pick jockey ratings under 5 would be as follows:

Lookup(H:JOCKEY,"jockeys-d.csv")<5

Note the above assumes your jockey ratings are positive and you want the smaller ones which indicate better jockeys (as is the case with traditional jockey ratings that go from 0 or 1 for the best through to say 8 for the worst).

Jockey and Trainer Ratings


In the case of jockey ratings the file would have jockey names in the first column and the associated jockey ratings in the second column. It would look like this:

J B Mc Donald,1.0
B Shinn,1.5
J Bowman,1.5
....

If you want to access a list of trainer ratings then the format is exactly the same as above with the trainer names in the first column and the associated ratings in the second column. Similarly with horses you would put the horse names in the first column and the associated ratings in the second column.

Race Ratings


In the case of past race class values the file would have race class/class abbreviation in the first column and your class values in the second column. It would look like this:

G1,63
G2,61
G3,59
LR,57
Open,55
....

Note that for upcoming races the class names are not as abbreviated so a file for them would look like this:

GroupI,63
GroupII,61
GroupIII,59
Listed Race,57
Open,55
....

Lists without Ratings


Suppose you only want to pick horses ridden by a jockey from a list of say 20 jockeys. You can do this using the above feature by creating a file with your desired jockeys, giving each jockey a non-zero ratings (eg you could give them all a value of one) and then testing for jockey ratings above zero.

You can do the same thing for trainers by creating a list of desired trainers and giving them all a value of say 1. And with horses this is the ultimate Black Book feature as you can have a list of horses as short or as long as you like (just remember to give each horse a non-zero value like 1 so that you can test for it being non-zero).

Another application would be if you wanted to run systems only for say Victorian country tracks or NSW country tracks. This could not be done before but now can by using a file containing the 3 letter codes for the tracks you want to test.

To save you the trouble of creating it, a file including all Victorian country tracks can be downloaded via the following link:

http://www.capitalinfo.com.au/ctryvic-d.csv

The Expert Mode rule to select tracks from this list is as follows (note because it is a venue rule you can prefix it with "1." to speed things up):

Lookup(V:TCODE,"ctryvic-d.csv")>0

Files for other States will be added here soon.

Spelling and Case Sensitivity


Searches are not case sensitive so there is no need to worry about upper and lower cases being different in Bet Selector compared to your file. As long as the letter to letter match is exact the search will succeed and the relevant number will be returned. Note if an exact match cannot be found in the file (or the file can't be found) then zero is returned.

You will need to be particularly careful with jockey and trainer names as they can often differ very slightly due to the presence or absence of second initials or the use of different initials. To check the exact name that needs to be used you should go into the Price Predictor part of the program and click the LOAD DATA TABLES button to see the data exactly as it appears in the form downloads.

Note: Do not read the jockey and trainer names off the main Price Predictor field list as it uses abbreviated names to save space.

Advanced Use


You might have an application where you want to look up two things at once. For example if you wanted to import your own ratings for the current day you could just do a lookup based on the horse name. But if you also wanted to do this for past days then you would have to do a lookup based on both the horse name and the date.

The way to lookup horse name and date together is to add a character representation of the date to the horses name and use this to perform the lookups. Since horse names can vary in length it is best to start with the date string and then add the horse name.

The best date string to use is in the format yyyymmdd (note it sorts better than ddmmyyy). For example 29 June 2015 is represented by 20150629. Following are a few lines to show you how the required file would look (note you must not use quotation marks around the dates/horse names):

20150629Overdrawn,55.5
20150629Cugine,54.0
20150629Heavenly Dancer,53.5
20150614Overdrawn,52.5

As with previous examples, the lookup data file must be saved with a name that ends in "-d.csv". If for example your own ratings file is called myratings-d.csv then the lookup to search for the date and horse combination in System Selector is as follows:

Lookup(DTOS(V:MDATE)+H:HORSE,"myratings-d.csv")

The above will return your rating for the desired horse on the desired date (if found). If you want to test for your top rated horse then the following one line Expert Mode system will test for the top ranked horse:

0.CALCMIN=1,CALCRANKMAX=1,CALCCODE=Lookup(DTOS(V:MDATE)+H:HORSE,"myratings-d.csv")

Note that DTOS()is a speial (Date To String) function that converts the date to yyyymmdd format.

Monday, 15 June 2015

Reports and Spreadsheets

July 2015 sees the introduction of a major upgrade to Bet Selector with the release of Bet Selector Ultimate Professional. One of the most important new features is the ability for users to create their own reports and spreadsheets. Furthermore (in an August 2015 update) you can use System Analyser to report individual criteria profitability for virtually anything you like (not just include race, horse and past 4 start data items but also your own calculations).

The user is able to have as many or as few user defined columns as they like with full control over what goes in each column and the order in which they appear. Columns can be set to contain data from the raw data files (meeting data, race data, horse data or past form data from up to 4 last starts). Data unique to Bet Selector and Bestform can also be included like ratings, rankings, early markets and more.

Designing Reports and Spreadsheets


The way it works is that you set up a template to define the report in the MyCalc/MyReport part of the program (something you only need do once). Then you generate the report as often as you need to in the System Selector part of the program. The advantage of generating the report in System Selector is that you can still use system rules to exclude horses you do not wish to report on plus you can report on all data available in System Selector (in particular data that cannot be tested in the MyCalc/MyReport part of the program). And just in case you want more you can even include the results of calculations - as many as you like in as many columns as you like.

Suppose you want a simple report that displays rated prices, early AAP prices and TAB prices.

Go to MyCalc/MyReport. Click the MyReport radio button then save the follow code – give it a name for example "prices":

H:PRICE
MPDIV
H:CPRICE

Basically the above is one item per line where each line indicates a column to be reported. Usually each line would be just one item but each line could be a calculation comprising multiple items meaning you can even display the result of different calcs in different columns (more on this later). Note the items used can be typed in directly but are also available for insertion via drop downs in the MyCalc/MyReport part of the program which have the advantage of offering descriptions of what each item refers to.

Creating Reports and Spreadsheets


To display a report like the one defined above you need to set up a system in Expert Mode and link to the MyReport name in the first line as follows:

0.REPNAME=prices

Note the above assumes you saved the report definition file under the name "prices" but you can choose any name not previously used. Note also the above is similar to how to link to a MyCalc file (using CALCNAME=). Other definitions can also be included in this first Expert Mode line so if referring to a file name and not at the end of the line you will need to make sure a comma appears at the end of the file name.

Now the above one line Expert Mode "system" will display your report for whatever day or days you run the test over. Note you can add additional rules as described earlier in this blog if you only want to report on selected races/horses. Note also you must save the Expert Mode "system" above and it is recommended you set up a separate folder called Reports for doing so (then you can use any name not previously saved in this folder and you can also use the same name as the report if you like).

Once the Expert Mode code is saved you simply run the report like you would any normal system.When finished you will be able to see the report in the large list box in System Selector. That's not all however as a comma separated values (CSV) version of the same report is also created in case you want to view the report information in a spreadsheet.

VERY IMPORTANT: Note you can click the "Selections" button to the top left of the large list box multiple times to toggle between the report, the CSV file and the normal selection list. You can then click the "Open" button below the large list box to open in Word/WordPad or Excel respectively!

Default Columns and Heading Names


You do not need to include dates, meetings names, race numbers, TAB numbers or horse names as these are all automatically included in every report and csv file.Columns containing TAB results (if available) are also automatically included on the far right of both files.

Note that normally the reports/csv headings are the same as the item names but prefixes are displayed in lower case and colons removed (so H:CPRICE for example becomes hCPRICE). Also if using calculations in columns you get CALC1, CALC2 etc as headings rather than the actual calculation code.

Here's an example of using calculations in reports. If you save the following in MyReport it will let you generate a report displaying career, distance, track and going win percentages:

100*H:WINS/H:STARTS
100*H:TDW/H:TDS
100*H:TCW/H:TCS
100*H:FW/H:FS
100*H:GW/H:GS
100*H:SW/H:SS
100*H:HW/H:HS

Notice how each line is a numeric calculation rather than just an item from a drop down.

System Analyser


In addition to report data items and/or calculations being saved in a separate report and csv file as documented above, in the August 2015 update they are also added to the main csv file because it is this main csv file that is used as the basis for System Analyser.  These extra columns are located towards the far right of the file (just before the betstring info).

Note a few extra columns have been added to the main csv file in the August 2015 release for things like reverse TAB number, average API of all horses in the race and maximum number of starts for all horses in the race. An up to date documentation on all columns plus a more general introduction to System Analyser can be found on our main site at:

http://www.capitalinfo.com.au/system-analyser.html

When running System Analyser there are new options for including or excluding criteria including the new report criteria, meeting criteria and race criteria. As a result you can view your report data analysis in System Analyser either as a separate analysis or bundled at the end of the existing System Analyser tables or just bundled with meeting and/or race analysis.

The first thing you will notice is a list box itemising all the criteria to be analysed. You can select and unselect what you want and even save your settings but the main change is that you will see a new "Add/select report criteria" button - it is enabled for single system/report tests and when available you can click it to add the report items at the end of the left hand list box.

Just click the new "Add/select report criteria" button and leave the other criteria ticked if you want everything analysed - the report items will appear at the end of the analyser report. If you only want the report items to appear in analyser then click as above and then follow up by clicking the "select report items only" button (note this button only enables after you use the "add/select report criteria" button).

Note there are new buttons for adding meetings/race info to get shorter analyser reports without all the horse details. These are useful if you just want to quickly analyse meeting and/or race details but can also be used after clicking "select report items only" if you want your report items analysed along with meeting and/or race details but without all the other horse details. Note also you have to add/select report items each time you analyse a report test as these items are not saved (you can save the main criteria selections for future use but they are not saved separately for separate systems and you must load them back in as the default is to analyse everything).

New in the System Analyser report, you will see the Expert Mode codes for all criteria listed at the end of the headings in brackets. Note these also appear in the list box mentioned above.

Finally there is a clever new “Edit Report/Calc” button at the top of the System Selector window (next to the Expert Mode check box). It gives you quick access to any report (or calc) file that may be attached to your system (it only shows in Expert Mode and only enables for systems with reports or MyCalcs).

Monday, 9 December 2013

Testing Jockeys and Trainers

To test for jockeys and/or trainers you use the respective variables from the Horse Data drop down, namely H:JOCKEY and H:TRAINER.

If you know the exact jockey names you want you can test for it as follows:

Alltrim(H:JOCKEY)$"N Rawiller,T Berry,J Bowman"

Note the Alltrim() function is used to trim trailing spaces from the jockey name to make for easier comparisons (otherwise you would have to add spaces to the jockey names to make then exactly 16 characters long - this is the length they are stored in the data files).

If you use Race TAB Live to update jockey names then they will end up in upper case in which case the rule will have to be modified as follows:

Upper(Alltrim(H:JOCKEY))$"N RAWILLER, T BERRY,J BOWMAN"

Keep in mind it only takes the initials to be slightly different for the above test to fall over so if you are concerned about the TAB sometimes using different initials then you will need to test for both variations. Alternatively you could just test for surnames as follows:

"RAWILLER"$Upper(H:JOCKEY).OR."BERRY"$Upper(H:JOCKEY).OR."BOWMAN"$Upper(H:JOCKEY)

The only problem with the above is that is will pick both "N Rawiller" and "B Rawiller" so testing for all possible name variations as mentioned earlier is the best approach.

All the above examples work the same way for trainers using the H:TRAINER variable although there is no need to use the Upper function to convert names to upper case.

Here's an example of a test for trainers using their exact names:

Alltrim(H:TRAINER)$"Peter Snowden,C J Waller,P G Moody"

Note the Alltrim() function is used to trim trailing spaces from the trainer name to make for easier comparisons (otherwise you would have to add spaces to the trainer names to make then exactly 25 characters long - this is the length they are stored in the data files).

Note that some trainers are listed with full first names and others with just initials. And some have one initial and others two initials. The only good news is that whatever name a trainer has in the form it usually does not change - so just make sure you check the exact spelling in the form and use it accordingly in your tests.

If you just wanted to test for surnames then you could use the following:

"Snowden"$H:TRAINER.OR."Waller"$H:TRAINER.OR."Moody"$H:TRAINER

Now we will take a quick look at jockey and trainer combinations. For example the following will test for N Rawiller as the jockey and C J Waller as the trainer:

Alltrim(H:JOCKEY)=="N Rawiller".AND.Alltrim(H:TRAINER)=="C J Waller"

Note you could remove the .AND. and place the jockey and trainer parts of the above rule on two separate lines as two rules.

Finally you may want to select horses where the jockey this time around is the same as the jockey for the last start. The following rule will test for this:

H:JOCKEY==F:JOCKEY

Note the above should be run in conjunction with a rule to ensure first starters are eliminated as testing for last start data when there is none can lead to first starters being included as selections when they shouldn't be.

Sunday, 8 December 2013

True/False and Yes/No Data

In addition to numeric and character string data, there are also variables that are set to one of two opposites, namely True or False or Yes or No.

The variables set to Yes or No are actually one character variables with the values of either "Y" for Yes or "N" for No. Examples of these from the Horse Data drop down are H:DOK for "distance okay" and H:FOK for "first up okay". To test these we need a rule that returns TRUE in the event of a "Y" and FALSE otherwise. The rules to do this are as follows:

H:DOK=="Y"

H:FOK=="Y"

Note the double equals sign which tests for exactly equal to.

There are also variables in the System Selector Data drop down that equate to TRUE or FALSE, namely HOME, SAME and LSFAV. These are for "home track", "same track as last start" and "last start favourite". Since these already equate to TRUE or FALSE using them in rules simply requires them to be listed on a line by themselves with no need for any separators or comparisons.

You may be wondering why there is no variable for the old "metrop last start" rule. The reason for this is that there is a variable in the Last Start Data drop down called F:M. This variable is set to the letter "M" if the last start is on a metropolitan track so the rule to test for "metrop last start" is as follows:

Upper(F:M)=="M"

Note this variable is also set to "P" if the last start was on a provincial track so the following rule will test for "provincial last start":

Upper(F:M)=="P"

There are a few other Y/N variables in the Horse Data drop down like "improver okay" and "winning form okay which relate to Peter Bent's form analysis methods as described at:

http://www.capitalinfo.com.au/peter-bent-form-analysis.html

There are also Y/N variables for Tote Pro exotic standouts but it is unlikely you will use these in systems.

Finally there is a Y/N flag for "Active" races. Few users will use this but if you do set certain races to non-active then you can exclude them in system tests using the following:

R:ACTIVE==”Y”

Note the above returns TRUE if the active flag is set to Y, otherwise it returns FALSE.