Back to Coding

Advanced EA Specification

Prompt

You are a professional algorithmic trader with expert experience in developing advanced Expert Advisors (EAs) for MetaTrader 5, specializing in complex machine learning-based trading strategies for Forex markets. Your task is to design the next-generation Expert Advisor named "Humming-Ai," which is engineered for high-frequency trading characterized by speed, precision, and continuous subtle market activity, aiming for small yet consistent profits. This EA combines classical quantitative finance principles with cutting-edge machine learning models to analyze complex, non-linear market relationships beyond traditional indicator-based approaches. The "Humming-Ai" EA should incorporate the following detailed features: 1. Core Trading Strategy: - Focus on high-frequency mean reversion and momentum capture on the 5-minute timeframe to exploit fleeting price inefficiencies. - Utilize advanced order flow analysis including Volume Profile, Cluster Analysis, and Depth of Market (DOM) data available in MT5 to identify short-term supply and demand imbalances. - Implement mean reversion techniques detecting significant deviations from short-term moving averages or price channels, expecting rapid price reversion. 2. Adaptive Risk Management: - Employ an AI-driven component dynamically adjusting position sizing and stop-loss/take-profit levels based on current volatility, using ATR scaled by the AI model. - Use Gaussian Mixture Models (GMM) for reversal classification and trend-following indicators for trend detection, combining these with mean reversion logic for robust trade confirmation. - Implement an ensemble decision system where agreement between models leads to higher confidence trades, while divergence prompts position size reduction or skipped trades. - The AI acts primarily as a filter, evaluating the robustness of signals from conventional indicators or price action rather than generating raw signals. 3. Algorithmic Execution and Structure: - Incorporate code to efficiently manage slippage and execution speed, critical in high-frequency trading. - Use intelligent entry logic based on pattern recognition from ML models or historically validated price action sequences, avoiding reliance on simple indicator crossovers. - Integrate partial profit-taking with quick breakeven stop-loss adjustment to maintain an approximately 80% win rate on initial trade portions. 4. Indicators and Data Inputs: - Standard indicators include ATR and Bollinger Bands for volatility measurement and optimal trade sizing, and fast momentum oscillators such as Stochastic with very short settings or a customized RSI focused on recent bars. - Monitor real-time volume and liquidity data, utilizing MetaTrader 5 native functions for Level 2 market depth information. - Use multiple timeframes synergistically: daily (D1) for macroeconomic alignment and pivot avoidance, hourly (H1) for trend bias, and 5-minute (M5) for precise entry triggers. 5. Machine Learning and Proprietary Techniques: - Engineer features representing complex relationships between standard indicators (e.g., rate of change of stochastic relative to ATR). - Utilize ML models producing probability outputs for price movement rather than traditional threshold triggers, e.g., trade if ML model indicates a 90% probability of a 5-pip increase within the next 5 minutes. - Include intermarket and correlation analysis for major currency pairs and related assets, automatically detecting and capping simultaneous exposure in correlated pairs or instruments. Deliver a comprehensive description of the "Humming-Ai" EA architecture, algorithmic logic, machine learning integration, risk management, and overall strategy implementation suitable for a skilled development team to begin coding and deploying the EA on MT5. # Steps 1. Outline the hybrid strategy integrating mean reversion, momentum, and machine learning classification. 2. Define the AI component’s role in risk management and signal filtering. 3. Describe algorithmic execution techniques including slippage mitigation and intelligent entries. 4. Specify indicator selection and multi-timeframe synergy. 5. Detail feature engineering and ML model outputs guiding trade decisions. 6. Explain intermarket correlation and exposure controls. 7. Summarize the practical approach to partial profit-taking and stop-loss management. # Output Format Provide the response as a detailed technical specification document, with clearly labeled sections for each of the above aspects. Use markdown formatting with headers, bullet points, and numbered lists where appropriate. Avoid prose verbosity; prioritize clarity and precision. Include any key formulas, model descriptions, or pseudo-code snippets to convey algorithmic logic clearly. # Notes Ensure that all ML model references are clearly conceptual and suggest realistic ML methods compatible with real-time trading in MT5. Emphasize robustness and practical implementation constraints relevant to high-frequency forex trading.

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.