It is not an easy task because as human nature, however, we can try it with several tips.
-Build a good mindset, loss is sometimes inevitable, and want or not must accept it, if you feel emotion after loss, close the chart and take a cup of coffee or something else to build positive views.
-Plan the trade and trade a plan, think about the risk first, limit the risk level to 2%, and focus on entries to get the best price, profit is a bonus from discipline.
-Avoid fear of missing out, don't chase the rally price, and wait on the good zone.
-Scheduled trading, let's say one day only open two orders and then stop trade if already done and wait the next day market again.
-Discipline as a habit, Discipline may not guarantee success, however all successful people most of them work fully disciplined.