Skip to main content

⚙️ Trade Management Features

Trade Management Features

This page documents the main trade-management algorithms and how they are exposed in the UI and settings.

  1. Break-Even (BE)
  • Available Methods:
    • Disabled — Break-even feature turned off
    • Fixed Pips — Moves SL to breakeven after a fixed pip profit
    • R:R Based — Triggers based on risk-to-reward ratio
    • ATR Multiplier — Uses ATR indicator to determine trigger distance
  • Settings:
    • BreakEvenMethod — Choose which algorithm to use
    • BE_Value — Set the trigger distance (pips for Fixed, multiplier for ATR/Candle methods)
  • How to Use: Click "Move to BE" button on any trade panel, or enable automatic break-even in EA settings
  1. Partial Close (PC)
  • Available Methods:
    • Disabled — Partial close feature turned off
    • Fixed Pips — Closes percentage of position after fixed pip profit
    • R:R Based — Triggers based on risk-to-reward ratio
    • ATR Multiplier — Uses ATR indicator to determine trigger distance
  • Settings:
    • PartialCloseMethod — Choose which algorithm to use
    • PartialClosePercentage — Set what percentage to close (0.5 = 50%, 0.3 = 30%, etc.)
    • PC_Value — Set the trigger distance (pips for Fixed, multiplier for ATR/Candle methods)
  • How to Use: Click "Half-Close" button on any trade panel for instant partial close, or enable automatic partial close in EA settings
  1. Trailing Stop (TRAIL)
  • Mode: enum-based ENUM_TrailMethod with multiple strategies
  1. Trailing Stop (TRAIL)
  • Available Methods:
    • Disabled — Trailing stop turned off
    • Fixed Pips — Trails stop loss by fixed pip distance
    • ATR Multiplier — Uses ATR indicator for dynamic trailing distance
    • Candle-Based — Trails based on candle highs/lows
    • R:R Multiple — Trails based on risk-to-reward multiples
    • Moving Average — Trails stop loss using a moving average line
  • Settings:
    • TrailingMethod — Choose which trailing algorithm to use
    • Trail_ActivationValue — Set when trailing starts (profit distance in pips or multiplier)
    • Trail_DistanceValue — Set how far behind price the stop loss trails
    • TrailMinimumMovement — Minimum price movement before stop loss updates
    • TC_CandleBuffer — Buffer distance for candle-based trailing
  • How to Use: Click "Add Trail" button on any trade panel, or enable automatic trailing in EA settings
  • Mode: enum-based ENUM_LotMethod with three strategies
  1. Lot Sizing & Risk
  • Available Methods:
    • Risk Percent — Risk a percentage of your account balance per trade
    • Risk Amount — Risk a fixed dollar/currency amount per trade
    • Fixed Lot Size — Trade a fixed lot size regardless of risk
  • Settings:
    • LotMethod — Choose your preferred lot sizing method
    • RiskValue — Enter the value (% for Risk Percent, $ for Risk Amount, lots for Fixed Size)
    • AllowMultipleTrades — Enable or disable scaling into positions
    • MaxOpenTrades — Set maximum number of concurrent positions
    • UseStrictMarginRejection — Reject trades that exceed margin (true) or reduce lot size automatically (false)
  • How it Works: The EA calculates your lot size automatically based on your settings and displays it before executing manual orders
  • PreserveExistingSLTP: when enabled, manual actions will preserve existing SL/TP unless explicitly changed.
  • ForceOverrideSLTP: useful for immediate corrections in live-managed accounts.
  1. Trade Management Mode / Magic = 0
  • When Magic = 0 the Trade Manager will operate on manual or third-party trades. See trade-management-mode.md for details and edge cases.
  1. Session Close Behavior
  • Key Parameters (from Parameters.mqh):
    • bool CloseTradesAtSessionClose = false; — auto-close open trades when session ends
    • bool CancelPendingsAtSessionClose = false; — cancel pending orders at session close
  1. Session Close Behavior
  • Settings:
    • CloseTradesAtSessionClose — Automatically close all open trades when trading session ends
    • CancelPendingsAtSessionClose — Cancel pending orders at session close
    • UseTimeWindow — Master on/off switch for trading hours control
    • UseSession1 / UseSession2 — Enable dual trading sessions
    • Session timing with hour and minute precision (see trading-hours-and-filters.md for detailed setup)
  • How it Works: When your defined trading session ends, the EA can automatically close positions and cancel pending orders to avoid overnight risk or unwanted exposure

Code references: 8) Logging & Safety

  • Every trade management action is logged automatically
  • Errors and warnings appear in the MT4 Experts log tab
  • Built-in safety checks include:
    • Maximum daily drawdown limits
    • Minimum lot size enforcement
    • Slippage protection
    • Margin requirement validation