In general, this is a very cool strategy and I hope that you will continue to do so, because it is very difficult to give up greed. I try to keep myself in check, especially in situations when I lose.
The control of greed starts with self-determination and control. If you are the type that doesn't easily maintain the decision you have set for yourself, it will be hard to overcome your greed in terms of gambling.
Not only when you are losing to the system, but even when you are winning a few games, your greed can blindly move you to either increase your bet amount per game or not know when to stop until you have completely blown up your account.
Basically, greed will occur when you are in a winning streak, because when you win it is very possible for you to continue betting because of greed until you finally lose everything. But, if you are in a losing position and continue betting, then I think it is not about greed but about not having self-control, so you think about chasing a loss that is basically very difficult to achieve and will still lose in the end.
Therefore, the title of this thread has at least said everything for you to stop gambling when you win. Because in a winning situation there will always be an assumption that you are in a good moment to get even greater profits but unfortunately, this is not the right thing to do because you can also be disappointed because the victory that has been obtained can turn into a defeat too.