Overview
This prompt aims to create a highly efficient scalping Expert Advisor in MQL5 for the MetaTrader 5 platform. Programmers and traders focusing on aggressive trading strategies will benefit from this detailed guidance.
Prompt Overview
Purpose: This EA aims to execute rapid trades on XAUUSD to capitalize on small price fluctuations.
Audience: Designed for experienced traders seeking aggressive scalping strategies in the MetaTrader 5 environment.
Distinctive Feature: It incorporates advanced risk management controls and modular code structure for easy future adaptations.
Outcome: Users will benefit from a high-frequency trading tool optimized for low latency and minimal drawdown.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Development Tools & DevOps, Stock Brokerage & Trading
- Techniques: 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
Create an extremely aggressive scalper trading Expert Advisor (EA) exclusively in MQL5 for the MetaTrader 5 platform. This EA should be designed to trade only the XAUUSD symbol on the M1 (1-minute) timeframe. It must execute very fast and frequent trades to capture small price movements quickly and efficiently.
The EA must meet the following requirements:
– Use only MQL5 language and standard libraries.
– Operate strictly on the XAUUSD symbol at the M1 timeframe.
– Verify both on initialization.
– Disable trading with user notification if the conditions are not met.
– Employ highly aggressive scalping strategies focusing on rapid entries and exits that react swiftly to minor price movements.
– Incorporate configurable risk management controls, including:
– Stop loss
– Take profit
– Trailing stop
– Lot size optimized for scalping
– Optimize for low latency and minimal drawdown, including:
– Safeguards to prevent overtrading
– Control risk exposure
– Structure the code modularly with well-defined functions.
– Provide comprehensive inline comments throughout explaining:
– Variables
– Logic
– Methods
– Risk controls for easy future adaptation.
# Steps
1. Define and initialize input parameters:
– Lot size
– Stop loss in points
– Take profit in points
– Trailing stop in points
– Any scalping-specific settings
2. Implement fast and responsive signal generation logic using:
– Appropriate MQL5 indicators
– Price action techniques tailored for aggressive scalping of XAUUSD on M1
3. Develop robust order management functions to:
– Open and close positions immediately when signals trigger
– Handle order execution errors gracefully
4. Introduce safety mechanisms such as:
– Limiting maximum open trades
– Restricting trading to certain times if needed
– Enforcing a maximum daily loss
5. Perform verification checks on EA start to confirm:
– The symbol is XAUUSD
– The timeframe is M1
– If not, disable all trading and notify the user
6. Add detailed comments explaining each section of the code:
– Variable purpose
– Trading logic
– Risk management
– Safeguards
# Output Format
Provide the complete MQL5 source code for the Expert Advisor (*.mq5 file) that:
– Compiles without errors
– Is ready to deploy immediately on MetaTrader 5
The code must include all setup, indicator calculations or price action logic, trade entry and exit handling, risk management, order execution, and validation checks. Ensure all parts are thoroughly commented inline to facilitate straightforward understanding and modification in the future.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Paste it into your preferred text editor.
- Modify any specific parameters as needed for your EA.
- Implement the steps outlined in the prompt.
- Test the EA on MetaTrader 5 for functionality.
- Review and adjust the code based on performance results.
Tips for Best Results
- Verify Conditions: Ensure the EA only runs on XAUUSD and M1 timeframe; disable trading with a user alert if conditions aren’t met.
- Signal Generation: Implement fast signal generation using MQL5 indicators and price action tailored for aggressive scalping.
- Order Management: Create robust functions to open/close trades instantly upon signal triggers, handling errors gracefully.
- Risk Controls: Incorporate safeguards like max open trades, daily loss limits, and optimized lot sizes to manage risk effectively.
FAQ
- What is an Expert Advisor in trading?
An Expert Advisor (EA) is an automated trading system that executes trades based on predefined criteria. - What symbol does the EA trade?
The EA exclusively trades the XAUUSD symbol, which represents gold against the US dollar. - What timeframe is used for trading?
The EA operates on the M1 (1-minute) timeframe to capture rapid price movements. - What risk management features are included?
The EA includes stop loss, take profit, trailing stop, and optimized lot size for scalping.
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.


