Şartname
Project Overview
Automated Expert Advisor for EUR/USD on MT5. The strategy maps structural liquidity (Fractal Swings) for entry triggers but targets absolute session extremes for Take Profit. It enters on the first opposite M5 Fair Value Gap (FVG) and features a dynamic, user-controlled risk engine.
1. Timezone & News Filter Requirements
The EA must use a dynamic Timezone Offset to align Broker Server Time with Indian Standard Time (IST - UTC+5:30).
- Rule A (Pre-Trade Filter): If there is "High Impact" (Red Folder) news for EUR or USD scheduled before 5:00 PM IST, the EA must take NO trades for the entire day.
- Rule B (Active Trade Protection): If a trade is active and "High Impact" news is scheduled for EUR or USD after 5:00 PM IST, the EA must close the position at market price 30 minutes before the news event.
- Rule C (Hard Cutoff): Regardless of profit/loss, the trade must be closed before 11:00 AM IST the following day.
2. Liquidity Mapping (Dual-Tracking Logic)
Between the daily market open and 11:00 AM IST, the EA must track two distinct sets of data:
A. The Absolute Extremes (For Take Profit Targets):
- The EA logs the absolute highest and absolute lowest prices of the session.
- Variables: Absolute_Asian_High and Absolute_Asian_Low.
B. The Structural Swings (For Entry Triggers):
- Identify Valid Liquidity Pools using Fractal logic (High/Low must be higher/lower than N candles to the left and N to the right).
- The "Wait" Rule: If 11:00 AM IST arrives and the session extreme has not yet confirmed as a valid fractal, the EA must wait for the confirmation candles to close before identifying the level as valid for a sweep.
- Variables: Valid_Asian_High and Valid_Asian_Low.
3. Setup & Execution (M5 Timeframe)
Detection window: 11:00 AM IST to 1:00 PM IST.
- The Sweep: Price must breach the structural Valid_Asian_High (for Sells) or Valid_Asian_Low (for Buys).
- The FVG: Following the sweep, identify the first confirmed M5 FVG in the opposite direction.
- Entry Price: Limit Order placed at the exact Midpoint of that M5 FVG.
- Stop Loss: High/Low of the 1st candle of the FVG sequence + a User-Defined Pip Buffer.
- Take Profit: The opposite absolute extreme (e.g., Buy TP = Absolute_Asian_High).
4. Dynamic User-Defined Risk Management
The EA must calculate position size based on the following User Input Parameters:
- Logic: The EA calculates the dollar amount to risk using the formula: (User_Base_Balance * (User_Risk_Percentage / 100)).
- Lot Sizing: The EA calculates the lot size by dividing that dollar risk by the distance between the Entry Price and the Stop Loss.
- Normalization: The calculated volume must be rounded down to the nearest 0.01 lot to ensure the risk never exceeds the user’s specified percentage.
5. Order Management & Invalidation Rules
- Target Hit (Pending): Delete the Limit Order if price touches the TP level before the entry is filled.
- Afternoon Expiry (Pending): Delete the Limit Order if not filled by 4:00 PM IST.
- News Flatten (Active): Close any open position 30 minutes prior to Red Folder news occurring after 5:00 PM IST.
- Next-Day Cutoff (Active): The trade must be closed at market price at 11:00 AM IST on the following day.
6. Required User Inputs (User Controls)
The developer must provide the following inputs in the EA settings menu:
- Trading Account Base Balance: (User enters the amount, e.g., 10000)
- Risk Percentage per Trade: (User enters the percentage, e.g., 0.8)
- Fractal Strength (N): (Number of candles for swing confirmation. Default: 2)
- Stop Loss Buffer (Pips): (Default: 1.5)
- Next Day Cutoff Time: 11:00 (IST)
- Magic Number: 8888
- Trade Comment: "AsianLiquidity_FVG"
Summary for your Developer
This EA is now fully "Parameter Driven." Ensure that the OnTick() function calculates the Lot Size immediately before the OrderSend() command to ensure it is using the most up-to-date Base Balance and Risk % values entered by the user.