Tâche terminée
Spécifications
Project Overview
Develop a custom automated trading bot (Expert Advisor) for MetaTrader 4 (MT4) that executes trades on the S&P 500 index CFDs via CMC Markets. The bot will implement a momentum-based trading strategy that utilizes technical indicators for market entry and exit signals, incorporates dynamic stop-loss orders, adjusts position sizes based on market momentum, and adheres to strict risk management principles.
As part of this project, the developer will also install and configure the trading bot on the client's MT4 platform and ensure it operates correctly on the client's account.
Technical Requirements
-
Trading Platform: MetaTrader 4 (MT4)
-
Broker: CMC Markets (ensure compatibility with their MT4 offering)
-
Trading Instrument: S&P 500 Index CFDs
-
Programming Language: MQL4 (MetaQuotes Language 4)
Strategy Details
1. Market Momentum Identification
-
Technical Indicators:
- Moving Averages (MA): Use a combination of short-term and long-term MAs (e.g., 50-period and 200-period EMAs).
- Relative Strength Index (RSI): 14-period RSI to gauge overbought and oversold conditions.
- Moving Average Convergence Divergence (MACD): Standard settings (12, 26, 9) for momentum confirmation.
-
Entry Conditions:
- Long Positions:
- Price crosses above the 50-period EMA.
- RSI is above 50 but below 70.
- MACD histogram crosses above the signal line.
- Short Positions:
- Price crosses below the 50-period EMA.
- RSI is below 50 but above 30.
- MACD histogram crosses below the signal line.
- Confirmation: All three indicators must align to confirm a bullish or bearish trend before entering a trade.
- Long Positions:
2. Stop-Loss Implementation
-
Initial Stop-Loss:
- Long Positions: Set stop-loss at the nearest significant support level below the entry price.
- Short Positions: Set stop-loss at the nearest significant resistance level above the entry price.
- Alternative: If support/resistance levels are not clear, use a fixed stop-loss of 1% of the instrument's price.
-
Trailing Stop-Loss:
- Implement a trailing stop-loss that adjusts the stop price as the trade moves favorably.
- Parameters:
- Trail by X Points: Specify the number of points to trail (e.g., 10 points).
- Activation: Trailing stop activates once the trade is in profit by a predefined amount (e.g., 5 points).
3. Position Sizing and Scaling
-
Risk Per Trade:
- Limit risk to 1-2% of total account equity per trade.
- Calculate position size accordingly.
-
Scaling In (Pyramiding):
- Conditions for Adding to Position:
- Trade is in profit by a predefined amount (e.g., 10 points).
- Indicators continue to confirm the trend.
- Additional Entries:
- Add positions at predetermined price intervals (e.g., every 10 points of favorable movement).
- Each additional position must also adhere to the 1-2% risk rule.
- Maximum Number of Additions: Limit the number of additional positions to prevent overexposure (e.g., maximum of 3 additions).
- Conditions for Adding to Position:
-
Scaling Out:
- Optionally implement scaling out of positions by taking partial profits at certain levels.
4. Exit Strategy
- Indicator-Based Exit:
- Close the position when any of the following occurs:
- Price crosses the opposite side of the 50-period EMA.
- RSI crosses back below 50 (for longs) or above 50 (for shorts).
- MACD histogram crosses the signal line in the opposite direction.
- Close the position when any of the following occurs:
- Profit Target:
- Optionally set a take-profit level at a predefined percentage gain (e.g., 5% profit).
- Time-Based Exit:
- Close any open positions at the end of the trading day to avoid overnight risk (configurable option).
5. Time Frame and Trading Sessions
-
Time Frames:
- Primary chart time frame: 15-minute chart for intraday trading.
- Indicators should be calculated based on this time frame.
-
Trading Sessions:
- Operate during specific market hours (e.g., 9:30 AM to 4:00 PM EST).
- Option to configure active trading hours.
Risk Management Principles
-
Diversification:
- The bot should not open multiple positions on highly correlated instruments simultaneously.
-
Maximum Concurrent Trades:
- Limit the number of open positions at any given time (e.g., no more than 5).
-
Error Handling:
- Implement safeguards to handle trade execution errors, disconnections, or other technical issues.
- Include logging of errors and notifications.
-
Capital Protection:
- If account equity drops by a certain percentage (e.g., 10%), the bot should cease trading and send an alert.
Additional Features
1. User-Defined Parameters
- Allow customization of key parameters without modifying the code:
- Moving Average periods and types.
- RSI period and threshold levels.
- MACD settings.
- Stop-loss and take-profit levels.
- Trailing stop parameters.
- Risk percentage per trade.
- Trading hours.
- Maximum number of positions.
2. Logging and Reporting
- Trade Logging:
- Record all trade entries and exits with timestamps, prices, and reasons for actions.
- Performance Metrics:
- Provide summary reports on trading performance, including profit/loss, win rate, and drawdowns.
- Alerts and Notifications:
- Send alerts for significant events (e.g., new trades, errors, reached profit targets) via email or MT4 notifications.
3. Backtesting and Optimization
- Ensure the bot is compatible with MT4's Strategy Tester for backtesting.
- Code should be optimized for efficient performance during backtests.
Technical Specifications
-
Coding Standards:
- Clean, well-documented code with comments explaining key functions and logic.
- Modular design to facilitate future updates or modifications.
-
Compliance:
- Adhere to all of CMC Markets' trading rules and MT4's technical requirements.
- Ensure the bot complies with regulatory standards applicable to automated trading.
-
Security:
- Implement measures to protect against unauthorized access or execution of the bot.
Delivery Requirements
-
Timeline:
- Estimated project duration: 4 weeks
- Estimated project duration: 4 weeks
-
Deliverables:
- Compiled Expert Advisor (.ex4 file) ready for installation on MT4.
- Source code (.mq4 file) with full documentation.
- User manual detailing installation, configuration, and usage instructions.
- Backtesting results on historical data demonstrating the bot's performance.
-
Testing:
- Perform thorough testing to ensure the bot operates as intended.
- Fix any bugs or issues identified during the testing phase.
-
Support:
- Provide a period of post-delivery support for troubleshooting and minor adjustments (30 days)
- Provide a period of post-delivery support for troubleshooting and minor adjustments (30 days)
Acceptance Criteria
- The bot must execute trades accurately based on the specified strategy.
- All user-defined parameters must be adjustable through the bot's settings interface.
- The bot should run smoothly on the MT4 platform without causing crashes or significant performance issues.
- Comprehensive documentation and user guides are provided.
- Successful backtesting results align with the strategy's expected performance.
Confidentiality and Ownership
- All code and materials developed are the exclusive property of the client upon full payment.
- The developer agrees to keep all project details confidential.