I need that when the system is in maxprofit and an operation fails, the following operations are with half the money, until the system exceeds the maxprofit again