Работа завершена
Техническое задание
Requirement Specification for MQL4 Expert Advisor
1. Introduction
This order specifies the requirements for an MQL4 Expert Advisor designed to automate trading strategies on the MT4 platform. The EA will incorporate mechanisms for signal generation, trade execution, money management, and risk mitigation according to the provided strategy flow diagrams.
2. The Idea
The EA will operate by analysing candlestick patterns (sizes) to determine entry signals, executing trades, managing open positions, and employing a pivot hedge mitigation strategy when a trade reaches a specified drawdown level.
3. Trade Entry Conditions
- Signal Detection: The EA will monitor for bullish or bearish candlestick formation.
- Candlestick Size Filter: A trade signal is generated if the candlestick's size is within specified pip thresholds (from X to Y pips).
- Position Opening: Depending on the candlestick pattern:
- For a bullish candlestick, a short position is opened at the opening price of the next candle.
- For a bearish candlestick, a long position is opened at the opening price of the next candle.
4. Order Lot Calculation
- Fixed Volume Trading: The EA will trade a fixed volume as specified by the user.
- Risk-Based Volume Trading: The EA will calculate the volume based on the risk percentage of the balance or equity.
- Stop Loss Calculation: The EA will compute a stop loss value for internal risk calculation purposes only, without placing an actual stop loss order.
5. Trade Management
- Stop Loss and Take Profit: The EA will set Take Profit (TP) levels but will not place a Stop Loss order, as it is only used for position sizing.
- Trailing Stop: Optionally, a trailing stop can be used if enabled.
- Trade Monitoring: The EA will monitor floating profits/losses to close positions at specified profit or loss levels.
6. Risk Mitigation Strategy
- Drawdown Assessment: When a trade is in a drawdown of X pips, the EA will execute the pivot hedge mitigation strategy.
- Hedge Trade Execution: The EA will close the losing trade and open a new trade in the opposite direction with double the lot size of the original trade, setting the TP to recover the loss.
7. Configuration Parameters
The EA will be configurable with the following parameters:
- Take Profit (in pips)
- Stop Loss (for internal calculation in pips)
- Money Management (Boolean)
- Percentage Risk (up to two decimals)
- Fixed Volume (in lots)
- Maximum Open Trades (number)
- Trades per Signal (number)
- Bar Height Measurement (High-Low or Open-Close)
- Maximum and Minimum Previous Bar Height (in pips)
- Maximum Spread (in pips)
- Trailing Stop (Boolean)
- Trailing Stop Trigger (in pips)
- Trade Time Window (start and end times, 24-hour format)
- Mitigation Trigger (in pips)
8. Additional Features
- Data Handling: The EA will keep a log of all trading activities.
- Notifications: Optional push notifications for significant trading events.
- Safety Checks: The EA will perform checks for internet connectivity and broker connection before executing trades.
- Error Handling: The EA will manage and respond to errors during trade execution.
9. Performance Metrics
- The EA will record performance metrics such as win rate, profitability, drawdown, and trade frequency for analysis.
10. Development and Testing
- The EA will undergo rigorous back-testing using historical data.
- Forward testing will be conducted on a demo account before live deployment.
11. Compatibility
- The EA will be compatible with MT4 platforms and adhere to all MQL4 programming standards.
12. Future development
- Future development and alterations will be needed.