The best solution for me is to secure and withdraw the profits every time you win. No need to set a target on the amount of withdrawal, but as long as you make some gains, that's for you to keep and withdraw it so you can't gamble more, and leave some small funds that will serve as your capital the next time you decide to gamble.
For me that is the only thing that matters to me when playing, there is no other way, I personally respect a lot the decisions of other people when they are in a situation, they will see if they play and win leaving the money there, but for me it is important that it can be withdrawn because it is the way to bear our money, our effort, also from my own experience of sometimes leaving the money in the casino without withdrawing, well I have lost it all, because it is a temptation, let's say that we have money and we start to play and little by little we spend it all.