Tutorial: Using Custom Reports and Statistics

Frequently Asked Questions/Answers, Tutorials, and Common How To's

Moderator: Moderators

Constructing Column Expressions

Postby WhiteRider » Sun Nov 15, 2009 10:43 am

Constructing Column Expressions

This section will describe some of the common elements that make up an expression in a Column.
All of the elements described here can be extended and combined to give more complex expressions, should the Statistic that you are building need that.

Expressions can consist of database fields, functions and operators, including some PostgreSQL functions.

The best ways to explore the options are to examine existing columns' Expressions and to use the blue insert link above and to the right of the Expression field.

Simple Expressions

An Expression can be as simple as retrieving a single value from a field in the database.
For instance, in the Holdem Cash Hand section you might want a stat to display a checkbox to indicate whether or not the player limped preflop in a hand.
The expression for this would just be:

Because this is already a boolean (true/false) value we don't need to do anything else with it.

Similarly, you might want a stat to display the total amount the player bet in a hand.
The expression for this would be:


Use of 'IF'

The IF function is used to determine whether a condition is true or false, and return a different value based on the outcome.
The structure of the IF function is described above, but it is basically:

    IF[ expression, then, else ]
If the expression evaluates to true the then value is used, otherwise the else value is used.

For instance, if you want a stat in the Holdem Cash Hand section to show the size of a continuation bet on the flop but to show zero for non-continuation bets you could use an expression like this:

    if[ holdem_hand_player_statistics.flg_f_cbet, holdem_hand_player_detail.amt_f_bet_made, 0 ]
This expression says: if the player made a continuation bet (holdem_hand_player_statistics.flg_f_cbet is true) then return the size of the bet (holdem_hand_player_detail.amt_f_bet_made), else return 0.

The IF function is also commonly used in combination with SUM to generate a count of how many times a certain situation occurs across all hands - for instance in the Holdem Cash Player Statistics section.
I will describe the use of SUM next, but for now let's see how IF can be used to turn a boolean value into a 1 (true) or 0 (false).
Using the preflop limp example from above:

    if[ holdem_hand_player_statistics.flg_p_limp, 1, 0 ]
If the player limped preflop this returns a value of 1, else it returns 0.

So now let's move on to the SUM function to see how we can count the number of hands where the player limped preflop.

Use of 'SUM'

The SUM function is used to add up a set of values.
It is therefore only useful is sections where we are dealing with more than one item, such as Holdem Cash Player Statistics which generates statistics based on all of a player's hands.

Before we get back to counting the number of hands where a player limped preflop, here is a simple expression of the use of SUM.
To calculate the total amount of money a player bet across all hands, we could use an expression in the Holdem Cash Player Statistics section:

    sum( holdem_hand_player_detail.amt_bet_ttl )
This goes through every hand the player played and adds up the total amount bet in that hand.
Compare that with the expression we saw in the Simple Expressions section above which just retrieved the amount bet in a single hand, and which would be used in the Holdem Cash Hand section.

Combining SUM and IF

So now we know how to use SUM and IF we can combine them to write a column expression to count the number of times a player limped preflop.
Again, this would be in the Holdem Cash Player Statistics section:

    sum( if[holdem_hand_player_statistics.flg_p_limp, 1, 0] )
For each hand the IF statement returns a 1 if the player limped and a 0 if they did not.
The SUM statement then adds up these 1s and 0s to give us a count.

Nested IFs

You can combine IF statements if you have more than 2 outcomes to generate.
As a simple example let's say we want a column to determine whether the player bet more or less than the pot size on the flop or didn't bet at all, which gives us 3 outcomes. You would normally do this sort of thing in the Format Expression of the Statistic, rather than in the Column itself, but it should illustrate the point..

    if[ holdem_hand_player_detail.val_f_bet_made_pct = 0, 'Did not bet', if[ holdem_hand_player_detail.val_f_bet_made_pct > 100, 'Bet more than the pot', 'Bet less than the pot' ] ]

