Modify MQL5 Range Breakout Indicator for US Session Trading

Enhance your trading strategy with session-based breakout indicators for precise market entry

Workflow Stage:
Use Case
Save Prompt
Prompt Saved

Overview

This prompt aims to guide programmers in modifying an MQL5 indicator for session-based trading functionality. Developers and traders will benefit from enhanced trading tools that incorporate specific session analysis.

Prompt Overview

Purpose: This modification aims to enhance the existing MQL5 range breakout indicator with session-based trading functionality.
Audience: This content is intended for programmers and traders familiar with MQL5 coding and trading session concepts.
Distinctive Feature: The updated indicator will detect the first candle of the US trading session and mark its high and low.
Outcome: Users will benefit from improved trading insights without altering the original indicator’s behavior or visual output.

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 provided with an existing MQL5 code for a range breakout indicator. Your task is to modify this indicator to incorporate session-based trading functionality, specifically for sessions such as the US session.
The modifications must adhere to the following requirements:
– Add Logic: Detect and mark the first candle of the specified trading session (e.g., US session) within the current indicator.
– Mark High and Low: Identify and mark the high and low range of this first session candle, maintaining the same style and plotting behavior as the current indicator.
– Preserve Existing Functions: Do not modify or alter any existing plotting functions or the visual aspects of the indicator; only add the session detection and range identification logic.
– Unchanged Behavior: The overall behavior and output of the indicator, apart from the added session-based functionality, should remain unchanged.
# Steps
1. Identify Timeframe: Determine the timeframe and timing parameters corresponding to the desired session (e.g., US session hours).
2. Implement Detection: Detect the first candle within this session on each trading day.
3. Capture and Mark: Capture and mark the high and low of this first session candle, replicating the existing plotting method for range breakout.
4. Integrate Smoothly: Ensure the new code integrates smoothly without changing existing indicator plots or calculations.
# Output Format
– Provide the MQL5 code of the modified indicator with the added session functionality included as comments for clarity.
– Do not remove or alter existing code except where necessary to add the session logic.
– Preserve original code comments and structure as much as possible.
# Notes
– The solution must work for multiple sessions if extended, but implementing the US session is sufficient here.
– Ensure the code handles session start times accurately according to the chart timezone.
– Maintain performance efficiency and avoid redundant calculations.

Screenshot Examples

How to Use This Prompt

  1. Copy the prompt provided above.
  2. Open your MQL5 editor or coding environment.
  3. Paste the prompt into the editor for reference.
  4. Follow the steps outlined in the prompt to modify the code.
  5. Test the modified indicator to ensure functionality.
  6. Save and document your changes for future reference.

Tips for Best Results

  • Identify Session Hours: Define the start and end times for the US trading session (e.g., 14:00 to 21:00 UTC).
  • Detect First Candle: Implement logic to check for the first candle of the US session each trading day.
  • Mark High and Low: Capture the high and low of the first candle and plot them using the existing indicator’s style.
  • Integrate Without Disruption: Ensure that the new session functionality does not interfere with the current indicator’s behavior or output.

FAQ

  • What is a range breakout indicator?
    A range breakout indicator identifies price levels where a currency pair breaks out of a defined range.
  • How do you detect the first candle of a session?
    You check the time of each candle and compare it to the defined session start time.
  • What is the US trading session time?
    The US trading session typically runs from 8:00 AM to 5:00 PM EST.
  • Why preserve existing plotting functions?
    To ensure the indicator's original functionality and visual representation remain unchanged.

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

Analyze and integrate Lua script with manifest file.

This approach streamlines application deployment by merging code and configuration.

Create a fully functional and well-commented LUA script

Learn how to build clear and effective trading scripts with detailed explanations.

Alarm application with C Windows Forms code and image

Learn how to build a user-friendly alarm app with clear notifications.

AIVA Project Development Plan for AI Vision Agent on Ethereum Blockchain

Learn how to structure and execute a multi-phase AI vision project effectively.