PropFirm Drawdown Guard and 1 Click Risk Panel
- Utilità
- Versione: 1.0
- Attivazioni: 5
Prop-Firm Drawdown Guard & 1-Click Risk Execution Panel for MetaTrader 5
PropFirm Drawdown Guard and 1 Click Risk Panel is a self-contained MetaTrader 5 utility built for discretionary traders, funded account evaluations, and prop-firm challenge risk management. Every calculation, chart panel interaction, Auto Break-Even adjustment, ATR trailing step, and drawdown circuit breaker runs natively in pure MQL5 with zero external DLLs, zero WebRequests, and zero external configuration files.
Designed to pair seamlessly with manual trading workflows or automated strategies such as our companion system Adaptive MultiAgent Quant EA (MQL5 Market Product ID 208752), this utility combines a real-time position sizing calculator, instant 1-Click execution, automated trade protection, and a two-tier Prop-Firm Drawdown Guard inside one compact, customizable on-chart interface.
Key Capabilities
- Interactive On-Chart Risk & Execution HUD ( PFRP_HUD_ ): Clean dark-mode chart dashboard with configurable corner placement, pixel offsets, and full color customization. Retains active mode and target values seamlessly across timeframe switches ( REASON_CHARTCHANGE ) and removes all chart objects and indicator handles cleanly upon removal.
- Three 1-Click Risk Sizing Modes: Cycle directly on the chart between % Equity Risk (default 1.0% ), Fixed Cash Risk ($), and Fixed Lots, with ergonomic + / - adjustment buttons — no EA restart or parameter dialog required.
- Volatility ATR & Fixed-Points SL/TP Calculator: Switch instantly between volatility-scaled ATR(14) multiples (default 1.5x ATR Stop-Loss and 2.5x ATR Take-Profit) and fixed symbol Points across Forex Majors, Gold ( XAUUSD ), JPY Crosses, and Indices.
- Live Pre-Trade Lot, Margin & R:R Preview: Before clicking BUY or SELL , inspect exact MathFloor -normalized lot size, spread-inclusive cash exposure ( sl_dist + current_spread ), free-margin cap via OrderCalcMargin() , spread in points, and projected Reward-to-Risk ratio.
- Two-Tier Prop-Firm Drawdown Guard:
- Daily Loss Limit ( Inp_MaxDailyLossPct , default 4.0% ): Anchored to broker server midnight ( TimeCurrent() ), resetting automatically on the next trading day.
- Maximum Total Drawdown ( Inp_MaxTotalDDPct , default 8.0% ): Trails account Equity High-Water Mark continuously. Set either threshold to <= 0.0 to disable individually (cleanly displays OFF in the HUD).
- Real-Time Headroom Telemetry & Status Badges: Live percentage and currency buffer display with automatic SAFE , WARNING (at >= 70% limit usage), and GUARD LOCKED states.
- Emergency Breach Protocol: Upon breach, immediately closes open positions via dynamic broker filling mode detection ( FOK / IOC / RETURN ), cancels resting pending orders, and locks panel entries until the next server day or manual RESET GUARD .
- 1-Click Action Buttons & Flexible Scope:
- BUY / SELL: Opens instant market orders with hard broker-side Stop-Loss and Take-Profit from the first tick.
- BE ALL: Moves profitable open positions to Break-Even (+ spread safety buffer) while verifying broker stops and freeze distances.
- CLOSE ALL: Closes open trades and removes pending orders within your active scope (toggleable directly on the chart between Scope: SYMBOL and Scope: ACCOUNT , and filterable via Inp_MagicFilter ).
- Automated Trade Management (Auto-BE & ATR Trailing): Optionally manages manual panel trades or third-party EA positions ( Inp_MagicFilter = -1 for all positions on the chart symbol, or a specific MagicNumber): triggers Auto Break-Even at Inp_BE_TriggerATR with configurable positive offset ( Inp_BE_OffsetATR ), followed by continuous ATR trailing ( Inp_TrailStartATR / Inp_TrailDistATR ) pre-verified with OrderCheck(TRADE_ACTION_SLTP) .
Execution Safety & Broker Compliance
- Non-Martingale / Non-Grid Discipline: Calculates single-position risk strictly from stop distance, tick size, and tick value ( SYMBOL_TRADE_TICK_VALUE_LOSS ), rounded downward via MathFloor to SYMBOL_VOLUME_STEP .
- Margin & Netting Volume Protection: Validates free margin with OrderCalcMargin() (including automatic volume step-down scaling) and respects aggregate symbol exposure limits ( SYMBOL_VOLUME_LIMIT ) across both hedging and netting accounts.
- Stops, Freeze & Rollover Session Guard: Enforces broker SYMBOL_TRADE_STOPS_LEVEL , SYMBOL_TRADE_FREEZE_LEVEL , and SymbolInfoSessionTrade() checks prior to entries, modifications, and closes — preventing rollover rejections such as Gold ( XAUUSD ) daily session breaks.
- Strategy Tester Validation Safeguard: Inside MQL_TESTER mode only, executes one clean validation lifecycle (entry, Break-Even modify, and close) to verify execution under automated validation checks. On live and demo charts ( !MQL_TESTER ), orders are executed strictly on user button click or guard breach protection.
Input Parameters Reference
- 1. Risk & SL/TP Calculator:
- Inp_RiskMode (default RISK_MODE_PCT_EQUITY ) — Initial risk sizing mode ( % Equity , Fixed Cash , or Fixed Lots ).
- Inp_RiskPercent (default 1.0 ) — Percentage of equity risked per trade.
- Inp_FixedCashRisk (default 100.0 ) — Fixed monetary risk per trade in account currency.
- Inp_FixedLots (default 0.10 ) — Fixed lot volume when Fixed Lots mode is active.
- Inp_SLTP_Mode (default SLTP_MODE_ATR ) — Distance calculator mode ( ATR-Based or Fixed Points ).
- Inp_ATR_Period (default 14 ) — ATR period used for calculator distances, Auto-BE, and trailing stops.
- Inp_DefaultSL_ATR / Inp_DefaultTP_ATR (defaults 1.5 / 2.5 ) — Stop-Loss and Take-Profit multipliers in ATR mode.
- Inp_DefaultSL_Points / Inp_DefaultTP_Points (defaults 300 / 500 ) — Stop-Loss and Take-Profit distances in Fixed Points mode.
- 2. Prop-Firm Drawdown Guard:
- Inp_MaxDailyLossPct (default 4.0 ) — Maximum daily drawdown (%) from server-day start equity (set <= 0 to disable).
- Inp_MaxTotalDDPct (default 8.0 ) — Maximum total drawdown (%) from equity high-water mark (set <= 0 to disable).
- Inp_CloseAllAccountWide (default false ) — Default scope for guard liquidation, CLOSE ALL , and BE ALL ( false = symbol only, true = entire account).
- 3. Auto Trade Management (BE & ATR Trailing):
- Inp_AutoManageTrades (default true ) — Enables automatic Break-Even and ATR trailing stop logic.
- Inp_MagicFilter (default -1 ) — MagicNumber filter ( -1 manages all positions on the chart symbol; >= 0 targets a specific MagicNumber).
- Inp_BE_TriggerATR / Inp_BE_OffsetATR (defaults 1.0 / 0.15 ) — Profit threshold and positive lock-in offset (in ATR) for Auto-BE.
- Inp_TrailStartATR / Inp_TrailDistATR (defaults 1.5 / 1.0 ) — Profit threshold to activate continuous trailing and trailing offset in ATR.
- 4. Execution & System:
- Inp_MagicNumber (default 260201 ) — Unique MagicNumber stamped on panel orders.
- Inp_DeviationPoints (default 30 ) — Maximum allowed execution slippage in points.
- Inp_OrderComment (default "PFRP_v1" ) — Custom broker comment attached to panel trades.
- 5. HUD Layout & Color Scheme:
- Inp_ShowHUD (default true ) — Toggles the on-chart panel display.
- Inp_PanelCorner , Inp_PanelX , Inp_PanelY — Chart anchor corner and X/Y pixel offsets.
- Inp_BgColor , Inp_CardColor , Inp_BorderColor , Inp_TextColor , Inp_AccentColor , Inp_BuyBtnColor , Inp_SellBtnColor — Full UI palette controls.
Recommended Usage & Risk Disclaimer
Attach the utility directly to any active chart window ( M15 , H1 , or your preferred execution timeframe) with Algo Trading enabled in MetaTrader 5 so 1-Click buttons, Auto-BE/Trailing, and the Drawdown Guard execute without interruption. Trading leveraged CFDs, Forex, and Gold carries substantial financial risk. Always verify your broker contract specifications, spread conditions, and drawdown thresholds thoroughly on a demo account before deploying live or prop-firm evaluation capital.
