How long do I have to optimize a robot to make it profitable for years on MT4?

that is not possible! trading changes once a whole for example crypto was bullish currently and if your robot had been programmed to make long trades it was giving you win but latter when its bearish if the robot is selling thats more profitable. in general, the market changes a lot and the robot cannot be desigend to give u profit in all situations!