TrailingStop - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resources






This is a simple Expert Advisor with an implemented trailing stop.
It has only two parameters:

TrailingStop — distance between price and stop loss level.
TrailingStep — prevents positions from being modified frequently.
How TrailingStop works - Example of a long position:
The stop loss of the original position is zero, we wait until the following conditions are met
— That is, when Bid minus TrailingStop is greater than the opening price PriceOpen:

Stop loss is moved to PriceOpen level (position price):

Now, when a position has a stop loss (i.e. when the stop loss is not equal to 0), wait for the following conditions to be met:
— That is, when Bid minus TrailingStop minus TrailingStep is greater than StopLoss price: So here we need to additionally check TrailingStep — This can prevent position modifications at each quote:

Then move the stop to Bid minus TrailingStop:

That's why we need protection in the form of TrailingStep:

Attachment download
📎 trailingstop.mq5 (13.88 KB)
Source: MQL5 #17263
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •