Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

MetaTrader 5 Opening Range Breakout Indicator - MetaTrader 5 Script - MT4/MT5 Resources

author EAcpu | 5 reads | 0 comments |

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

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

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

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

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

The Opening Range Breakout (ORB) indicator is a powerful technical analysis tool that identifies and tracks price breakouts from the opening range of a trading session. This indicator is based on the concept that high and low prices established within the first minute of a trading session often act as important support and resistance levels for the remainder of the day.

The indicator automatically calculates opening ranges 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.

The ORB strategy is built on the principle that market participants establish an initial price range during the opening of a trading session. When price breaks firmly out of this range, it will usually continue in the direction of the breakout. The indicator tracks this opening range and predicts multiple profit targets based on the size of the range.

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

Opening interval minutes (default value: "15")
Defines the opening range period in minutes. Available options are 5, 15, 30 minutes, or 0 (for a custom time range). The 15-minute opening range (9:30-9:45 EST) is typically used for the U.S. stock market, while the shorter opening range is suitable for fast-moving markets.

Alert only on breakouts (default: false)
When enabled, the alert will only be triggered on a confirmed breakout, rather than on a simple price crossover at the ORB level. This reduces false signals by requiring price to close outside the range and continue in the direction of the breakout.

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

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

Show entries (default: true)
Enable visual markers for potential entry points, including "Breakout - Pending Retest," "Retest," and "Retest Failed" labels. These notes help traders determine the best time to enter a trade.

Show price target (default: true)
The main profit targets are shown as 50% and 100% of the opening range size. These are the most commonly used targets for the profit section.

Show price target expansion (default: false)
Increase profit target from 150% of opening range to 500%. These extension targets are useful for trending markets or high volatility instruments like gold (XAUUSD).

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

Show shadow box (default: true)
Draw a solid rectangle within the opening range to provide clear visual identification of the ORB area.

Shadow color (default: clrTeal)
Sets the color of the shadow opening range rectangle.

orb50 color (default: clrPurple)
The color of the 50% profit target line.

orb100 color (default: clrBlue)
The color of the 100% profit target line.

Other colors for the sphere (default: clrTeal)
Color of all extended profit targets (150% to 450%).

soORB start time (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.

s time zone (default: "EST")
Reference time zone for opening range calculation. Although this parameter accepts different time zone abbreviations, the indicator calculates the time based on the broker's server time.

Label offset bar (default: 5)
The horizontal spacing (expressed as bars) between the current price action and the label's position. Positive values ​​move the label to the right.

Label offset point (default: 0)
Vertical spacing (in points) used for label positioning. This helps prevent labels from overlapping with price action or other chart elements.

Label font size (default: 8)
The font size of all text labels on the chart. Adjust according to screen resolution and personal preference.

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

Maximum number of lines (default: 500)
ORB The maximum length of the horizontal line in bars. This prevents the indicator from drawing too long lines on historical data, thus improving performance.

This indicator identifies opening ranges by monitoring a specified time period and recording the highest high and lowest low during that window. For example, if set to 15 minutes, it captures the range between 9:30 and 9:45.

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

All profit targets are calculated as multiples of the opening range size. If the opening range is 20 pips, the 50% target will be 10 pips above the ORB high (for a long trade) or below the ORB low (for a short trade). A 100% target is 20 points, a 150% target is 30 points, and so on.

This dynamic scaling ensures that profit targets automatically adjust to market fluctuations, with larger ranges yielding broader targets and smaller ranges yielding tighter targets.

The indicator uses complex multiple bars to confirm breakout signals. A valid upside breakout requires price to close above the ORB high on one bar and then continue higher on the next bar with a low still above the ORB high. This will filter out false breakouts where the price briefly spikes but then reverses immediately.

Likewise, a downside breakout would require a close below the ORB low, followed by a subsequent high below that level.

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

When price breaks the ORB level in the opposite direction, a failed retest is flagged, invalidating the original breakout signal.

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

The first profit target is usually the 50% level, where partial profits can be taken. The remaining position targets 100% or higher during strong trend conditions.

Conservative traders prefer to wait for a retest after the initial breakout. The "Breakthrough - Awaiting Retest" label marks this opportunity. It provides a less risky entry point and tighter stops when price pulls back to test breakout levels and find support (or resistance).

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

When price remains within the opening range, traders can employ a mean reversion strategy by buying near the ORB lows and selling near the ORB highs. The midpoint line serves as a reference for the neutral position.

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

Best Time Range <br/>The indicator works best on 1-minute (M1) to 15-minute (M15) charts, where intraday price action is clearly visible. For a detailed analysis of the timing, the M5 timing range offers an excellent balance between noise reduction and responsiveness.

Applicable instruments
The ORB strategy is particularly effective for liquid instruments with clear opening trading periods:

This indicator performs best on instruments with clear trading sessions, rather than on 24-hour markets with no clear opening times.

The indicator includes several performance optimizations for smooth chart operations. The buffer is initialized to EMPTY_VALUE to prevent unnecessary line drawing, and the maxLineBars parameter limits the historical line length. The rectangle drawing logic waits until the session ends before rendering, reducing computational overhead during active transactions.

The object naming convention uses year-based unique identifiers to prevent conflicts when multiple ORB sessions are displayed simultaneously.

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

All chart elements follow professional formatting standards and feature customizable colors. The default color scheme uses lime for ORB high, red for ORB low, purple for 50% target, blue for 100% target, and cyan for extended target and shadow range boxes. This color-coding system allows for quick visual identification of key levels, even on busy charts.

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

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

The indicator's clear visual presentation and logical alert system make it suitable for discretionary traders and those developing automated trading systems. By focusing on key opening range cycles, it helps traders determine the most important support and resistance levels for each trading session.


Attachment download

📎 Open_Range_Breakout-H-Max.mq5 (27.38 KB)

Source: MQL5 #65361

Verification code Refresh