You exit a trade when you feel it has reached the point of profit you’re seeking from that particular trade. Apply strong risk management techniques and set a target profit so you won’t have to deal with loss later.
Each trade has a percentage point where it reaches a certain level of profit, if it matches your goal, it’s okay to exit. However, this depends majorly on every individual's specific game plan and time frame they choose to trade with.