SL and TP are two most important things in a trade.
If you have SL and TP correct, you have a set and forget trade.
You should develop a trading system that has SL and TP correct 80% of the time.
If you can develop such a trading algorithm you have a winning system.
Read this post in which I explain how to code SL and TP in MQL5.
MQL5 has many limitations when it comes to developing trading algorithms.
There is no machine learning and deep learning libraries in MQL5.
You will have to connect MQL5 with Python, R or Java.
Without doing it you will never be able to develop powerful trading strategies.