Hello! Yes, your formula is correct:
Selection's Trigger Expression IF(test_mode = 1, test_balance, balance) is equal to IF(test_mode = 1, test_funds, total_funds)
A simpler way to check if you have any bets placed in any of your markets (although they must be loaded into the program) is to check the allbets_num variable:
Selection's Trigger Expression allbets_num is equal to 0