βš™οΈ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

Last updated