Navigation:  How To >

See performance enhanced by a stable change

Print this Topic Previous pageReturn to chapter overviewNext page

The following table shows the structure of a view for displaying:

1.the date on which the stable of a horse changes
2.the WQP statistics of a horse before stable change
3.the WQP statistics of a horse after stable change

 

View: Stable Change

Heading

User-Defined MCL Function

Type (Chars)

Horse

(Built-In Item: Horse Name)

 

Old Stable Date

HrDate(1, [For Not ]+Same('HrStableID( )'))

Date

Before Stable Change

HrWQPStat(,'For HrDate( )<='+Qstr(Column('Old Stable Date')),.Null.)

Character (23)

After Stable Change

HrWQPStat(,'While HrDate( )>'+Qstr(Column('Old Stable Date')),.Null.)

Character (23)

 

Apply the view to the 6th race on 1 May 2005, the following result will be shown. The statistical figures show that, in this race, there are performance gains after the horses were moved into new stables.

 

The following paragraphs will explain what are shown in the view, how this view is constructed, and some useful technical tips. The content is deliberately structured so that it will be understood by users with little MCL experience. Even if you are an intermediate to advanced level MCL user, you will find some of the information useful. If you have no knowledge or experience on how to create a starter views, you may find the topic Creating a Starter View helpful.

 

Find the Date of a Particular Start

To find the date of a particular start, we use the HrDate( ) function. When no argument is passed, the function will return the date of the viewing race. Passing an argument 1 into the function, i.e., HrDate(1), it will return the date of the horses' last start. Passing 2, i.e., HrDate(2), the function will return the date of the start prior to the last start, and so on. We can also specify a filter condition by passing an expression to the 2nd argument. For example, the following function will return the date of the last winning start of a horse:

HrDate(1, [For HrFp( )=1])

 

The first argument of the function above indicates we want the last start. However it is not an ordinary "last", but the last start satisfying the condition specified by the 2nd argument "For HrFp( )=1". Since HrFp( ) returns the finishing position of the horse, thus, the date of the last winning start will be returned.

We may put the above functions into a view to see the results. Please make sure "Date" type is selected for the columns as show in the following figure:

 

Apply the view to the 6th race of the meeting on 1 May 2005. We will see the following result:

In the figure above, we see that the latest start (relative to the viewing race on 1/5) of the horse Easy Game was on 13 Apr 2005 and it was the winning horse of that race.

 

Date on Which a Horse was in Its Old Stable

To show the trainer of a horse, we use the MCL function HrStable( ). Suppose the trainer of a horse in the viewing race is "A S Cruz". We can use the following function to find when the horse was still trained by its prior trainer:

HrDate(1, [For Not HrStable( )='A S Cruz'])

 

However, since almost all horses are in different stables, we may not hard-code the stable name into our functions as shown in the above line. To solve this problem, we may use the magic function Same( ) and rewrite the above line as:

HrDate(1, [For Not ]+Same('HrStable( )'))

 

Same('HrStable( )') is actually an abbreviation of [HrStable( )=]+Qstr(HrStable( )). When the trainer of a horse in the viewing race is A S Cruz, Same('HrStable( )') will be expanded to [HrStable( )='A S Cruz'] before processing. Similarly, if the trainer of the horse is T W Leung, Same('HrStable( )') will be expanded to [HrStable( )='T W Leung'].

 

WPQ Statistics

The MCL function HrWQPStat( ) gives us the WQP statistics. We may specify a filter condition in the 2nd argument. For example, to find the WQP statistics for turf tracks, we write:

HrWQPStat( ,[For HrIsTurf( )])

 

To find the WQP statistics in other tracks, we write:

HrWQPStat( ,[For Not HrIsTurf( )])

 

In order to compare the performance of the horses before and after a particular date, say 1/1/2005, we may use the following functions:

HrWQPStat( ,[For HrDate( )>={^2005/1/1}])        && WQP stat after 1/1/2005

HrWQPStat( ,[For Not HrDate( )<{^2005/1/1}])     && WQP stat before 1/1/2005

 

There may be some horses that arrived after 1/1/2005. The statistical figures returned by the functions will all be zero. In order to clearly show the difference between no winning (zero) and condition not applicable, we can give a default value .NULL. to the 3rd argument of the functions making the function return .NULL. for the horses for which the condition is not applicable, as shown in the following examples:

HrWQPStat( ,[For HrDate( )>={^2005/1/1}],.Null.)      && WQP stat after 1/1/2005

HrWQPStat( ,[For Not HrDate( )<{^2005/1/1}],.Null.)   && WQP stat before 1/1/2005

 

 

Comparing Performance Difference Before and After a Stable Change

Putting the above basic knowledge all together, it will not be difficult for us to create a view to show the performance difference before and after a stable change. The structure of the view is listed as follows:

Heading

User-Defined MCL Function

Type (Chars)

Horse

(Built-In Item)

 

Old Stable Date

HrDate(1, [For Not ]+Same('HrStable( )'))

Date

Before Stable Change

HrWQPStat(,'For HrDate( )<='+Qstr(Column('Old Stable Date')),.Null.)

Character (23)

After Stable Change

HrWQPStat(,'For HrDate( )>'+Qstr(Column('Old Stable Date')),.Null.)

Character (23)

 

 

Using "While" to Make a View Faster

In order to make the view show up faster, we can replace the keyword "For" with "While" in the condition expression of the "After Stable Change" column (but not the "Before Stable Change" column). The difference between the keywords is:

Using For, RaceMate will scan all past starts to find the ones which satisfy the condition.
Using While, RaceMate will start from the latest start and scan the past starts one by one. Once a start which does not satisfy the condition is found, the scanning action will stop immediately and the older starts won't be touched anymore.

 

When we are doing the "After Stable Change" statistics, the races belong to the old stable is not application. Therefore using while will significantly increase the statistical speed.

 

HrStableID( ) Against HrStable( )

The HrStableID( ) function returns a 2-char ID of a stable, which is faster, language independent, and more accurate than using the full name. When we do statistics, comparing an ID is always preferable to comparing a name. Therefore another enhancement to the view is to change the HrStable( ) function to HrStable( ).

 

After making the above improvements to the view, the view becomes:

Heading

User-Defined MCL Function

Type (Chars)

Horse

(Built-In Item)

 

Old Stable Date

HrDate(1, [For Not ]+Same('HrStableID( )'))

Date

Before Stable Change

HrWQPStat(,'For HrDate( )<='+Qstr(Column('Old Stable Date')),.Null.)

Character (23)

After Stable Change

HrWQPStat(,'While HrDate( )>'+Qstr(Column('Old Stable Date')),.Null.)

Character (23)

 

Enhancing the View According to Your Need

You may add more filtering conditions and columns to the view according to your needs. For example, if you are only interested in the horses which change stable during the past 12 months, your may change of condition of the "Old Stable Date" column to:

HrDate(1, [While HrDaysAgo( )<=365 For Not ]+Same('HrStable( )'))

 

 


Page url: http://www.racematenet.com/english/help/index.html?see_performance_enhanced_by_a_stable_change.htm