Mathematical Operators

You can use the normal mathematical operators in expressions:

    + - / * = < > >= <=
    != (not equal: <> also works)
For example if we want to check whether the player bet more than the size of the pot (as in the Nested IFs example) we could use:
    holdem_hand_player_detail.val_f_bet_made_pct > 100
There are also several other operators which are useful from time to time. Here are a few which may be useful, please see the documentation linked below for a complete list:

    % - modulo (remainder) 5 % 4 = 1
    ^ - exponentiation (power) 2 ^ 3 = 8
    abs - absolute value. abs(-5) = 5
    round - round to the nearest integer (whole number) round(42.7) = 43; or you can specify the number of decimal places: round( 66.66666, 2 ) = 66.67
    trunc - truncate towards zero. trunc(42.7) = 42; or you can specify the number of decimal places: trunc( 66.666666, 1 ) = 66.6
For a full list please see the PostgreSQL Documentation.

Boolean Operators

You can use the normal boolean operators in expressions:

For instance, to see if a player made a continuation bet on the flop and turn we could use the expression:

    holdem_hand_player_statistics.flg_f_cbet AND holdem_hand_player_statistics.flg_t_cbet
To see if they c-bet the flop but not the turn we could use:

    holdem_hand_player_statistics.flg_f_cbet AND NOT holdem_hand_player_statistics.flg_t_cbet
To see if a player made a normal bet on the flop or the turn we could use:

    holdem_hand_player_statistics.flg_f_bet OR holdem_hand_player_statistics.flg_t_bet
PostgreSQL documentation.

Operator precedence

Normal operator precedence applies in expressions in PT3.
Some operators have higher precedence than others so will always be calculated first, regardless of the order they are written in.
For example:

    2 + 3 * 4 = 14
This is because multiplication has higher precedence than addition. If you want to multiply 2 + 3 by 4, you need to write (2 + 3) * 4.
Brackets over-ride precendence, and you should use them to clarify exactly what you are trying to do.

  • 2 + 3 * 4 = 14
    (2 + 3) * 4 = 20
  • 5 + 4 / 2 + 1 = 5 + (4 / 2) + 1 = 8
    (5 + 4) / (2 + 1) = 3
See Table 4-1. Operator Precedence at the bottom of this page for a full list of the order operators are applied in, but when in doubt please use brackets.

For example, if you want to see if a player bet the flop and then bet the turn or river, you could use:

    holdem_hand_player_statistics.flg_f_bet AND (holdem_hand_player_statistics.flg_t_bet OR holdem_hand_player_statistics.flg_r_bet)
"holdem_hand_player_statistics.flg_f_bet AND holdem_hand_player_statistics.flg_t_bet OR holdem_hand_player_statistics.flg_r_bet" would not give us what we want.

If you want to see whether a player bet and then folded on the flop, or bet and then folded on the turn, you could use:

    (holdem_hand_player_statistics.flg_f_bet AND holdem_hand_player_statistics.flg_f_fold) OR (holdem_hand_player_statistics.flg_t_bet AND holdem_hand_player_statistics.flg_t_fold)
Again, the brackets are needed to make sure we get the result we want.

String Expressions and Functions

The PT3 database contains some string (text) fields, and these can be read and analysed in Column Expressions.
Some typical string fields are:
  • Player names - player.player_name
  • Limit names - holdem_limit.limit_name
  • Player actions by street - lookup_actions_p.action (see below)
  • Player action in specific situations - holdem_hand_player_statistics.enum_f_cbet_action (the action a player took when facing a flop continuation bet)
  • Street on which something occurred - holdem_hand_player_statistics.enum_allin (the street on which a player went all-in)

Player actions are the most commonly used of these, so I'll describe them in more detail, and use them for the examples here.
Every action is represented by a single uppercase letter.
X = Check, F = Fold, C = Call, B = Bet, R = Raise

