Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

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

author EAcpu | 3 reads | 0 comments |

TrailingStop - expert for MetaTrader 5

TrailingStop - expert for MetaTrader 5

TrailingStop - expert for MetaTrader 5

TrailingStop - expert for MetaTrader 5

TrailingStop - expert for MetaTrader 5

TrailingStop - expert for MetaTrader 5

This is a simple Expert Advisor with an implemented trailing stop.

It has only two parameters:

TrailingStop - expert for MetaTrader 5

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:

TrailingStop - expert for MetaTrader 5

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

TrailingStop - expert for MetaTrader 5

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:

TrailingStop - expert for MetaTrader 5

Then move the stop to Bid minus TrailingStop:

TrailingStop - expert for MetaTrader 5

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

TrailingStop - expert for MetaTrader 5


Attachment download

📎 trailingstop.mq5 (13.88 KB)

Source: MQL5 #17263

Verification code Refresh