Trade manager · MT5

XAGUSD Trailing TP SL

by flowmar47

This MetaTrader 5 expert advisor manages manual silver (XAGUSD) positions by applying and dynamically trailing protection levels.

GitHub stars1
Forks0
Last update11 months ago22 Nov 2025
LicenceNone stated

Overview

XAGUSD Trailing TP SL automatically adds initial stop loss and take profit orders to existing trades that lack them. The manager features a sophisticated trailing stop loss and a trailing take profit mechanism that extends targets during strong market moves. It utilizes the Average Directional Index (ADX) to identify trend strength and the Average True Range (ATR) for volatility-adjusted distances. Additional risk controls include a configurable break-even function and multiple extension limits.

Details

Author

flowmar47 on GitHub

Markets

Oil & commodities

Timeframes

Any timeframe

Risk Profile

No grid, martingale or hedging logic was found in its code or README. That says nothing about how it performs: backtest it first.

Input Parameters

Read from XAGUSD_TrailingTPSL.mq5. Defaults are the author's; change them in the EA's Inputs tab.

NameTypeDefaultDescription
InpSymbolstringXAGUSDSymbol to monitor
InpMagicNumberint0Magic number (0 = all manual trades)
InpCheckIntervalMsint500Check interval in milliseconds
InpApplyInitialSLTPbooltrueApply initial SL/TP if not set
InpInitialSLPipsdouble50.0Initial Stop Loss (in pips)
InpInitialTPPipsdouble100.0Initial Take Profit (in pips)
InpEnableTrailingSLbooltrueEnable Trailing Stop Loss
InpTrailingSLStartdouble20.0Start trailing after X pips profit
InpTrailingSLDistancedouble15.0Trailing SL distance (pips)
InpTrailingSLStepdouble5.0Minimum SL move step (pips)
InpUseATRForSLbooltrueUse ATR for dynamic SL distance
InpEnableTrailingTPbooltrueEnable Trailing Take Profit
Show all 26 inputs
NameTypeDefaultDescription
InpTPExtendThresholddouble30.0Extend TP after X pips in profit
InpTPExtendAmountdouble20.0Amount to extend TP (pips)
InpMaxTPExtensionsdouble5Maximum TP extensions allowed
InpUseATRForTPbooltrueUse ATR for dynamic TP extension
InpUseTrendFilterbooltrueOnly trail in strong trends
InpADXPeriodint14ADX Period
InpADXThresholddouble25.0ADX threshold for strong trend
InpStrongTrendADXdouble35.0ADX for very strong trend (aggressive trailing)
InpATRPeriodint14ATR Period
InpATRMultiplierSLdouble1.5ATR Multiplier for SL
InpATRMultiplierTPdouble2.5ATR Multiplier for TP
InpBreakEvenPipsdouble30.0Move SL to breakeven after X pips
InpBreakEvenOffsetdouble2.0Breakeven offset (pips in profit)
InpEnableBreakEvenbooltrueEnable breakeven feature

How to Install It

  1. 1Download the sourceUse "Download source (.zip)" above, or clone flowmar47/MT5TPSLEA from GitHub, and unzip it.
  2. 2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL5/Experts.
  3. 3Copy the filesCopy the .mq5 file into Experts.
  4. 4Compile in MetaEditorOpen the file in MetaEditor and press Compile. Fix any missing includes the compiler reports.
  5. 5Test before you tradeRun it in the Strategy Tester, then attach it to a demo chart and allow algorithmic trading.
Third-party code. ForexR did not write, test or endorse this EA, and the summary above was generated automatically from its README and code. ForexR lists only repositories with readable source code and never hosts files. Read the code, backtest it and use a demo account first; automated trading can lose money quickly.

Similar Expert Advisors

70 stars

This MetaTrader expert advisor functions as a trade manager that automates stop loss adjustments for existing positions. It specifically waits until a trade reaches a user-defined profit threshold in points before initiating a trailing stop. The tool includes flexible filtering options to manage specific symbols, magic

MT4MT5 Trade manager
Updated 5 months ago Apache-2.0 GitHub repository of Trailing Stop On Profit

Trader Pad

by erlonfs
20 stars

Trader Pad is a trade management utility for MetaTrader 5 designed to automate position exits and risk control after an entry is initiated. The software handles stop-loss and take-profit placement in ticks, providing advanced trailing stop logic and break-even functionality. It allows users to scale out of positions th

MT5 Trade manager
Updated 4 years ago MIT GitHub repository of Trader Pad

ATR Trailing Stop

by EarnForex
19 stars

This trade manager for MetaTrader 4 and 5 automatically adjusts the stop-loss levels of open positions using the Average True Range indicator. It allows users to define the trailing distance through a configurable ATR period and multiplier. The expert advisor includes filtering logic to apply the trailing stop only to

MT4MT5 Trade manager
Updated 7 months ago Apache-2.0 GitHub repository of ATR Trailing Stop

Smart Money Manager

by Royatvand
19 stars

Smart Money Manager is a trade-management panel for MetaTrader 5. It assists traders by calculating risk-based position sizing from balance, stop-loss distance, and tick value. Users place market and pending orders via a compact on-chart panel with drag-and-drop entry, SL, and TP lines that display lot size and money r

MT5 Trade manager

PSAR Trailing Stop

by EarnForex
16 stars

PSAR Trailing Stop is a management utility for MetaTrader 4 and 5 that automates the adjustment of stop-loss levels for open positions. Instead of manual movement, it follows the Parabolic SAR indicator values to lock in profits or minimize losses as a trend progresses. The software includes filtering options to target

MT4MT5 Trade manager
Updated 2 years ago Apache-2.0 GitHub repository of PSAR Trailing Stop

Fractals Trailing Stop

by EarnForex
15 stars

This expert advisor is a utility for MetaTrader 4 and MetaTrader 5 designed to manage stop-loss levels for existing trades. It utilizes Bill Williams' Fractals indicator to dynamically adjust the stop loss as new fractal points form on the chart. Users can configure the number of bars to scan and specify which fractal

MT4MT5 Trade manager
Updated 2 years ago Apache-2.0 GitHub repository of Fractals Trailing Stop

More trade managers

Related on ForexR

Need a Broker for MT5?

Compare regulated brokers that support MT5, with spreads, minimum deposits and leverage side by side.

Compare MT5 brokers