The enum_ fields consist of a single character; either one of the above action characters or a character to represent a street, depending on the type of field.
P = Preflop, F = Flop, T = Turn, R = River, N = None (e.g. if the player did not go all in then holdem_hand_player_statistics.enum_allin = 'N')

The player actions by street strings (like lookup_actions_p.action) consist of a series of characters to represent all of a player's actions on a single street.
For example, if a player limps then folds to a raise preflop the action string would be 'CF'.
If they check-raised the flop then called a 3-bet their action string would be 'XRC'.

Exact string comparisons

We can compare whole strings using the normal = operator.
For example, if we want to see if a player's only action preflop was to call we could use:

    lookup_actions_p.action = 'C'
    Tip! Strings are always written inside single quote marks like this.
If instead of just calling once, the player called and then faced a raise and called again then their action string would be 'CC' and lookup_actions_p.action = 'C' would be false.

To check just certain parts of a string we need to use Pattern Matching functions.

Pattern Matching string comparisons - LIKE

To compare just part of a string the normal = operator does not work, as mentioned above.
If we want to check whether the player's first action preflop was to call, but we don't care what they did after that, then we could use the LIKE function:

    lookup_actions_p.action LIKE 'C%'
This expression compares the player's preflop action string (lookup_actions_p.action) with the actions we're interested in - in this case a call ('C') followed by any other actions, including no action ('%').

