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

Order Escort - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resources

author EAcpu | 5 reads | 0 comments |

Order Escort - expert for MetaTrader 5

In many cases, static stops and take profits are not enough because it is not known how long the trend will last, but the nature of the trend and price changes is known. A simple trailing stop is not always appropriate as it does not take into account the nature of future price changes.

If the price is expected to grow linearly, we need to track the position along a price channel bounded by two straight lines. As long as the trend exists, positions should be tracked. Once the price moves out of the channel, the position must be closed because the current trend has ended. The Expert Advisor moves the Stop Loss and Take Profit of each bar along a trend line drawn with a specific slope. In this case, on each new bar, the stop loss order will be placed at the border of the channel.

To be able to determine the trend line and its angle, we need to set the target using two coordinates - the offset from the current position (set as the number of bars) and the change relative to the current price (in points). The EA then determines that the trend line is a straight line passing through the target and current coordinates, finds the channel border and starts tracking the position.

Order Escort - expert for MetaTrader 5

In some cases, sharp exponential price increases are expected. In this case, we need to choose a suitable curve to track and set a target. The EA will determine the trailing curve starting from the current coordinates and passing through the target. Thereafter, Stop Loss and Take Profit move along the specific index. In this case, the stop loss order moves relatively slowly at first, but increases in speed as you get closer to your target.

If the price growth rate is expected to saturate, it is best to use a curve like y=xˆ1/2 (power function) as the trailing curve. Any curve of the form y=x^n can be used, and the exponent can be greater or less than 1, or negative. Setting up the trailing curve is done the same way. For the y=xˆ1/2 curve, Stop Loss and Take Profit move quickly from the beginning but decrease in speed as you get closer to the target.

The EA also provides the option to close the position after n bars.

Please note that the Expert Advisor does not open positions or set stop losses and take profits. It only tracks open positions by moving the initial stop loss order.


Attachment download

📎 order_escort.mq5 (12.07 KB)

Source: MQL5 #17539

Verification code Refresh