Overview
This prompt aims to guide users in analyzing, modifying, or understanding an MQL5 Expert Advisor for a specific trading strategy. Programmers and traders familiar with MQL5 and Forex trading will benefit from the detailed explanations and code modifications.
Prompt Overview
Purpose: This EA implements a 3-candle EMA strategy for trading on the M5 timeframe.
Audience: It is designed for Forex traders and developers familiar with MQL5 programming.
Distinctive Feature: The EA features adjustable stop loss, take profit, and trading hour filters for enhanced control.
Outcome: Users can automate trades based on specific candle patterns and EMA conditions, improving trading efficiency.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Consulting (Management, Strategy), Development Tools & DevOps, Productivity & Workflow
- Techniques: Few-Shot Prompting, Self-Critique / Reflection, 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
You are given an MQL5 Expert Advisor (EA) code that implements a 3-candle EMA entry strategy on the M5 timeframe. The EA follows these trading rules:
– BUY:
– The two candles prior to the last closed candle are bearish.
– The last closed candle is bullish.
– The last candle’s close is above the maximum high of the previous two candles and above the EMA(10).
– SELL:
– The two candles prior to the last closed candle are bullish.
– The last closed candle is bearish.
– The last candle’s close is below the minimum low of the previous two candles and below the EMA(10).
The EA also includes features such as:
– Adjustable stop loss and take profit in ticks
– Trading hours filtering
– Limiting to one position per symbol
– Optional fixed lot sizing
Your task is to analyze, modify, or explain this EA script based on the user’s subsequent requests. Ensure that all trading logic, input parameters, and MQL5 programming constructs are handled correctly.
### Steps
1. Understand the existing EA code and its logic.
2. Apply requested modifications or provide explanations clearly.
3. Maintain proper MQL5 best practices and coding standards.
4. Use clear, detailed comments when providing code snippets.
### Output Format
– Respond with detailed explanations, code snippets, or modifications as clear text.
– Use markdown code blocks for code.
– Include comments and reasoning steps as needed to justify your answers.
### Notes
This prompt assumes familiarity with:
– MQL5 programming
– Forex trading concepts (candles, EMA, SL/TP, ticks)
– The MetaTrader 5 platform
All provided information should be consistent with the EA code given and the trading rules described.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Paste it into your preferred text editor or IDE.
- Review the trading rules and logic outlined in the prompt.
- Make any necessary modifications or requests based on your needs.
- Ensure to follow MQL5 best practices in your responses.
- Use markdown for code snippets and detailed explanations.
Tips for Best Results
- Understand the Strategy: Familiarize yourself with the 3-candle EMA entry strategy to ensure you grasp the conditions for buying and selling.
- Modify Parameters: Adjust the stop loss and take profit settings in ticks to align with your risk management strategy and trading goals.
- Implement Trading Hours: Ensure the EA only trades during specified hours to avoid unfavorable market conditions, enhancing overall performance.
- Single Position Management: Code the logic to limit the EA to one open position per symbol, preventing overexposure in the market.
FAQ
- What is the main strategy of the MQL5 EA?
The EA implements a 3-candle EMA strategy, trading based on bullish and bearish candle patterns. - How does the EA determine a BUY signal?
A BUY signal occurs when the last candle is bullish and the previous two are bearish, with specific price conditions. - What conditions trigger a SELL signal in the EA?
A SELL signal is triggered when the last candle is bearish and the previous two are bullish, meeting certain price criteria. - What features does the EA include for trading management?
It includes adjustable stop loss, take profit, trading hours filtering, and limits to one position per symbol.
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.


