Aggressive Gold HFT Bot
Prompt
Create a highly automated, aggressive high-frequency trading bot for the MetaTrader 5 (MT5) platform using MQL5 focused on trading gold (XAUUSD). The bot must rapidly execute trades to maximize short-term profits by employing technical indicators—specifically RSI, MACD, and moving averages—to identify precise automatic entry and exit points. Key requirements: - Implement an aggressive scalping strategy optimized for gold's unique market conditions combining RSI, MACD, and moving averages. - Include dynamic, real-time risk management features: - Automatic trailing stops that adjust as the trade moves favorably. - Automatic exit rules that minimize losses or lock in profits. - Adaptive take profit levels that respond to current market volatility. - Support customizable input parameters for: - Trading aggressiveness, - Risk tolerance, - Position sizing, - Indicator threshold levels. - Provide an optional Martingale strategy toggle. - Include daily profit and loss target inputs for manual risk management cuts. - Exclude any grid system trading or hedging; strictly support live, real scalping with aggressive profit targeting. - Continuously monitor gold market data to identify every possible trading opportunity and dynamically manage open positions. # Steps 1. Define a high-frequency scalping strategy tailored to gold using RSI, MACD, and moving averages. 2. Develop the full MQL5 code implementing this strategy with efficient indicator calculations and trade execution flows. 3. Implement advanced risk management: dynamic trailing stops, adaptive take profits, and volatility-sensitive position sizing. 4. Include inputs allowing users to customize all crucial trading and risk parameters as well as toggles for Martingale and profit/loss targets. 5. Rigorously test and optimize the bot for robustness and responsiveness under various gold market scenarios in MT5's strategy tester. # Output Format Provide: 1. The complete MQL5 source code for the trading bot focused on gold (XAUUSD). The code must be extensively commented, explaining: - How RSI, MACD, and moving averages are calculated and interpreted for entries and exits. - Entry and exit logic in detail. - Risk management techniques including trailing stops and adaptive take profits. - Usage and effects of all customizable parameters and toggles. 2. A detailed supplementary summary document covering: - Overall trading strategy rationale tailored to gold. - Role of each technical indicator in trade decisions. - Detailed explanation of risk management processes and safeguards. - Instructions on tuning parameters for aggressiveness and risk tolerance. - How the optional Martingale method and daily profit/loss targets function and how to enable or disable them. # Notes - Ensure compliance with MetaTrader 5 standards and trade execution best practices. - Prioritize ultra-fast responsiveness while preserving risk controls aligned with aggressive scalping. - Explicitly avoid grid systems and hedging techniques. - The final bot must be production-ready, suitable for live aggressive scalping on gold, maximizing short-term profits while limiting downside through strict automation safeguards.
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.