MQL5 Expert Advisor for 3-Candle EMA Strategy on M5 Timeframe

Unlock profitable trading with our advanced MQL5 EA using a strategic 3-candle

Workflow Stage:
Use Case
Save Prompt
Prompt Saved

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

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

  1. Copy the prompt provided above.
  2. Paste it into your preferred text editor or IDE.
  3. Review the trading rules and logic outlined in the prompt.
  4. Make any necessary modifications or requests based on your needs.
  5. Ensure to follow MQL5 best practices in your responses.
  6. 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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Used Prompts

Related articles

AI Powered Web Development Portfolio with React PHP Bootstrap and DBMS Integration

Learn to build a dynamic portfolio that showcases full-stack development skills.

AI Wallet Finder Program with Authentication and Security

Ensure secure and user-friendly wallet tracking with reliable authentication features.

Determine Movie Ticket Cost by Age Conditional Logic Guide

Discover the perfect movie ticket price based on age with our easy-to-use

Create a 3D Robot Slum Simulation with Three.js for Developers

Embark on a neon-lit journey through Sector Zero's dystopian robot slum in