This post is an extended version of the Statistic creation - Walkthrough post in the Tutorial: Using Custom Reports and Statistics. For more information on custom statistics and reports please refer to that tutorial.
Here I will walk you through the creation of a custom statistic in detail, with screenshots.
I have also added a new walkthrough tutorial if you have been given column expressions in a forum post or support ticket - click 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
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 or see this new tutorial which just has the steps needed to paste in the column expressions.
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.
- Preflop Limp Fold = ( cnt_p_limp_fold / cnt_p_limp_face_raise ) * 100
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 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 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:
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 ] )
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 ] )
- sum( if[ holdem_hand _player_statistics.flg_p_limp AND , a, b ] )
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 ] )
- sum( if[ holdem_hand _player_statistics.flg_p_limp AND lookup_actions_p.action = 'CF', a, b ] )
- Tip! For more information on action strings and the 1, 0 part of the IF statement see Constructing Column Expressions earlier in this tutorial.
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 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] )
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 /
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
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 (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:
- 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.