Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Indicators

Open Range BreakOut Indicator for MetaTrader 5 - indicator for MetaTrader 5

Views:
4942
Rating:
(7)
Published:
Updated:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Indicator Preview



Open Range Breakout Indicator for MetaTrader 5

Overview

The Open Range Breakout (ORB) indicator is a powerful technical analysis tool that identifies and tracks price breakouts from the opening range of trading sessions. This indicator is based on the concept that the high and low prices established during the first minutes of a trading session often serve as significant support and resistance levels throughout the remainder of the day.

The indicator automatically calculates the opening range based on user-defined time periods, plots multiple price targets, and provides visual and audio alerts for potential trading opportunities. It is designed to help traders identify high-probability breakout trades and retest scenarios.

Core Concept

The ORB strategy is built on the principle that market participants establish an initial price range during the opening period of a trading session. When price breaks out of this range with conviction, it often continues in the direction of the breakout. The indicator tracks this opening range and projects multiple profit targets based on the range size.

Key features include automatic detection of breakout signals, retest identification, and progressive profit targets calculated as multiples of the opening range.

Indicator Parameters

Basic Settings

sOpeningRangeMinutes (default: "15")
Defines the opening range period in minutes. Available options include 5, 15, 30 minutes, or 0 for custom time ranges. The 15-minute opening range (9:30-9:45 EST) is commonly used for US equity markets, while shorter periods suit faster-moving markets.

alertBreakoutsOnly (default: false)
When enabled, alerts are triggered only on confirmed breakouts rather than simple price crossings of ORB levels. This reduces false signals by requiring price to close beyond the range and continue in the breakout direction.

showLabels (default: true)
Displays text labels for all ORB levels and price targets on the chart. Labels show "ORB HIGH", "ORB LOW", and percentage-based profit targets (PT 50%, PT 100%, etc.).

showPreviousDayORBs (default: true)
Controls whether ORB levels from previous trading sessions remain visible on the chart. When disabled, only the current day's ORB is displayed, reducing chart clutter.

showEntries (default: true)
Enables visual markers for potential entry points, including "Breakout - Wait for Retest", "Retest", and "Failed Retest" labels. These annotations help traders identify optimal entry timing.

Display Options

showPriceTargets (default: true)
Displays the primary profit targets at 50% and 100% of the opening range size. These are the most commonly used targets for taking partial profits.

showPriceTargetsExtended (default: false)
Adds extended profit targets from 150% up to 500% of the opening range. These extended targets are useful for trending markets or highly volatile instruments like gold (XAUUSD).

showMidPoint (default: false)
Plots a line at the exact center of the opening range. The midpoint often acts as a pivot level and can be used for mean reversion strategies.

showShadedBox (default: true)
Draws a filled rectangle over the opening range period, providing clear visual identification of the ORB zone.

Color Customization

shadeColor (default: clrTeal)
Sets the color for the shaded opening range rectangle.

orb50Color (default: clrPurple)
Color for the 50% profit target lines.

orb100Color (default: clrBlue)
Color for the 100% profit target lines.

orbOtherColor (default: clrTeal)
Color for all extended profit targets (150% through 450%).

Time Settings

sORBStartTime (default: "0930-0945")
Custom time override in 24-hour format (HHMM-HHMM). This parameter is only used when sOpeningRangeMinutes is set to 0, allowing complete flexibility in defining the opening range period.

sTimeZone (default: "EST")
Reference timezone for the opening range calculation. While the parameter accepts different timezone abbreviations, the indicator calculates times based on the broker's server time.

Label Formatting

labelOffsetBars (default: 5)
Horizontal spacing in bars between the current price action and the label position. Positive values move labels to the right.

labelOffsetPips (default: 0)
Vertical spacing in pips for label positioning. This helps prevent labels from overlapping with price action or other chart elements.

labelFontSize (default: 8)
Font size for all text labels on the chart. Adjust based on screen resolution and personal preference.

labelAnchor (default: ANCHOR_LEFT)
Determines the anchor point for label positioning. Options include ANCHOR_LEFT, ANCHOR_RIGHT, ANCHOR_CENTER, etc.

maxLineBars (default: 500)
Maximum length in bars for ORB level lines. This prevents the indicator from drawing excessively long lines on historical data, improving performance.

How the Indicator Works

Opening Range Calculation

The indicator identifies the opening range by monitoring the specified time period and recording the highest high and lowest low during that window. For example, with a 15-minute setting, it captures the range between 9:30 and 9:45.

Once the opening range period ends, the high and low levels are locked and extended forward as horizontal lines for the remainder of the trading session.

Price Target Calculation

All profit targets are calculated as multiples of the opening range size. If the opening range is 20 points, the 50% target would be 10 points beyond the ORB high (for long trades) or below the ORB low (for short trades). The 100% target would be 20 points, 150% would be 30 points, and so on.

This dynamic scaling ensures profit targets adjust automatically to market volatility, with larger ranges producing wider targets and smaller ranges producing tighter targets.

Breakout Detection Logic

The indicator employs sophisticated multi-bar confirmation for breakout signals. A valid upside breakout requires price to close above the ORB high on one bar, then continue higher on the next bar with the low remaining above the ORB high level. This filters out false breakouts where price briefly spikes through the level but immediately reverses.

