but when is the best time to stop gambling and take a break?
1-when you lose?
2- when you win?
It will be foolish to take a break from gambling when you win, the only issue here is when the gambler continues to gamble due to overconfidence and greed, then it's time to take a break. But there is no problem if he has a plan and sticks to it, winning should never be the barrier. However, such a gambler is not taking the break because of the "win" but for the emotion that has taken hold of him.
As for losing, it's better you also take a break if you are becoming increasingly desperate to gamble, especially if it has turned into a revenge quest that has led to addiction.