Overview
This prompt aims to create a sophisticated MetaTrader 5 Expert Advisor tailored for high-probability trading strategies. Programmers and traders seeking advanced automated trading solutions will benefit from this detailed specification.
Prompt Overview
Purpose: This Expert Advisor aims to achieve a high win rate by utilizing advanced trading strategies and concepts.
Audience: Designed for experienced traders and developers familiar with MQL5 and algorithmic trading principles.
Distinctive Feature: It incorporates Smart Money Concepts and adaptive risk management for dynamic trading performance.
Outcome: The EA will provide a modular framework for future enhancements while maintaining strict trading discipline and risk control.
Quick Specs
- Media: Text
- Use case: Analysis, Content Creation, Expansion & Elaboration
- Techniques: Output Constraints, Prompt Templates, Structured Output
- Models: ChatGPT, Claude, Gemini AI
- 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
Create an advanced MetaTrader 5 Expert Advisor (MQL5) with a target win rate of 89% or higher. The EA should implement the following strategies and concepts:
– Smart Money Concepts (SMC)
– Price Action
– Spha Strength Strategy
– Order Blocks
– Fair Value Gaps
– Break of Structure
– Session filtering
– Adaptive risk management
– Continuous trade cycling (close and reopen logic)
The EA must be modular, well-commented, and cleanly coded in MQL5, designed for future manual extensions.
## Core Requirements
– Trade only high-probability setups with multiple stacked confirmations before entry.
– Dynamically adapt lot size based on market conditions and recent trade results.
– Close trades early upon change in conditions and reopen if logic remains valid.
– Strictly limit overtrading, enforce daily trade loss limits, and protect against high drawdowns.
– The EA must only trade the following symbols:
– XAUUSD
– US30
– BTCUSD
– USDJPY
– GBPUSD
– It must not trade any others.
## Strategy Components
1. Indicators (Filters only, no standalone signals):
– EMA 9 & EMA 20 (trend direction and pullbacks)
– ADX (minimum threshold for trend strength)
– ATR (volatility filter and stop loss/take profit scaling)
– RSI (momentum and divergence confirmation)
– Optional MACD histogram for directional bias
2. Smart Money Concepts Primary Logic:
– Break of Structure (BoS): Require candle close beyond structural levels to filter minor noise.
– Order Blocks (OB): Detect last bullish/bearish candle before impulsive moves; entry only when price returns to OB aligned with higher timeframe bias.
– Fair Value Gaps (FVG): Identify 3-candle imbalance zones; entries allowed only on price retracement into these zones; visually draw FVG boxes on chart.
3. Price Action Rules:
– Trade only on strong impulsive candles with a minimum candle body-to-wick ratio.
– Avoid entries during choppy or low-volume periods.
– Prefer rejection candles at OB/FVG zones.
4. Spha Strength Strategy:
– Implement a scoring system (0.0 to 1.0) incorporating trend strength, volatility, structure clarity, and momentum.
– Only trade setups with strength score ≥ 0.89 for enhanced win probability.
## Session & Trading Time Filters
– Allow trades exclusively during:
– London
– New York
– London-New York overlap sessions
– Block trades during Asian sessions (except BTCUSD), low volatility times, and spread spikes.
## Order Lock & Overtrading Protection
– Limit to one open trade per symbol.
– Implement cooldown periods between trades per symbol.
– Lock trading after reaching max daily loss threshold; unlock at the start of the next trading day.
## Risk and Money Management
– Dynamic lot sizing based on a user-defined base lot.
– Increase lot size after wins (with controlled multiplier); decrease after losses.
– Scale lot size factoring ATR, volatility, and Spha Strength score.
– Enforce configurable max risk per trade (default 1-2%).
– Enforce hard limits on max trades per day and max daily drawdown with shutdown.
## Trade Cycling & Management
– If a trade closes early in profit and original conditions remain valid, reopen a new trade immediately with adjusted lot size.
– Close trades early if conditions weaken.
– Do not perform revenge trading.
## Code Structure (Approx. 400 lines total)
– Section 1 (Lines 1–100): Core Setup — properties, metadata, input definitions (checkbox booleans for features), symbol validation, session filters, indicator initialization.
– Section 2 (Lines 101–200): Market Analysis — structure detection, OB and FVG detection and chart drawing, trend & strength scoring (Spha logic).
– Section 3 (Lines 201–300): Trade Logic — buy/sell entry conditions, risk and lot size calculations, order execution, stop loss and take profit placement.
– Section 4 (Lines 301–400): Management & Safety — trade monitoring, early close logic, re-entry logic, daily limits enforcement, logging and debugging.
## Feature Checklist
– Implement boolean flags for:
– Structure confirmation
– Valid Order Block
– FVG tapped
– Valid trading session
– Spha Strength score >= threshold
Only execute trades when all flags are true.
## Constraints
– No repainting or future candle access.
– Do not include unrealistic win-rate claims in comments.
– Must compile without errors on the MQL5 platform.
– Fully commented for manual expansion.
## Output Format
– Provide the complete, syntactically correct MQL5 Expert Advisor source code file.
– Include comprehensive comments explaining each major block and logic component.
– The code must be modular and well-structured according to the 4-section layout described.
Follow all instructions carefully to produce a professional, institutional-style EA with a realistic high precision, low-frequency trading approach. The final code will serve as a master template for future manual customization and extensions.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Paste it into a text editor or IDE.
- Review the requirements and strategies outlined.
- Begin coding the MQL5 Expert Advisor based on the prompt.
- Ensure all sections are modular and well-commented.
- Test the EA thoroughly on the MQL5 platform.
Tips for Best Results
- Modular Design: Structure your EA into clearly defined sections for easy future modifications.
- Dynamic Lot Sizing: Adjust lot sizes based on market conditions and recent performance to manage risk effectively.
- Session Filtering: Only execute trades during high-activity market sessions to increase win probability.
- Trade Management: Implement early closing and re-entry logic to adapt to changing market conditions and protect profits.
FAQ
- What is the target win rate for the Expert Advisor?
The target win rate for the Expert Advisor is 89% or higher. - Which symbols will the EA trade?
The EA will trade XAUUSD, US30, BTCUSD, USDJPY, and GBPUSD only. - What strategies are implemented in the EA?
The EA implements Smart Money Concepts, Price Action, Spha Strength Strategy, and more. - How does the EA manage risk?
The EA uses dynamic lot sizing, daily loss limits, and strict overtrading controls.
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.


