This may seem simple, but when playing in a cash game either at a casino or online, you should be able to tell when it is time to stop playing. When I play Texas Holdem and notice that I am starting to make poor decisions, that is usually the time for me to either get up and clear my head or just get up and leave. (Of course if you are in a tournament, you are going to have to tough it out and just play tighter).
You do not want to stay in a game when your not playing your best game. You should never consider staying in just to get even if you happen to have had losses. As Mike Caro would say, “you are always even”.
How can you tell that you are not playing your best game? Perhaps you are staying in almost every hand? Perhaps your starting cards are a little ambitious such as playing 2 4 off suit in first position. In any case, if you are not playing your best game, you stand to lose a good part of your stack and even a good part of your bankroll if you are not careful.
Remember, there are always going to be more days to play when you are rested and more clear headed.