That is the problem of learning algorithms: You need some classification criteria. In the examples, timed exits are normally used. So the criteria is just the profit at a certain time after entry. But you can also do it the other way around. If you have a fixed entry condition, you can use the same advise functions for generating exit rules. I only see no practical method for generating entry and exit rules separately from each other.