Similarly, downside breakouts require closes below the ORB low followed by continuation with highs remaining below the level.

Retest Identification

After a confirmed breakout, the indicator monitors for pullbacks to the broken level. A valid retest occurs when price returns to touch the ORB level but closes on the correct side, confirming the level has flipped from resistance to support (or vice versa).

Failed retests are flagged when price breaks back through the ORB level in the opposite direction, invalidating the original breakout signal.

Interpretation and Trading Applications

Breakout Trading Strategy

The primary application is identifying high-probability breakout trades. When price breaks out of the opening range with volume and momentum, traders can enter in the direction of the breakout, placing stops below the ORB low (for long trades) or above the ORB high (for short trades).

The first profit target is typically the 50% level, where partial profits can be taken. The remaining position targets the 100% level or beyond in strongly trending conditions.

Retest Entry Method

Conservative traders prefer waiting for a retest after the initial breakout. The "Breakout - Wait for Retest" label signals this opportunity. When price pulls back to test the broken level and finds support (or resistance), it provides a lower-risk entry point with a tighter stop loss.

This approach improves the risk-reward ratio significantly compared to chasing the initial breakout.

Range-Bound Trading

When price remains contained within the opening range, traders can employ mean reversion strategies, buying near the ORB low and selling near the ORB high. The midpoint line serves as a reference for neutral positioning.

Multi-Timeframe Analysis

The indicator can be applied to multiple timeframes simultaneously. Some traders use a 5-minute ORB for scalping, a 15-minute ORB for day trading, and a 30-minute ORB for swing trading, creating a comprehensive view of potential support and resistance zones.

Recommended Symbols and Timeframes

Optimal Timeframes
The indicator works best on 1-minute (M1) through 15-minute (M15) charts, where intraday price action is clearly visible. For detailed analysis of entry timing, the M5 timeframe provides an excellent balance between noise reduction and responsiveness.

Suitable Instruments
The ORB strategy is particularly effective on liquid instruments with clear opening sessions:

  • Forex pairs: EURUSD, GBPUSD, USDJPY during their respective regional opens
  • Gold (XAUUSD): Highly responsive to opening range breakouts due to strong directional moves
  • Stock indices: US30, NAS100, SPX500 during the New York session open
  • Cryptocurrencies: BTCUSD, ETHUSD during periods of high volume

The indicator performs best on instruments with defined trading sessions rather than 24-hour markets without clear opening times.

Performance Optimization

The indicator includes several performance optimizations for smooth chart operation. Buffer initialization to EMPTY_VALUE prevents unnecessary line drawing, while the maxLineBars parameter limits historical line length. The rectangle drawing logic waits until the session concludes before rendering, reducing computational overhead during active trading periods.

Object naming conventions use unique identifiers based on day of year, preventing conflicts when multiple ORB sessions are displayed simultaneously.

Alert System

The notification system provides real-time alerts through MetaTrader 5's built-in alert mechanism. Alerts can be configured for simple level crossings or restricted to confirmed breakouts only. When a breakout occurs, the alert message specifies whether it's above the ORB high or below the ORB low, allowing traders to quickly assess the opportunity without watching the chart continuously.

Visual Presentation

All chart elements follow professional formatting standards with customizable colors. The default color scheme uses lime for ORB high, red for ORB low, purple for 50% targets, blue for 100% targets, and teal for extended targets and the shaded range box. This color-coding system allows for rapid visual identification of key levels even on busy charts.

The shaded rectangle provides an intuitive visual reference for the opening range period, making it immediately obvious when price is trading within or outside the established range.

Conclusion

The Open Range Breakout indicator is a comprehensive trading tool that combines automatic range calculation, multiple profit targets, breakout detection, and retest identification into a single, easy-to-use package. Its flexibility through extensive input parameters allows traders to adapt the indicator to various trading styles, from aggressive breakout trading to conservative retest entries.

The indicator's clean visual presentation and logical alert system make it suitable for both discretionary traders and those developing automated trading systems. By focusing on the critical opening range period, it helps traders identify the most significant support and resistance levels for each trading session.

Simple_Three_Inside_Pattern_EA Simple_Three_Inside_Pattern_EA

A simple Expert Advisor that trades when the price forms the "Three From Within" pattern.

ATR Cycles ATR Cycles

A volatility filter based on 3 ATR's: a fast ATR, a middle ATR, and a slow ATR

Caculater Margin Caculater Margin

EA Tools tính toán Margin theo lotsize, có thể tùy chỉnh đòn bẩy

Clean Market Watch -  Removes All Symbols In the Market Watch Windows In One Go Clean Market Watch - Removes All Symbols In the Market Watch Windows In One Go

The Clean Market Watch script is a simple utility tool designed to quickly remove all symbols from your MetaTrader 5 Market Watch window with a single click. This is particularly useful when you want to start fresh with a clean workspace or when your Market Watch has become cluttered with too many symbols. Purpose Over time, traders often accumulate numerous symbols in their Market Watch window, making it difficult to focus on the instruments they actively trade. Manually removing symbols one by one can be tedious and time-consuming. This script automates the entire process, clearing all symbols in seconds.