Advanced Multi-Timeframe Forex Robot MT5
Prompt
Develop a professional and advanced Multi Timeframes Forex Robot for MT5 based on the following detailed swing trading, trend-following, and multi-timeframe analysis strategy. Strategy Overview: Timeframes and Indicators: - Daily timeframe (HTF): - RSI: 25-period with levels 46 (sell) and 54 (buy) - ATR: 14-period - 1-hour timeframe (Semi HTF): - RSI: 25-period with levels 46 (sell) and 54 (buy) - ATR: 14-period - 15-minute timeframe (LTF): - RSI: 7-period with levels 26 (buy) and 74 (sell) - ATR: 14-period Buy Entry Logic: 1. HTF: Enter first buy when RSI 25 crosses above 54 from below 46, signaling uptrend start; proceed to semi HTF. 2. Semi HTF: Confirm HTF RSI remains above 54; enter buy when semi HTF RSI crosses above 54 from below. 3. LTF: Confirm semi HTF RSI above 54; enter buy on RSI 7 crossing above 26 at candle close; take all valid RSI 7 crosses maintaining semi HTF RSI restriction. 4. Close all buy trades if HTF RSI crosses below 46 (trend reversal). Sell Entry Logic: 1. HTF: Enter first sell when RSI 25 crosses below 46 from above 54, signaling downtrend start; proceed to semi HTF. 2. Semi HTF: Confirm HTF RSI remains below 46; enter sell when semi HTF RSI crosses below 46 from above. 3. LTF: Confirm semi HTF RSI below 46; enter sell on RSI 7 crossing below 74 at candle close; take all valid RSI 7 crosses maintaining semi HTF RSI restriction. 4. Close all sell trades if HTF RSI crosses above 54 (trend reversal). Trade Management: - Lot Size: Base lot size at 0.5% of account per trade, with manual override option for fixed lot size (default 1 lot). - Stop Loss: 2x ATR - Take Profit: 6x ATR for HTF and semi HTF trades; 4x ATR for LTF trades. - Optional Breakeven: Activate at 2.5x ATR plus 0.5x ATR buffer. - Daily Drawdown Limit: 4% maximum. Customization and Additional Features: - All indicator parameters and trade management settings fully customizable. - Incorporate magic number and custom trade comment for identification. - Implement a professional-grade dashboard displaying: - Trend direction and signal status across all three timeframes - Current account profit/loss, drawdown, and equity information Technical Requirements: - Ensure high optimization to prevent memory leaks and array overflows. - Avoid any lagging through efficient data handling and error catching. - Implement comprehensive error handling and recovery mechanisms. Instructions: - Begin by logically reasoning through the multi-timeframe signal conditions and trade execution hierarchy. - Ensure synchronization between HTF, semi HTF, and LTF signals before placing trades. - Account for proper candle close timing when applying RSI crossing conditions. - Integrate all trade management parameters dynamically using ATR values. - Design the dashboard to be clear, informative, and non-intrusive. - Test for edge cases such as sudden RSI level shifts or indicator calculation errors. Output Format: - Provide the complete MT5 Expert Advisor code implementing the above strategy in MQL5 language. - Include detailed comments within the code explaining each logic segment. - Supply instructions for customizing indicator and trade parameters. - Provide notes on optimization techniques used and error handling strategies implemented. Example snippet (placeholder): // Check Daily RSI cross above 54 if(RSI_Daily_Previous < 54 && RSI_Daily_Current > 54 && RSI_Daily_Previous < 46) { // Initiate buy entry logic } Maintain professional coding standards and best practices suitable for a commercial-grade trading robot.
Related Coding Prompts
Write Code
As a seasoned programmer, your task is to write code in [programming language] to [perform action]. The code should be efficient, well-structured, and optimized for performance. Make sure to follow best practices and industry standards while implementing the necessary algorithms and logic to achieve the desired functionality. Test the code thoroughly to ensure it functions as intended and meets all requirements. Additionally, document the code properly for future reference and maintenance.
Debug Code
Act as a seasoned programmer with over 20 years of commercial experience. Analyze the provided [piece of code] that is causing a specific [error]. Your task involves diagnosing the root cause of the error, understanding the context and functionality intended by the code, and proposing a solution to fix the issue. Your analysis should include a step-by-step walkthrough of the code, identification of any bugs or logical mistakes, and a detailed explanation of how to resolve them. Additionally, suggest any improvements or optimizations to enhance the performance, readability, or maintainability of the code based on your extensive experience. Ensure that your solution adheres to best practices in software development and is compatible with the current development environment where the code is being executed.
Do Code Review
As a seasoned programmer with over 20 years of commercial experience, your task is to perform a comprehensive code review on the provided [piece of code]. Your review should meticulously evaluate the code's efficiency, readability, and maintainability. You are expected to identify any potential bugs, security vulnerabilities, or performance issues and suggest specific improvements or optimizations. Additionally, assess the code's adherence to industry standards and best practices. Your feedback should be constructive and detailed, offering clear explanations and recommendations for changes. Where applicable, provide examples or references to support your suggestions. Your goal is to ensure that the code not only functions as intended but also meets high standards of quality and can be easily managed and scaled in the future. This review is an opportunity to mentor and guide less experienced developers, so your insights should be both educational and actionable.