Easy, it's time to stop when you win or loss too much but even if you do know about it. It's hard to stop the feeling even if you know it will cause no good. Having a limit in win and loss is good but much better if you can control your emotions because if not you will exceed or break the limit you've set. Feeling confident on win and frustrated on loss, both is hard to control.
I like the part of you adding winning too much. We actually concentrate more on losing too much than winning too much maybe because most people have never experienced a huge win in gambling anyway, which I am not surprised.
As much as you have a limit and once you hit that limit in losses, you call it a day, is the same way we should always be able to put a huge full stop when you hit a big amount already, but greed most of the time always make some people to want to keep trying more until they still end up losing everything.
Greed is the actual culprit for people unable to stop. The greed starts from expecting too much than normal from gambling. Just like you painted it by stating profit, a lot of people consider gambling as a way to invest their money and that is more like the most stupid level of thinking I can ever imagine. It is not hard to apply, as long as you believe gambling is not out to give you anything positive most of the time, you will always know when to stop and not to expect too much from it, otherwise you will be soaked in debt before you even know it.