Specifiche
PROJECT TITLE: MT5 Semi-Auto EA - Dynamic Volume Exhaustion & Time-Delayed Entry (UI Panel)
1. GENERAL OVERVIEW
· Platform: MetaTrader 5 (MT5). Must enforce Hedging account. The EA must check ACCOUNT_MARGIN_MODE at OnInit and refuse to load if placed on a Netting account.
· Symbol: Any (Dynamic based on the active chart via _Symbol). I will trade both XAUUSD (Mon-Fri) and BTCUSD (24/7 including weekends). The EA must handle weekend data and timer logic flawlessly.
· Language Requirement: English strictly for both source code and UI.
· Timeframe: Adjustable via Inputs. EA must calculate all logic based ONLY on the timeframe selected in the settings.
· Core Strategy: Dynamic volume drop tracking, instant position exit, and a 50% time-delayed Limit Entry based on intra-candle dynamic High/Low.
2. ON-CHART UI & STATE PERSISTENCE (CRUCIAL) Custom UI Panel drawn on the chart. It must include:
· HUD - ACCOUNT & PROFIT DASHBOARD: A clean, real-time display at the top of the panel showing:
1. Account Balance
2. Total Floating P/L (Currency/USD)
3. Total Floating P/L (%)
· Button 1 - "ON / OFF BOT" (Green = ON, Red = OFF).
· Button 2 - "PANIC CLOSE ALL": With a Yes/No confirmation dialog. If "Yes", it unconditionally closes ALL open positions and pending orders for that symbol (completely ignoring all checkbox exclusions).
· Checkbox 1 - "Auto Stop Loss" & Checkbox 2 - "Auto Take Profit": Apply Input % to new trades if checked.
· Panel 3 - "ORDER MANAGEMENT PANEL": A visual table listing every currently open order with a Checkbox next to each.
o Logic: If checked, the EA COMPLETELY IGNORES that specific position (no automated SL/TP, no automated exits). Unticked orders remain managed.
o State Persistence (Mandatory): I turn my PC/MT5 off daily. The ticked/unticked state of each position, as well as the running High/Low data mid-candle, MUST survive terminal restarts and timeframe changes using Persistent Storage (e.g., GlobalVariables or file-backed storage).
3. INPUT PARAMETERS
· Operation Mode: ["Full Auto" / "Manage Manual Only"]
· Calculation Timeframe: [ENUM_TIMEFRAMES]
· Lot Size: [Default: 0.1]
· Stop Loss (% of Entry) & Take Profit (% of Entry): Computed strictly from the limit price (MidPrice), not the market price at placement time.
· Enable Hard Take Profit: [True/False]
· Hard Take Profit Price: [Default: 0.0] (Logic: Close absolutely EVERYTHING when Bid/Ask price reaches this exact level. Note: EA should only act on a fresh crossing after initialization to avoid unexpected mass closures upon startup).
· Volume Drop Threshold (%): [Default: 30] ((V_Prev - V_Closed) / V_Prev) * 100. (I will optimize this dynamically for XAU vs BTC).
· MidPrice Unreachable Action: [Dropdown: Skip / Market / Stop Order]. Default: Skip. (Determines the EA's action if the market price has already passed the calculated MidPrice, making a Limit order invalid).
4. CORE LOGIC: EXHAUSTION & TIME-DELAYED LIMIT ENTRY Let C_Closed be the most recently closed candle. Let C_Prev be the candle before it. Let C_Current be the currently forming candle. (Max 1 automated open trade or pending order at a time).
A. THE TRIGGER & FLAT STATE DIRECTION
· Condition: Tick Volume of C_Closed drops by at least [Volume Drop Threshold %] compared to C_Prev.
· Direction Logic:
o If holding a BUY -> Trigger SELL setup.
o If holding a SELL -> Trigger BUY setup.
o If Flat (No positions): Take direction from C_Closed. If Bearish -> SELL setup. If Bullish -> BUY setup.
B. THE EXECUTION (Intra-Candle Time Delay) If triggered, execute the following fully automated sequence on C_Current:
1. Instant Exit: At the exact open tick of C_Current, instantly CLOSE the existing automated position.
2. The 50% Time Wait (OnTimer): Do NOT use OnTick() for this. Drive the timing with OnTimer() at 1-second resolution to wait until exactly 50% of the timeframe's duration has passed.
3. Dynamic Price Calculation: At that exact 50% mark, calculate: MidPrice = (Highest of 1st half + Lowest of 1st half) / 2.
4. Order Validation & Fallback: Before sending the order, check if it respects SYMBOL_TRADE_STOPS_LEVEL to prevent silent server rejections. If the price is unreachable or too close, execute the MidPriceUnreachableAction (default: silently log and Skip this candle, then resume scanning).
5. Order Placement: Place a LIMIT order exactly at MidPrice.
6. Pending Expiration: If unfilled by the exact open of the next candle, DELETE the pending order.
5. SECURITY & LICENSING (HARDCODED)
· Hardcode at the very top of .mq5: long AllowedAccountNumber = 0; and datetime ExpirationDate = D'2099.01.01';
· If AllowedAccountNumber != 0 and doesn't match the active account -> EA fails to load.
· If current broker time > ExpirationDate -> Stop trading, delete pending, alert "License Expired".
6. DELIVERY & DEMONSTRATION
· Tester Reports: MUST provide TWO MT5 Strategy Tester Reports (One for XAUUSD, One for BTCUSD including weekend data) covering 6 months, using "Every tick based on real ticks".
· Visual Proof: Provide a short screen recording on a Demo account proving that Checkboxes correctly isolate trades, and that State Persistence works flawlessly after an MT5 restart.
· Delivery: Open-source code (.mq5) and compiled file (.ex5).
- require a 1-day trial period before payment to verify:
Portfolio or previous work to demonstrate your expertise.
Ability to build a professional custom solution from scratch.
Commitment to quality, clean code, and post-delivery support.