OPEN-SOURCE SCRIPT
Opening Range Break LRS

This script is designed for a trend-following, opening range breakout strategy. The main idea is to only trade breakouts that happen in the same direction as the short-term trend, which the script identifies using a linear regression slope.
1. Identify the Short-Term Trend
This is the first and most important step. The script does this for you using the Linear Regression and the bar coloring.
• If the bars are colored BLUE: The linear regression slope is positive. This means the script considers the short-term trend to be UP. A trader using this script would only look for long (buy) trades.
• If the bars are colored YELLOW: The linear regression slope is negative. This means the script considers the short-term trend to be DOWN. A trader using this script would only look for short (sell) trades.
This filter is designed to prevent you from trading a "false breakout" against the immediate momentum.
2. Watch the Opening Ranges Form
At the start of the trading session (8:30 AM by default), the script will begin drawing boxes for the 5, 15, 30, and 60-minute opening ranges you've enabled.
• The 5-minute box (e.g., gray) will be set after the 8:30 - 8:35 period.
• The 15-minute box (e.g., blue) will be set after the 8:30 - 8:45 period.
• ...and so on.
These boxes, which extend for the rest of the day, represent the key high and low levels established at the open. The "Live Box Extension" input simply keeps the right edge of the box a few bars away from the current price so you can see it clearly.
3. Look for a Filtered Breakout Signal
This is where the trend filter (Step 1) and the range boxes (Step 2) come together.
Bullish Trade Example (Long):
1. A trader sees the bars are colored BLUE (uptrend). They are now only looking for a break above one of the ORB highs.
2. They will ignore any break below the ORB lows, as that would be trading against the trend filter.
3. The price moves up and finally closes above the 15-minute ORB high.
4. The script will plot a green "Break 15" label. This is the trader's signal to enter a long trade.
Bearish Trade Example (Short):
1. A trader sees the bars are colored YELLOW (downtrend). They are now only looking for a break below one of the ORB lows.
2. They will ignore any break above the ORB highs.
3. The price moves down and closes below the 5-minute ORB low.
4. The script will plot a red "Break 5" label. This is the trader's signal to enter a short trade.
4. Use Multiple Timeframes for Context
The real power of this script is seeing all the ranges at once. A trader wouldn't just trade them in isolation.
• Confirmation: A "Break 5" signal is a quick, early signal. But if the price also breaks the "15" and "30" minute highs, it signals much stronger bullish consensus, which might encourage the trader to hold the trade longer.
• Support & Resistance: The other ORB levels act as a map for the day.
o As Targets: If a trader takes a "Break 15" long signal, the 30-minute ORB high and 60-minute ORB high become logical profit targets.
o As Warning Signs: If the price gives a "Break 5" long signal but is struggling right under the 15-minute high, a trader might wait for that 15-minute level to break before entering, seeing it as a key resistance level.
Summary: A Trader's Workflow
1. Morning (8:30 AM): Watch the script. What color are the bars? (Blue = longs only, Yellow = shorts only).
2. Wait: Let the 5, 15, 30, and 60-minute ranges form. The boxes will be drawn on the chart.
3. Execute: Wait for a "Break" signal (a label) that matches your trend direction.
4. Manage: Use the other ORB levels as potential profit targets or as confirmation of the move's strength.
5. Single Signal: The "Single Signal Only" input, if checked, ensures they only get one signal per timeframe (e.g., one "Break 15" long, and that's it for the day), which helps prevent over-trading in choppy conditions.
1. Identify the Short-Term Trend
This is the first and most important step. The script does this for you using the Linear Regression and the bar coloring.
• If the bars are colored BLUE: The linear regression slope is positive. This means the script considers the short-term trend to be UP. A trader using this script would only look for long (buy) trades.
• If the bars are colored YELLOW: The linear regression slope is negative. This means the script considers the short-term trend to be DOWN. A trader using this script would only look for short (sell) trades.
This filter is designed to prevent you from trading a "false breakout" against the immediate momentum.
2. Watch the Opening Ranges Form
At the start of the trading session (8:30 AM by default), the script will begin drawing boxes for the 5, 15, 30, and 60-minute opening ranges you've enabled.
• The 5-minute box (e.g., gray) will be set after the 8:30 - 8:35 period.
• The 15-minute box (e.g., blue) will be set after the 8:30 - 8:45 period.
• ...and so on.
These boxes, which extend for the rest of the day, represent the key high and low levels established at the open. The "Live Box Extension" input simply keeps the right edge of the box a few bars away from the current price so you can see it clearly.
3. Look for a Filtered Breakout Signal
This is where the trend filter (Step 1) and the range boxes (Step 2) come together.
Bullish Trade Example (Long):
1. A trader sees the bars are colored BLUE (uptrend). They are now only looking for a break above one of the ORB highs.
2. They will ignore any break below the ORB lows, as that would be trading against the trend filter.
3. The price moves up and finally closes above the 15-minute ORB high.
4. The script will plot a green "Break 15" label. This is the trader's signal to enter a long trade.
Bearish Trade Example (Short):
1. A trader sees the bars are colored YELLOW (downtrend). They are now only looking for a break below one of the ORB lows.
2. They will ignore any break above the ORB highs.
3. The price moves down and closes below the 5-minute ORB low.
4. The script will plot a red "Break 5" label. This is the trader's signal to enter a short trade.
4. Use Multiple Timeframes for Context
The real power of this script is seeing all the ranges at once. A trader wouldn't just trade them in isolation.
• Confirmation: A "Break 5" signal is a quick, early signal. But if the price also breaks the "15" and "30" minute highs, it signals much stronger bullish consensus, which might encourage the trader to hold the trade longer.
• Support & Resistance: The other ORB levels act as a map for the day.
o As Targets: If a trader takes a "Break 15" long signal, the 30-minute ORB high and 60-minute ORB high become logical profit targets.
o As Warning Signs: If the price gives a "Break 5" long signal but is struggling right under the 15-minute high, a trader might wait for that 15-minute level to break before entering, seeing it as a key resistance level.
Summary: A Trader's Workflow
1. Morning (8:30 AM): Watch the script. What color are the bars? (Blue = longs only, Yellow = shorts only).
2. Wait: Let the 5, 15, 30, and 60-minute ranges form. The boxes will be drawn on the chart.
3. Execute: Wait for a "Break" signal (a label) that matches your trend direction.
4. Manage: Use the other ORB levels as potential profit targets or as confirmation of the move's strength.
5. Single Signal: The "Single Signal Only" input, if checked, ensures they only get one signal per timeframe (e.g., one "Break 15" long, and that's it for the day), which helps prevent over-trading in choppy conditions.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.