In your script the rules are indeed affected by stop and takeprofit. So you have a case 3 here. The question is only if this generates a good model.

In our experience, a machine learning model usually deteriorates with the complexity of the objective. The best models use 0, the price difference, or the price sign for the objective. The "bad" system of your question 2 is in fact one of the best.