The % is a token which makes up part of a pattern. % specifically represents any (zero or more) characters, which can be anything.
If we want to check for the player calling and then making exactly one more action (but we don't care what that second action is) then we would use the _ (underscore) token which represents exactly one character, which can be anything.

    lookup_actions_p.action LIKE 'C_'
We can also combine tokens:

    lookup_actions_p.action LIKE 'C_%'
..would match any action string which starts with a call and has at least one more action (e.g. 'CF', 'CC', 'CCF', 'CRC', etc.), but would NOT match just a call ('C').

You can use these tokens at any point in the string, so you could check for a player being the preflop aggressor by checking for their preflop action string ending with a raise:

    lookup_actions_p.action LIKE '%R'
As another example, you could check whether the hand was played at a 6-max table like this:

    holdem_limit.limit_name LIKE '%(6 max)'
LIKE is pretty good for this sort of thing, and can be used for virtually all cases, but there are some comparisons which can be simplified by using another pattern matching function; SIMILAR TO.
This gets a bit more complicated now, so if you find LIKE confusing enough, you might want to skip the next section for now..

Pattern Matching string comparisons - SIMILAR TO

If we want to check for a player's action when facing a flop bet being a call, but we don't care whether they checked before that or not (i.e. whether the call is made in or out of position) or what actions, if any, they made after calling we could do this with LIKE, but we would need two checks, like this: lookup_actions_f.action LIKE 'C%' OR lookup_actions_f.action LIKE 'XC%'

Alternatively we could use a single SIMILAR TO expression:

    lookup_actions_f.action SIMILAR TO '(X|XC)%'
The brackets define a separate part of the pattern, and the | means 'OR', so this expression matches any string which starts with 'X' OR 'XC' and then has zero or more characters after that.

Please see the PostgreSQL documentation on Pattern Matching for more information.


Another way of working with strings is the SUBSTRING function.
This allows you to access any part of a string - its format is this:

    SUBSTRING( string FROM x FOR y )
This returns y characters, starting from character number x.
    SUBSTRING( 'abcdefg' from 2 for 3 ) = 'bcd'
This can be used to compare strings, for instance to see if the first two preflop actions were both calls you could use:

    SUBSTRING( lookup_actions_p.action from 1 for 2 ) = 'CC'
This checks whether 1 character, starting from the first character, is 'C'; in the same way that you could use lookup_actions_p.action LIKE 'C%'.

In general LIKE is easier to use than SUBSTRING for comparisons, but SUBSTRING can also be used to return part of a string.
For instance, if you want to retrieve the first character of a limit name to display the currency you could use:

    SUBSTRING( holdem_limit.limit_name from 1 for 1 )
Posts: 53761
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Statistic creation - Walkthrough

Postby WhiteRider » Wed Nov 18, 2009 9:50 am

Statistic creation - Walkthrough


This post will walk you through the creation of a custom statistic, step by step.
This is a text-only version - there is a version with screenshots here.

As an example, the stat I will build here is a typical stat in the Holdem Cash Player Statistics section which can be used in reports or the Heads Up Display (HUD).
It is an example of the most common type of HUD statistic - the percentage of times which a player made a certain action when they had the opportunity to do so.

Here, we're looking at the percentage of times a player folded to a raise after they limped (called the big blind amount) preflop and then faced a raise.

    Preflop Limp Fold = ( number of times limped then folded preflop / number of times limped then faced a raise preflop ) * 100
We ignore times that there was no raise because the player then would not have an opportunity to fold.
I'm also not going to differentiate between facing a single raise or a 3- or 4-bet. For the sake of simplicity we will treat all raises in the same way.

If you have been given a column expression in the forum or a support ticket to help you build your own statistic you can follow this guide and replace the expressions I give here with the ones you have been given.
I will highlight the places where you should enter the expression(s) you have been given like this.

Similarly, if you want to build your own stat you can follow these basic steps and replace the expressions with your own.

Basic structure of the Statistic

To calculate the value of our statistic we need to build two Columns - one to count actions (how often they folded after limping) and one to count opportunities (how often they faced a raise after limping, giving them an opportunity to fold):

  • cnt_p_limp_fold will count the number of times that the player limped and then folded.
  • cnt_p_limp_face_raise will count the number of times that the player limped and then faced a raise.
We then build our stat from the two columns like this:

    Preflop Limp Fold = ( cnt_p_limp_fold / cnt_p_limp_face_raise ) * 100
For example, of all the times a player limped preflop they faced a raise afterwards 10 times and of those 10 they folded 7 times, then that would be (7 / 10) * 100 = 70%.

For more information about the general structure of Statistics, and how they interact with Columns, please read How Statistics are structured, earlier in this tutorial.

Since the statistic is built from columns we need to build the columns first, so let's get started.

First we need to open the Custom Statistics window from the PokerTracker 3 menu: Configure > Configure Stats.
We are going to build our stat in the Holdem Cash Player Statistics section, so select that in the list on the Sections tab.

Building the 'action count' column - cnt_p_limp_fold

Once you have selected the Holdem Cash Player Statistics section click on the Columns tab then click the New button to create a new empty Column.
Enter the name of your column in the Name field - I'm creating cnt_p_limp_fold first.

Now we need to enter the Expression, which is where the work is done.

If you have been given a colum expression in the forums then you can just copy and paste the text of it here, and skip to the end of this section to enter the Description. You'll want to click Validate to make sure the expression is correct, though - if it isn't you might need to recreate it by following the steps below.

You can just type your expression into the Expression field if you know exactly what you want, but the best way to make sure you construct it correctly is to use the blue Insert link, and that is what I'll use here.
Once you get used to building expressions and know the common elements you'll probably use a combination of Insert and typing.
For more information on the building blocks of expressions, see Constructing Column Expressions earlier in this tutorial.

Since our column needs to count up the number of times the player did something, we need to start with the SUM function.
Click Insert and select the Functions tab.
Scroll down to find the Sum function. Select it and click OK.
This will take you back to the main Column tab and your expression will now look like this:

    sum( expr )
Now we need to replace 'expr' with the next part of the expression, which is an IF statement to determine whether or not the condition we're looking for is true.
Highlight the 'expr' part of the expression and click Insert again, so that whatever we insert will replace 'expr'.
On the Insert window select the Functions tab again, but this time select If/Then/Else and click OK.
You should now see this in the Expression field:

    sum( if[ expr , a , b ] )
Now we need to enter the expression part of the IF statement, to check that the player limped and then folded.
We insert the two conditions separately.
First we'll insert the database field which indicates whether or not the player limped, which is holdem_hand _player_statistics.flg_p_limp.
Highlight 'expr' again, and click Insert.
On the Database Fields tab find and select holdem_hand _player_statistics in the Table Name list on the left, then on the right find and select flg_p_limp in the Field Name list, and click OK. (You can click the column header to sort the list alphabetically.)
Your expression should now look like this:

    sum( if[ holdem_hand _player_statistics.flg_p_limp, a, b ] )
We're going to check another condition as well, and we need to check that both are true, so type AND after the database field we just inserted, so that it looks like this:

    sum( if[ holdem_hand _player_statistics.flg_p_limp AND , a, b ] )
Put a space after the AND as well, and leave the cursor just before the comma then click Insert again so that we can add the next part of the expression.
This time we're going to check for the player folding after limping. The best way to do this is by seeing if their preflop actions were exactly call then fold, which means that their action string would be 'CF'.
Find the preflop action string in the Database Fields tab of the Insert window. The Table Name is lookup_actions_p and the Field Name is action so select that and click OK.
The expression should now look like this:

    sum( if[ holdem_hand _player_statistics.flg_p_limp AND lookup_actions_p.action, a, b ] )
To see if the actions were call then fold enter = 'CF' after the action field we just inserted so that the expression looks like this:

    sum( if[ holdem_hand _player_statistics.flg_p_limp AND lookup_actions_p.action = 'CF', a, b ] )
To complete the expression we now need to replace 'a' with 1 and 'b' with 0 so that the IF statement will return 1 if both conditions are true and 0 if either is false, allowing the SUM function to add up the 1s and 0s to give a count.

The final expression should now look like this:

    sum( if[ holdem_hand _player_statistics.flg_p_limp AND lookup_actions_p.action = 'CF', 1, 0 ] )
To complete the Statistic enter a Description - I'm entering "The number of times the player limped and then folded preflop."

The Group By option should be unchecked, and the Summary Type should be set to Sum.

Building the 'opportunities count' column - cnt_p_limp_face_raise

We now need to build the opportunities column in the same way - this time the final expression is:

    sum( if[ holdem_hand_player_statistics.flg_p_limp AND holdem_hand_player_statistics.flg_p_face_raise, 1, 0] )
And my description is: "The number of times the player limped and then faced a raise preflop."

You can either insert the building blocks of the expression as we did for cnt_p_limp_fold, or you can just type (or copy & paste) the final expression.

Remember to click Save.

If you are building a typical percentage type stat from an expression given to you in the forums you may just be given a single column expression - this will normally be the 'actions' column which we added first. In this case you will still need to create the 'opportunities' column as we're doing here.
You can work out what this is based on the actions column - the expression will normally be pretty similar, in most cases you just need to remove the action part, but sometimes you'll need to add some other check in its place as we do in this example.

Building the Statistic

Now that we have both of our columns we can build the Statistic.

If you are building a 'normal' percentage stat from column expressions given to you in the forums then you will build the Statistic using the method described here.
If the stat is of a different type, then you'll need to change the Value Expression and possibly Format Expression too, but in that case you will probably have been given these expressions too.

Click on the Statistics tab then click New to create a new empty Statistic.

Starting on the Definition tab, enter the name of your Statistic in the Name field - I'm calling mine "Preflop Limp Fold" - and give it a Description - mine is "How often the player folded preflop after limping".

Next we enter the Value Expression - this is the real value of the statistic.
Click the blue Insert link and on the Columns tab choose the 'actions' column that you just created (cnt_p_limp_fold) and click OK.

We need to divide the number of limp/fold actions (cnt_p_limp_fold) by the number of limp/fold opportunities (cnt_p_limp_face_raise) so add a space, a division sign, and another space after cnt_p_limp_fold, so that the Value Expression now looks like this:

    cnt_p_limp_fold /
Position the cursor at the end of the expression and click Insert again.
This time select cnt_p_limp_face_raise from the Columns tab and click OK.

The Value Expression we now have:

    cnt_p_limp_fold / cnt_p_limp_face_raise
..would give us a value between zero and one - to turn this into a percentage we need to multiply this by 100.
To make sure the calculations are done in the right order put brackets round what we already have, then add a space, a multiplication sign, a space, and the number 100 to the end, so that you end up with this:

    (cnt_p_limp_fold / cnt_p_limp_face_raise) * 100
    Note: When creating percentage stats, the Value Expression needs to be in exactly this format for the Show Times/Opportunities HUD Statistic Property to work correctly.

To determine how the stat is displayed, we now move on to the Format tab.

Title defines the header for the Statistic's column in a report, so I'm going to call mine "Limp/Fold", and give it a Width of 60 so that it knows how wide its column should be when added to a report.
If you do not enter values here the stat will not work in reports.
Since it is a numeric value, we'll leave it right aligned (so that in a report the numbers will line up to the right hand side).

The Format Expression field defines how the stat will appear in reports and the HUD, and the Format Summary Expression field defines how the summary row in reports will appear.
There are many ways to format stats (as described earier in this tutorial) but since this is a simple numeric stat we can just display it to 2 decimal places, so enter this in both the Format Expression and Format Summary Expression fields:

The stat will now work (once it is saved and applied) but we can make it easier to find when adding to reports or the HUD by assigning it to the correct Categories.

Click the Categories tab, select the appropriate categories and use the arrows in the middle to add (or remove) them to the Assigned list.
Preflop Limp/Fold is in the following categories:

  • Actions
  • Passiveness
  • Street - Preflop

Should you wish to add color ranges to your stat you can do so on the Colors tab, but I'm not going to do that here, so our stat is finished.

Click the Save button to store the stat - you can now move on to add other stats.

When you have finished you MUST click the Apply button in order for the changes to take effect and for the new Statistic to be available in reports and the HUD. (Just clicking 'Save' isn't enough.)

If the HUD is currently running you'll need to stop it before the new stat is available in the HUD configuration.
Posts: 53761
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Converting a Statistic to another Section

Postby WhiteRider » Fri Mar 26, 2010 10:00 am

How To: Convert a Statistic to another Section

If you have a statistic for one game type that you'd like to use for another game type you can convert it using the Convert To option on the Statistics tab.
For instance, if you want to use the "Preflop Limp Fold" Holdem Cash Player Statistics stat from the previous post for holdem tournaments you could convert it to the Holdem Tournament Player Statistics section, like this:


Select the section you want to convert to from the dropdown list and then click the Convert To button.

You can convert a stat to the relevant section of any of the other 3 game types, but not to a different type of section.
For instance, you can convert a stat from Holdem Cash Hands to Holdem Tournament Hands, Omaha Cash Hands or Omaha Tournament Hands, but not to Omaha Cash Player Statistics or Holdem Cash Sessions.
Posts: 53761
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

How To: Make a New Version of a Statistic

Postby WhiteRider » Mon May 17, 2010 6:52 am

How To: Make a New Version of a Statistic

This post explains how to make a new version of an existing statistic by duplicating it and changing the copy.

When making a copy of a statistic we first have to make copies of any columns that the stat uses. The columns are where most of the work is done, so if you are given an example of how to change a stat the expressions you will be given will probably be the new column expressions you need to use.
These expressions will usually be an adaption of the column expressions from the stat you are going to copy.
You should always give your new columns new names rather than overwriting the existing columns - see "Naming conventions" in How Columns are built.

I will give you a walkthrough with screenshots to illustrate the process, but first here are a few examples.

Column Examples

1. Making a positional version of a stat

    To make a version of a stat for a single position you need to add a check for the player's position to the column expressions.
    For instance, to make a version of cnt_p_3bet (which counts the number of times the player 3 bets preflop) for the button position only you would change the column name and expression from:

    cnt_p_3bet =
      sum(if[holdem_hand_player_statistics.flg_p_3bet, 1, 0])
    cnt_p_3bet_btn =
      sum(if[holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.position = 0, 1, 0])
    See below for the full walkthrough of this stat update.

2. Changing the street of a stat

    To adapt a column to count things from a different street you would change from this:

    cnt_p_3bet_btn =
      sum(if[holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.position = 0, 1, 0])

    cnt_f_3bet =
      sum(if[holdem_hand_player_statistics.flg_f_3bet AND holdem_hand_player_statistics.position = 0, 1, 0])
    Sometimes a column would need more changes to work for another street, for instance if actions on previous streets affect the count.

Once you have created your new columns you can duplicate the existing Statistic and change the copy's Value Expression to use the new columns. For instance you might create a new stat based on:

3Bet Preflop =
    (cnt_p_3bet / cnt_p_3bet_opp) * 100
..to this:

3Bet Preflop Button =
    (cnt_p_3bet_btn / cnt_p_3bet_btn_opp) * 100

Walkthrough with pictures

As an example I'll show you how to create a positional version of the stat "3Bet Preflop" for the button position.

Open the Configure Statistics window from the PT3 menu Configure > Configure Stats and select Holdem Cash Player Statistics on the Sections tab.
If you want to adapt an Omaha or Tournament stat then select the appropriate "Player Statistics" section.

section HCPS.png

Click the Statistics tab and select "3Bet Preflop" from the list of Existing Stats.

The Value Expression field on the right shows which Columns the stat uses.

stat Value Expression.png

For the stat "3Bet Preflop" these are "cnt_p_3bet" and "cnt_p_3bet_opp".
These columns count how often the player 3-bet preflop and the number of opportunities they had to 3-bet preflop. To build a version of this stat for the button position only we need to make new versions of those columns which we can then use in a new version of this stat.

Make a note of the column names and then click the Columns tab and select the first column ("cnt_p_3bet") from the list of Existing Columns.
To make a copy of the column click the Dup ("Duplicate") button.

3bet - dup.png

We now have a copy of the column which we can change to fit our needs.
Change the Name to "cnt_p_3bet_btn". (additions in bold)

In this case we want to count only the times that the player was on the button (position 0) when they 3-bet, so we change the Expression to this:
sum(if[holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.position = 0, 1, 0])

Finally update the Description:
Number of times player 3 bet preflop from the button.


    Tip! Positions are defined by the number of seats away from the button, so the button is position 0 and the cutoff is position 1, etc. The big blind is always position 8, and the small blind position 9, regardless of table size so that you can easily identify the blind positions.
We now need to repeat this process for the other column: "cnt_p_3bet_opp". Select and Duplicate the column then make the changes like this:
Name = cnt_p_3bet_btn_opp
Expression = sum(if[holdem_hand_player_statistics.flg_p_3bet_opp AND holdem_hand_player_statistics.position = 0, 1, 0])
Description = Number of times player had the opportunity to 3 bet preflop from the button.


Now that we have our two new columns we can make our new stat, so click the Statistics tab again - "3Bet Preflop" should still be selected (if not then reselect it) - and then click the Dup button to make a copy of it.

We need to change the Name of the new stat ("3Bet Preflop Btn") and Description ("Preflop 3Bet Percentage from the button") and then alter the Value Expression to use the new columns we just created:
(cnt_p_3bet_btn / cnt_p_3bet_btn) * 100

stat updated.png

We should also update the Format tab - the only change needed here is in the Title field, but if the Format Expression used column names then that would need to be changed too - and the Categories tab - here we just add the Position category.

format.png (9.26 KiB) Viewed 19317 times

cats.png (10.98 KiB) Viewed 19331 times
Posts: 53761
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Using Live HUD Stats

Postby WhiteRider » Thu Aug 19, 2010 6:00 am

Using Live HUD Stats

v3.07.3 Beta introduces "Live" HUD stats to PT3.

Download page
PT3 Build History / Release Notes

This gives access to information from the end of the previous hand, and up to the last 10 hands, at the current table.
This allows stats like:

  • Stack size and Tournament "M"
  • Average pot size and average players seeing the flop (from up to the last 10 hands)
  • Winners of the last 10 hands, with pot size and rake

Built-in Stats

v3.07.3 has a few built-in stats which use this new mechanism.
These are available for all game types:

  • Table - Average Pot
  • Table - Average Stack
  • Table - Players per Flop
  • Table - Prior Hand 1 - Winner
  • Table - Prior Hand 1 - Pot
    (There are 5 prior hands built-in and up to 10 previous hands can be created.)
  • M [tournament only]

Building Custom Stats

It is possible to build your own custom stats in the same way.
This mechanism uses some new functions to access the information - it is not stored in the database so we do not use columns to access it.

The functions can be used either in Variables or directly in Statistics. In most cases it will be neater to use Variables as this means that the Variable can be used in multiple stats without the complication of the function calls.
There are several Variables built in which use the functions, and these are labelled var_live_xyz.

    Tip! In all cases below; when you specify a stat name you must include the name in single quotes, exactly as in the examples.
The functions are:

  • live_table_stat( stat )

      stat can be:

    • 'amt_ante' - the ante amount
    • 'amt_bb' - the big blind amount
    • 'amt_sb' - the small blind amount
    • 'avg_stack' - the average stack at the table
    • 'cnt_history' - the number of hands in the live history (max 10). See 'live_table_history_stat' below.
    • 'cnt_players' - the number of players

      Example: live_table_stat( 'amt_bb' )
      (the big blind amount in the previous hand)

      Note: All values are taken from the end of the previous hand, so in a tournament they will be wrong for the first hand in each new blind level.

  • live_player_stat( player, stat )

      stat can be:

    • 'amt_before' - the stack size at the start of the last hand
    • 'amt_stack' - the stack size at the end of the hand
    • 'amt_won' - the amount the player won or lost in the last hand

      player is the text name of the player, and will nearly always use the existing column "str_player_name".

      Example: live_player_stat( str_player_name, 'amt_won' )
      (the amount this player won or lost in the previous hand)

  • live_table_history_stat( stat, index )

      stat can be:

    • 'amt_won' - total pot size (inc. rake)
    • 'amt_rake' - rake taken
    • 'cnt_saw_flop - the number of players who saw the flop
    • 'winner' - the winner of the hand, or "[Split]".
    • 'cnt_players' - the number of players in the hand

      index is the index of the hand. The last hand is 0, the hand before that is 1, up to a maximum of 10 tables where the index of the oldest is 9.

      Example: live_table_history_stat( 'winner', 0 )
      (the winner of the previous hand)

Custom Stat Example

As an example, this is how I built a "Stack in BB" stat in the Holdem Cash Player Statistics section.

To calculate stack in BB we need to divide the stack size by the size of the big blind so first I built a Variable to hold each of those values.
In the custom stats window select the Holdem Cash Player Statistics section and go to the Variables tab.
(These Variables already exist in the tournament sections as they are used in the M stat.)

Click New and give the variable a name, let's start with "var_live_amt_bb".
Enter the Expression: live_table_stat( 'amt_bb' )
Add a Description too: "The BB amount in the previous hand at this table".

Add the second Variable in the same way: "var_live_amt_stack" with Expression: live_player_stat( str_player_name, 'amt_stack' ) and Description "The player's stack at the end of the previous hand".

Now that we have both the Variables that we need we can build the stat.
Go to the Statistics tab and click New.

Give your stat a Name, such as "Stack in BB", and a Description.
Enter the Value Expression using the new Variables: var_live_amt_stack / var_live_amt_bb

Although these stats won't work in reports (only the HUD) it is always a good idea to fill in the Format tab too.

Click Apply to save your stat.
If the HUD is running you will need to stop the Auto Import before your new stat is available to add to the HUD.

A version of the "Stack in BB" the stat is available for download from this post.
Posts: 53761
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK


Return to FAQs, Tutorials, and How To's [Read Only]

Who is online

Users browsing this forum: No registered users and 1 guest