Ok, so
this guide for the basics on custom statistics creation and
this guide for a deeper walkthrough. The latter was written for PT3 but the techniques all apply to PT4, the interface is just slightly different.
You can also look at the definitions of existing statistics - and steal pieces of them to use for your own. For example the numerator of donk flop is cnt_f_donk - you can just steal that entire code:
sum(if[cash_hand_player_statistics.flg_p_face_raise AND NOT (cash_hand_player_statistics.flg_p_3bet OR cash_hand_player_statistics.flg_p_4bet) AND cash_hand_player_statistics.flg_f_bet AND NOT (cash_hand_player_statistics.flg_f_cbet_opp) AND ((cash_hand_summary.cnt_players > 2 AND cash_hand_player_statistics.val_p_raise_aggressor_pos < cash_hand_player_statistics.position) or (cash_hand_summary.cnt_players = 2 and cash_hand_player_statistics.flg_blind_b)), 1, 0])
and add in that a player checked the turn on top of it, addition in bold:
sum(if[cash_hand_player_statistics.flg_p_face_raise AND NOT (cash_hand_player_statistics.flg_p_3bet OR cash_hand_player_statistics.flg_p_4bet) AND cash_hand_player_statistics.flg_f_bet AND NOT (cash_hand_player_statistics.flg_f_cbet_opp) AND ((cash_hand_summary.cnt_players > 2 AND cash_hand_player_statistics.val_p_raise_aggressor_pos < cash_hand_player_statistics.position) or (cash_hand_summary.cnt_players = 2 and cash_hand_player_statistics.flg_blind_b))
and cash_hand_player_statistics.flg_t_check, 1, 0])
It's really just a matter of putting together the pieces. That your action was bet then call on the flop can be written as:
lookup_actions_f.action = 'BC' and you can do turn action of check/fold as lookup_action_t.action = 'XF'. So instead of just using flg_t_check as above you could instead do:
sum(if[cash_hand_player_statistics.flg_p_face_raise AND NOT (cash_hand_player_statistics.flg_p_3bet OR cash_hand_player_statistics.flg_p_4bet) AND cash_hand_player_statistics.flg_f_bet AND NOT (cash_hand_player_statistics.flg_f_cbet_opp) AND ((cash_hand_summary.cnt_players > 2 AND cash_hand_player_statistics.val_p_raise_aggressor_pos < cash_hand_player_statistics.position) or (cash_hand_summary.cnt_players = 2 and cash_hand_player_statistics.flg_blind_b)) and lookup_actions_f.action = 'BC' and lookup_action_t.action = 'XF', 1, 0])
and have your numerator.