Skip to content
All library documents

Manual MT5 Risk Panel with Daily Loss Lock and Stop Management

Article MQL5 code base

Summary

This document describes an educational MetaTrader 5 panel for manually entering trades on hedging accounts. A trader chooses BUY or SELL; the panel sizes positions by a configured percentage risk and submits a broker-side stop loss with an optional take-profit target. Entries can be blocked by a spread ceiling or a daily loss threshold, while break-even and trailing-stop rules manage positions tied to the chart symbol and configured magic number.

The daily calculation combines realized deal profit, swap, commission, and fees, with optional floating profit and loss. Its lock persists for the broker-server day through restarts, but cannot prevent entries made outside the panel. The document reports a clean local compilation, which does not establish runtime safety or profitability. It identifies limits including gaps, slippage, commissions excluded from sizing, broker constraints, disconnections, and additional exposure from repeated clicks. Demo testing is recommended; the example provides no performance evidence.

Key ideas

  • The panel is designed for manual trade entry on MT5 hedging accounts, not for generating signals.
  • Position sizing uses a configured percentage risk and rejects volume below the broker minimum.
  • A broker-server-day loss threshold can lock new panel entries, including after an EA restart.
  • Break-even and trailing-stop logic applies to positions matching the chart symbol and magic number.
  • Gaps, slippage, commissions, broker constraints, and disconnections can make actual outcomes differ from configured risk.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.