Overview
This prompt aims to guide developers in creating a sophisticated Forex trading robot for the MT5 platform. Programmers and traders will benefit from the detailed specifications and structured approach to implementing the trading strategy.
Prompt Overview
Purpose: This Forex trading robot aims to automate swing trading strategies on the MetaTrader 5 platform.
Audience: Designed for traders seeking to enhance their trading efficiency through automated strategies and robust performance metrics.
Distinctive Feature: It incorporates multi-timeframe analysis with customizable parameters for tailored trading experiences and risk management.
Outcome: Users will benefit from a user-friendly EA that optimizes trading decisions based on real-time market conditions.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Consulting (Management, Strategy), Data Analytics & Business Intelligence, Development Tools & DevOps
- Techniques: Function Calling / Tool Use, Role/Persona Prompting, Structured Output
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
You are to develop a professional and advanced Forex trading robot (Expert Advisor) for the MetaTrader 5 (MT5) platform. This EA should implement a multi-timeframe, swing trading, trend-following strategy based on the detailed specifications below.
**Strategy Details:**
1. Timeframes & Indicators:
– Daily (High Time Frame – HTF):
– RSI: Period 25; Buy Level = 54; Sell Level = 46
– ATR: Period 14
– 1 Hour (Semi-HTF):
– RSI: Period 25; Buy Level = 54; Sell Level = 46
– ATR: Period 14
– 15 Minutes (Low Time Frame – LTF):
– RSI: Period 3; Buy Level = 26; Sell Level = 74
– ATR: Period 14
2. Entry Criteria:
– Buy Entries:
– HTF: Enter the first buy when RSI 25 crosses above 54 from below 46, indicating trend start.
– Semi-HTF: After HTF buy confirmation, enter the second buy when Semi-HTF RSI crosses above 54 from below.
– LTF: With Semi-HTF RSI above 54, enter buys on every RSI 3 crossing above 26 at candle close.
– Sell Entries:
– HTF: Enter the first sell when RSI 25 crosses below 46 from above 54.
– Semi-HTF: After HTF sell confirmation, enter the second sell when Semi-HTF RSI crosses below 46 from above.
– LTF: With Semi-HTF RSI below 46, enter sells on every RSI 3 crossing below 74 at candle close.
3. Exit Criteria:
– Close all buy trades if HTF RSI crosses below 46.
– Close all sell trades if HTF RSI crosses above 54.
4. Trade Management:
– Lot size: Default 0.5% of account balance; allow manual lot size input defaulting to 1 lot.
– Stop Loss: 2 x ATR (appropriate to trade’s timeframe).
– Take Profit:
– 6 x ATR for HTF and Semi-HTF trades;
– 4 x ATR for LTF trades.
– Breakeven: Optional activation at 2.5 x ATR + 0.5 x ATR buffer.
– Daily Drawdown Limit: 4% of account balance (stop trading further during that day if exceeded).
5. Customization:
– Allow all indicator parameters (periods, levels) and trade management settings (lot size, SL, TP, breakeven, drawdown limit) to be fully customizable via inputs.
6. Additional Features:
– Assign a unique magic number and trade comment to all trades.
– Implement a professional-grade dashboard displaying:
– Trend direction and signal status on all timeframes (Daily, 1H, 15m).
– Account metrics including current profit/loss, drawdown, and equity information.
7. Performance & Reliability:
– Optimize code to prevent memory leaks and array overflows.
– Ensure efficient data handling to avoid lag.
– Implement robust error handling and logging.
**Your solution should:**
– Follow best coding practices and include appropriate comments.
– Use consistent naming conventions.
– Ensure the EA is user-friendly with clear input options and an intuitive interface.
**# Output Format**
– Provide the full source code of the MT5 Expert Advisor in MQL5 language.
– Include detailed comments for every main section and important logic.
– Provide explanations or notes about how customization parameters map to the strategy.
**# Notes**
– Strictly implement candle close RSI crosses for entering trades on LTF.
– Ensure trades are entered only if the higher timeframe RSI conditions remain valid.
– Consider ATR values of the respective timeframe when calculating SL and TP.
– The dashboard should update live and be visually clear without clutter.
Create this Expert Advisor code accordingly.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Open your preferred code editor for MQL5 programming.
- Paste the prompt into the editor as a reference.
- Begin coding the Expert Advisor based on the specifications.
- Test the EA on the MetaTrader 5 platform.
- Optimize and customize the EA as needed.
Tips for Best Results
- Understand Timeframes: Familiarize yourself with the significance of each timeframe in your strategy to ensure accurate signal interpretation.
- Optimize Indicator Settings: Customize RSI and ATR settings based on market conditions for improved entry and exit points.
- Implement Robust Error Handling: Ensure your code can gracefully handle unexpected situations to maintain reliability during trading.
- Test Thoroughly: Backtest your EA across various market conditions to validate performance and make necessary adjustments before live trading.
FAQ
- What is the main strategy for the Forex trading robot?
The strategy is a multi-timeframe, swing trading, trend-following approach using RSI and ATR indicators. - How does the EA determine buy entries?
Buy entries are based on RSI crosses on HTF, Semi-HTF, and LTF confirming upward trends. - What is the daily drawdown limit for trading?
The daily drawdown limit is set at 4% of the account balance to manage risk. - What features enhance the EA's user-friendliness?
Customizable inputs, a professional dashboard, and clear comments throughout the code enhance user experience.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


