This Technical Requirement Specification (TRS) is the final architectural blueprint for the developer (MQ5 EA). It incorporates the modular entry system, multi-loop basket management, and the dynamic Take Profit scaling requirement where the profit target increases proportionally with the risk (lot size) of the basket. ________________________________________ Technical Requirement Specification: Global Basket Scalper (V3.0) 1. Phase 1: Entry Logic (Initial Trade) Phase 1 governs the first trade of any new cycle. The logic must be modular, allowing the user to enable/disable specific filters. o First trade to be opened as per EMA (user settings - to define trend) & meeting ADX threshold conditions. ADX is used in 2 different phases of the EA: - Setting 1: To trigger the start of the initial loop - first trade of the first loop to be initiated only if ADX is above or below a certain threshold. - Setting 2: Trades within loops are created only if ADX is above a certain threshold (different from Setting 1). - Parameters for 1 & 2 can be different. - These settings are modular (true or false). Once the first trade is open, the EA manages the "Basket" across multiple loops. Loop 1: Adds positions at fixed $X$-pip intervals - if ADX condition is fulfilled & distance is at least at X pips from previous position - only as price moves favorably (adding to winners) . Loop 1 Hedging Countermeasure: If prices goes into the opposite direction, from X pips from entry level (drawdown limit set by user in pips or points), the hedging strategy opens a new trade and keeps adding positions - if ADX condition is fulfilled & minimum distance of $X$-pip intervals from last opened position - only as price moves favorably. --> the distance between trade is to be around 0.3 pip (in average 3 trades should open within 1 pip move) so the code needs to include a very quick way to send the orders to the platform. 2. Phase 2: Basket & Recovery Management New loop(s) strategy: Secondary loops can be created to support the initial loop if required. Criteria to open new loop(s): - Quantity of all open trades in initial loop to trigger 2nd loop OR loop (N-1) for loop (N) - retracement to entry level Additional parameters: - total quantity of loops - Lot multiplier is applied - maximum lot size is part of the settings - modular choice for new loops to stop previous or keep all loops running simultaneously 3. Phase 3: Dynamic Profit Closure & Continuity This section defines how the EA exits and immediately hunts for the next cycle. Dynamic Take Profit Scaling: CRITICAL Logic: The Take Profit (TP) target must increase proportionally as new loops are created o Formula: Dynamic TP = TP_{Loop-1} * (user setting) TP Loop 2 = TP initial * user settings TP Loop 3 - TP Loop 2 * user settings o Global Closure: When the combined net profit of all active loops reaches this dynamic target, all positions close. - Additional parameter: Max TP target 4. Momentum Continuity: o Logic: After a successful TP closure, new loop / initial trade is launched - if ADX conditions are met. First trade is last trade of previous cycle or as per EMA. 5. Safeguards: o News Filter: Stops new initial loop initialization before/after high-impact news. The logic reaches completion of ongoing loop. o Trading Hours: Restricts initial entries to specific daily windows. Trading hours are specified & adjusted per day as well in the settings. o Max Drawdown: Hard equity stop that liquidates all trades and resets the cycle. o Max Quantity of open positions: Hard trades count stop that liquidates all trades and resets the cycle. 6. Dashboard: On-chart UI must display active Loop Tier, Total active trades, Current Basket Profit vs. Dynamic TP, and News status.