Statistic Creation Walkthrough

PokerTracker 3 version 3.10
October 25, 2013
  • Introduction

    This tutorial is a walkthough of how to create a custom statistic.

    Please read the Tutorial: Using Custom Reports and Statistics for more information on custom statistics and reports.

    Here I will walk you through the creation of a custom statistic in detail, with screenshots.

    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 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 column 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.

    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:


    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 (as shown above) 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.

    Tip! For more information on action strings and the 1, 0 part of the IF statement see Constructing Column Expressions earlier in this tutorial.

    The final expression should now look like this:


    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.

    Click the Save button to store the column.

  • Building 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:


    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 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.