Техническое задание
📌 Trading Bot Requirements & Functional Description
1. Core Objective
The bot is designed to automate trading on MT5 using ICT-based and price-action strategies with dynamic trade management. It should integrate signal generation, risk management, and execution, while allowing flexibility for future strategy adjustments.
2. Technical Requirements
-
Platform: Python-based, connected to MetaTrader 5 (MT5) for order execution.
-
Data Source: MT5 market data (candles, order book, liquidity pools).
-
Frameworks/Libraries:
-
MetaTrader5 (MT5 Python API)
-
pandas , numpy for data handling
-
Logging module for debugging and backtesting insights
-
-
Execution Environment: Desktop/server with MT5 installed and broker access.
-
Expandability: Should allow adding new strategies, scoring rules, and execution logics without rewriting core.
3. Functional Modules
(A) Market Structure & Signal Detection
-
Identify swing highs/lows and breaks of structure (BoS).
-
Detect liquidity sweeps (stop hunts around key highs/lows).
-
Validate Order Blocks (OBs) with confluences (e.g., mitigation, displacement).
-
Identify IFVGs (Imbalances / Fair Value Gaps) and determine if they’re valid entry zones.
-
Detect Rejection Candles for additional entry confirmation.
-
Multi-timeframe (HTF/LTF) alignment:
-
Check HTF liquidity sweeps (e.g., H1, H4).
-
Validate LTF entry setups (M5, M15).
-
-
Session filters: e.g., London, New York open.
-
Scoring system: assign a confidence score to signals based on confluences.
(B) Strategy Manager
-
Evaluate multiple strategies in parallel:
-
Liquidity sweep entries
-
Order block mitigation entries
-
IFVG entries
-
Session-based scalps
-
-
Apply scoring logic:
-
Reward-to-Risk ratio (RR)
-
Historical win rate of setup
-
Number of confluences
-
-
Select highest-scoring trade setup at any given time.
-
Option to execute multiple strategies simultaneously (configurable).
(C) Risk & Trade Management
-
Position sizing:
-
% risk per trade (configurable, e.g., 1% of account).
-
Adjust for stop loss distance.
-
-
Dynamic Stop Loss (SL):
-
Above/below liquidity pools or OBs.
-
Adjusted with buffer (configurable).
-
-
Take Profit (TP) management:
-
Partial TP at predefined levels (e.g., 1R, 2R).
-
Trailing stop function (move SL to break-even after X RR).
-
-
Multiple entries:
-
Full entry vs. scaling into positions.
-
-
Trade filters:
-
Max trades per day.
-
Min risk-to-reward threshold.
-
(D) Execution (MT5 Integration)
-
Send buy/sell market or limit orders to MT5.
-
Modify SL/TP dynamically from within MT5.
-
Handle errors gracefully:
-
Retry failed orders.
-
Log errors.
-
-
Monitor open positions and account equity.
-
Close trades when strategy invalidation occurs.
(E) Logging & Monitoring
-
Detailed logging:
-
Signal detection events (why/why not trade was taken).
-
Trade execution (entry, SL, TP, RR, strategy used).
-
Risk % and capital allocation.
-
-
Debug mode:
-
Show scoring breakdown per trade.
-
Show market structure recognition.
-
-
Performance tracking:
-
Win/loss stats.
-
Avg RR, max drawdown.
-
-
(Optional) Export trade history to CSV/Excel for analysis.
4. Non-Functional Requirements
-
Reliability: Must not crash during market hours; recover from MT5 disconnections.
-
Low Latency: Execute trades within seconds of signal detection.
-
Maintainability: Clear modular code (strategy modules, execution module, manager).
-
Scalability: Allow plugging in new strategies with minimal refactor.
5. Complexity Factors
-
Multi-strategy integration with scoring logic (not just one signal → one trade).
-
Dynamic trade management (scaling, partials, trailing).
-
Robust MT5 API handling (execution, modification, monitoring).
-
Real-time confluence checks (OB, liquidity, FVG, candle type, sessions).
-
Extensive logging and debugging features.
-
Expandable architecture (plug-and-play new strategies).
✅ Developer Assessment Takeaway:
This bot is moderate-to-high complexity compared to a simple “crossover bot.” It requires:
-
Advanced price-action signal logic (multi-strategy with confluences).
-
Sophisticated trade management (dynamic SL/TP, partials).
-
A well-structured StrategyManager for decision-making.
-
Resilient MT5 API handling.