Skip to content
Forex Indicator System Thailand
Back to marketplace
UtilityUtility

Trailing Stop on Profit

Starts trailing the stop-loss only after a position reaches a set profit in points; toggled by a chart button

Download this EA for free

Download right away. Nothing to fill in.

Version
1.04
Published
11/21/2026
File size
78 KB

Open source, Apache License 2.0, by EarnForex.com. See licences

Version history

  1. 1.04Current11/21/2026 · 78 KB

    First release on this site.

How to use

Install the EA in MetaTrader 5 and drag it onto a chart, turn Algo Trading on, and press the panel button to enable it (or set EnableTrailingParam = true). Set Profit (points of profit needed before trailing starts) and TrailingStop (SL distance from price), both in points of each symbol's price.

OnlyCurrentSymbol is on by default; if you turn it off, positions on every symbol are touched. Use UseMagic and UseComment to separate other EAs' positions or manual trades. Be careful with DisableTPonTSL, which removes the take-profit of qualifying positions.

Try it on a demo account before real use.

Parameters

NameDefaultDescription
TrailingStop50Distance of the stop-loss from the current price once trailing is active, in points.
Profit100Minimum position profit, in points, needed before the SL starts trailing.
DisableTPonTSLfalseWhether to remove the position's take-profit when trailing kicks in.
OnlyCurrentSymboltrueManage only positions of the chart symbol the EA is attached to. If turned off, positions on every symbol in the account are touched.
OnlyTypeAllWhich position types to manage: all, Buy only or Sell only.
UseMagicfalseFilter by magic number. Turn on to manage only the positions of one particular EA.
MagicNumber0Magic number to filter by (used only when UseMagic is on).
UseCommentfalseFilter by position comment.
CommentFilterText that must appear in the position comment (used only when UseComment is on).
EnableTrailingParamfalseStart with trailing enabled. Off by default; it can be toggled with the chart button.
EnableNotifyfalseMaster switch for notifications when the EA modifies a position. It must be on for the channels below to work.
SendAlerttrueShow a pop-up Alert in MetaTrader.
SendApptrueSend a push notification to the MetaTrader mobile app (the MetaQuotes ID must be set in the terminal).
SendEmailtrueSend an e-mail notification (e-mail must be configured in the terminal).
ShowPaneltrueShow the on-chart panel, which holds the button that enables or disables the EA.
ExpertNameTSOPName used as a prefix for chart objects and in notification texts.
Xoff20Horizontal offset of the control panel from the chart corner, in pixels.
Yoff20Vertical offset of the control panel from the chart corner, in pixels.
ChartCornerCORNER_LEFT_UPPERChart corner where the control panel is anchored.
FontSize10Font size of the control panel.
ShowPotentialSLLinesfalseDraw the SL level the EA would set for each position on the chart.
PotentialSLBuyColorclrDodgerBlueColour of the prospective SL line for Buy positions.
PotentialSLSellColorclrOrangeRedColour of the prospective SL line for Sell positions.
PotentialSLStyleSTYLE_DOTLine style of the prospective SL lines.
PotentialSLWidth1Width of the prospective SL lines.
PotentialSLLabelFontSize8Font size of the prospective SL line labels.
ShowActivationLinesfalseDraw the price level at which trailing becomes active for each position.
ActivationBuyColorclrDarkGrayColour of the activation line for Buy positions.
ActivationSellColorclrDarkSlateGrayColour of the activation line for Sell positions.
ActivationStyleSTYLE_DASHLine style of the activation lines.
ActivationWidth1Width of the activation lines.
ActivationFontSize8Font size of the activation line labels.

Defaults are the values shipped with the EA, not a recommendation. Results depend on the market and on each account. Past results do not guarantee future results. Trading carries a high risk of loss.

How to install

  1. Download the .ex5 file.
  2. In MT5, choose File > Open Data Folder.
  3. Copy the file into the MQL5\Experts folder.
  4. Right-click Expert Advisors in the Navigator window and choose Refresh (or restart MT5).
  5. Drag it onto a chart, adjust the Inputs, turn on Allow Algo Trading, then click OK.

Description

A utility EA that trails the stop-loss of open positions behind the price, but only once a position is at least Profit points in profit. When that threshold is met, the EA places the SL TrailingStop points away from the current price (Bid for a Buy, Ask for a Sell) and keeps moving it only when price moves in the profitable direction.

An option cancels the position's take-profit when trailing kicks in (DisableTPonTSL). Filters by symbol, type, magic number and comment choose which positions are managed, and you can draw the prospective SL levels and the activation levels on the chart.

The EA does not open trades. It starts disabled by default; a button on the chart panel switches it on and off. It can notify through Alert, push and e-mail when an SL is moved.

Banners from the Exness partner programme

Exness banner: gold spreads*

FXIDTH is an independent IB partner of Exness. This channel is not owned or operated by Exness.*Spreads may fluctuate and widen due to factors including market volatility, news events, market open/close, and others.*Processing times may vary depending on the chosen payment method.