OPEN-SOURCE SCRIPT

Luxy BIG beautiful Dynamic ORB

2 973
This is an advanced Opening Range Breakout (ORB) indicator that tracks price breakouts from the first 5, 15, 30, and 60 minutes of the trading session. It provides complete trade management including entry signals, stop-loss placement, take-profit targets, and position sizing calculations.

The ORB strategy is based on the concept that the opening range of a trading session often acts as support/resistance, and breakouts from this range tend to lead to significant moves.

快照


What Makes This Different?

Most ORB indicators simply draw horizontal lines and leave you to figure out the rest. This indicator goes several steps further:

Multi-Stage Tracking
Instead of just one ORB timeframe, this tracks FOUR simultaneously (5min, 15min, 30min, 60min). Each stage builds on the previous one, giving you multiple trading opportunities throughout the session.

Active Trade Management
When a breakout occurs, the indicator automatically calculates and displays entry price, stop-loss, and multiple take-profit targets. These lines extend forward and update in real-time until the trade completes.

Cycle Detection
Unlike indicators that only show the first breakout, this tracks the complete cycle: Breakout → Retest → Re-breakout. You can see when price returns to test the ORB level after breaking out (potential re-entry).

Failed Breakout Warning
If price breaks out but quickly returns inside the range (within a few bars), the label changes to "FAILED BREAK" - warning you to exit or avoid the trade.

Position Sizing Calculator
Built-in risk management that tells you exactly how many shares to buy based on your account size and risk tolerance. No more guessing or manual calculations.

Advanced Filtering
Optional filters for volume confirmation, trend alignment, and Fair Value Gaps (FVG) to reduce false signals and improve win rate.

快照


Core Features Explained

### 1. Multi-Stage ORB Levels

The indicator builds four separate Opening Range levels:

  • ORB 5 - First 5 minutes (fastest signals, most volatile)
  • ORB 15 - First 15 minutes (balanced, most popular)
  • ORB 30 - First 30 minutes (slower, more reliable)
  • ORB 60 - First 60 minutes (slowest, most confirmed)


Each level is drawn as a horizontal range on your chart. As time progresses, the ranges expand to include more price action. You can enable or disable any stage and assign custom colors to each.

How it works: During the opening minutes, the indicator tracks the highest high and lowest low. Once the time period completes, those levels become your ORB high and low for that stage.

### 2. Breakout Detection

When price closes outside the ORB range, a label appears:

  • BREAK UP (green label above price) - Price closed above ORB High
  • BREAK DOWN (red label below price) - Price closed below ORB Low


The label shows which ORB stage triggered (ORB5, ORB15, etc.) and the cycle number if tracking multiple breakouts.

Important: Signals appear on bar close only - no repainting. What you see is what you get.

### 3. Retest Detection

After price breaks out and moves away, if it returns to test the ORB level, a "RETEST" label appears (orange). This indicates:

  • The original breakout level is now acting as support/resistance
  • Potential re-entry opportunity if you missed the first breakout
  • Confirmation that the level is significant


The indicator requires price to move a minimum distance away before considering it a valid retest (configurable in settings).

### 4. Failed Breakout Detection

If price breaks out but returns inside the ORB range within a few bars (before the breakout is "committed"), the original label changes to "FAILED BREAK" in orange.

This warns you:
  • The breakout lacked conviction
  • Consider exiting if already in the trade
  • Wait for better setup


Committed Breakout: The indicator tracks how many bars price stays outside the range. Only after staying outside for the minimum number of bars does it become a committed breakout that can be retested.

快照

### 5. TP/SL Lines (Trade Management)

When a breakout occurs, colored horizontal lines appear showing:

  • Entry Line (cyan for long, orange for short) - Your entry price (the ORB level)
  • Stop Loss Line (red) - Where to exit if trade goes against you
  • TP1, TP2, TP3 Lines (same color as entry) - Profit targets at 1R, 2R, 3R


These lines extend forward as new bars form, making it easy to track your trade. When a target is hit, the line turns green and the label shows a checkmark.

Lines freeze (stop updating) when:
  • Stop loss is hit
  • The final enabled take-profit is hit
  • End of trading session (optional setting)


### 6. Position Sizing Dashboard

The dashboard (bottom-left corner by default) shows real-time information:

  • Current ORB stage and range size
  • Breakout status (Inside Range / Break Up / Break Down)
  • Volume confirmation (if filter enabled)
  • Trend alignment (if filter enabled)
  • Entry and Stop Loss prices
  • All enabled Take Profit levels with percentages
  • Risk/Reward ratio
  • Position sizing: Max shares to buy and total risk amount


Position Sizing Example:
If your account is $25,000 and you risk 1% per trade ($250), and the distance from entry to stop loss is $0.50, the calculator shows you can buy 500 shares (250 / 0.50 = 500).

快照

### 7. FVG Filter (Fair Value Gap)

Fair Value Gaps are price inefficiencies - gaps left by strong momentum where one candle's high doesn't overlap with a previous candle's low (or vice versa).

When enabled, this filter:
  • Detects bullish and bearish FVGs
  • Draws semi-transparent boxes around these gaps
  • Only allows breakout signals if there's an FVG near the breakout level


Why this helps: FVGs indicate institutional activity. Breakouts through FVGs tend to be stronger and more reliable.

Proximity setting: Controls how close the FVG must be to the ORB level. 2.0x means the breakout can be within 2 times the FVG size - a reasonable default.

### 8. Volume & Trend Filters

Volume Filter:
Requires current volume to be above average (customizable multiplier). High volume breakouts are more likely to sustain.

  • Set minimum multiplier (e.g., 1.5x = 50% above average)
  • Set "strong volume" multiplier (e.g., 2.5x) that bypasses other filters
  • Dashboard shows current volume ratio


Trend Filter:
Only shows breakouts aligned with a higher timeframe trend. Choose from:
  • VWAP - Price above/below volume-weighted average
  • EMA - Price above/below exponential moving average
  • SuperTrend - ATR-based trend indicator
  • Combined modes (VWAP+EMA, VWAP+SuperTrend) for stricter filtering


### 9. Pullback Filter (Advanced)

Purpose:
Waits for price to pull back slightly after initial breakout before confirming the signal.
This reduces false breakouts from immediate reversals.

How it works:
- After breakout is detected, indicator waits for a small pullback (default 2%)
- Once pullback occurs AND price breaks out again, signal is confirmed
- If no pullback within timeout period (5 bars), signal is issued anyway

Settings:
  • Enable Pullback Filter: Turn this filter on/off
  • Pullback %: How much price must pull back (2% is balanced)
  • Timeout (bars): Max bars to wait for pullback (5 is standard)


When to use:
- Choppy markets with many fake breakouts
- When you want higher quality signals
- Combine with Volume filter for maximum confirmation

Trade-off:
- Better signal quality
- May miss some valid fast moves
- Slight entry delay

快照

How to Use This Indicator

### For Beginners - Simple Setup

  1. Add the indicator to your chart (5-minute or 15-minute timeframe recommended)
  2. Leave all default settings - they work well for most stocks
  3. Watch for BREAK UP or BREAK DOWN labels to appear
  4. Check the dashboard for entry, stop loss, and targets
  5. Use the position sizing to determine how many shares to buy


Basic Trading Plan:
  • Wait for a clear breakout label
  • Enter at the ORB level (or next candle open if you're late)
  • Place stop loss where the red line indicates
  • Take profit at TP1 (50% of position) and TP2 (remaining 50%)


### For Advanced Traders - Customized Setup

  1. Choose which ORB stages to track (you might only want ORB15 and ORB30)
  2. Enable filters: Volume (stocks) or Trend (trending markets)
  3. Enable FVG filter for institutional confirmation
  4. Set "Track Cycles" mode to catch retests and re-breakouts
  5. Customize stop loss method (ATR for volatile stocks, ORB% for stable ones)
  6. Adjust risk per trade and account size for accurate position sizing


Advanced Strategy Example:
  • Enable ORB15 only (disable others for cleaner chart)
  • Turn on Volume filter at 1.5x with Strong at 2.5x
  • Enable Trend filter using VWAP
  • Set Signal Mode to "Track Cycles" with Max 3 cycles
  • Wait for aligned breakouts (Volume + Trend + Direction)
  • Enter on retest if you missed the initial break


### Timeframe Recommendations

  • 5-minute chart: Scalping, very active trading, crypto
  • 15-minute chart: Day trading, balanced approach (most popular)
  • 30-minute chart: Swing entries, less screen time
  • 60-minute chart: Position trading, longer holds


The indicator works on any intraday timeframe, but ORB is fundamentally a day trading strategy. Daily charts don't make sense for ORB.

Pine Script®
DEFAULT CONFIGURATION ON by Default: • All 4 ORB stages (5/15/30/60) • Breakout Detection • Retest Labels • All TP levels (1/1.5/2/3) • TP/SL Lines (Detailed mode) • Dashboard (Bottom Left, Dark theme) • Position Size Calculator OFF by Default (Optional Filters): • FVG Filter • Pullback Filter • Volume Filter • Trend Filter • HTF Bias Check • Alerts Recommended for Beginners: • Leave all defaults • Session Mode: Auto-Detect • Signal Mode: Track Cycles • Stop Method: ATR • Add Volume Filter if trading stocks Recommended for Advanced: • Enable ORB15 + ORB30 only (disable 5 & 60) • Enable: Volume + Trend + FVG • Signal Mode: Track Cycles, Max 3 • Stop Method: ATR or Safer • Enable HTF Daily bias check


## Settings Guide

The settings are organized into logical groups. Here's what each section controls:

### ORB COLORS Section

  • Show Edge Labels: Display "ORB 5", "ORB 15" labels at the right edge of the levels
  • Background: Fill the area between ORB high/low with color
  • Transparency: How see-through the background is (95% is nearly invisible)
  • Enable ORB 5/15/30/60: Turn each stage on or off individually
  • Colors: Assign colors to each ORB stage for easy identification


### SESSION SETTINGS Section

  • Session Mode: Choose trading session (Auto-Detect works for most instruments)
  • Custom Session Hours: Define your own hours if needed (format: HHMM-HHMM)


Auto-Detect uses the instrument's natural hours (stocks use exchange hours, crypto uses 24/7).

### BREAKOUT DETECTION Section

  • Enable Breakout Detection: Master switch for signals
  • Show Retest Labels: Display retest signals
  • Label Size: Visual size for all labels (Small recommended)
  • Enable FVG Filter: Require Fair Value Gap confirmation
  • Show FVG Boxes: Display the gap boxes on chart
  • Signal Mode: "First Only" = one signal per direction per day, "Track Cycles" = multiple signals
  • Max Cycles: How many breakout-retest cycles to track (6 is balanced)
  • Breakout Buffer: Extra distance required beyond ORB level (0.1-0.2% recommended)
  • Min Distance for Retest: How far price must move away before retest is valid (2% recommended)
  • Min Bars Outside ORB: Bars price must stay outside for committed breakout (2 is balanced)


### TARGETS & RISK Section

  • Enable Targets & Stop-Loss: Calculate and show trade management
  • TP1/TP2/TP3 checkboxes: Select which profit targets to display
  • Stop Method: How to calculate stop loss placement
    - ATR: Based on volatility (best for most cases)
    - ORB %: Fixed % of ORB range
    - Swing: Recent swing high/low
    - Safer: Widest of all methods
  • ATR Length & Multiplier: Controls ATR stop distance (14 period, 1.5x is standard)
  • ORB Stop %: Percentage beyond ORB for stop (20% is balanced)
  • Swing Bars: Lookback period for swing high/low (3 is recent)


### TP/SL LINES Section

  • Show TP/SL Lines: Display horizontal lines on chart
  • Label Format: "Short" = minimal text, "Detailed" = shows prices
  • Freeze Lines at EOD: Stop extending lines at session close


### DASHBOARD Section

  • Show Info Panel: Display the metrics dashboard
  • Theme: Dark or Light colors
  • Position: Where to place dashboard on chart
  • Toggle rows: Show/hide specific information rows
  • Calculate Position Size: Enable the position sizing calculator
  • Risk Mode: Risk fixed $ amount or % of account
  • Account Size: Your total trading capital
  • Risk %: Percentage to risk per trade (0.5-1% recommended)


### VOLUME FILTER Section

  • Enable Volume Filter: Require volume confirmation
  • MA Length: Average period (20 is standard)
  • Min Volume: Required multiplier (1.5x = 50% above average)
  • Strong Volume: Multiplier that bypasses other filters (2.5x)


### TREND FILTER Section

  • Enable Trend Filter: Require trend alignment
  • Trend Mode: Method to determine trend (VWAP is simple and effective)
  • Custom EMA Length: If using EMA mode (50 for swing, 20 for day trading)
  • SuperTrend settings: Period and Multiplier if using SuperTrend mode


### HIGHER TIMEFRAME Section

  • Check Daily Trend: Display higher timeframe bias in dashboard
  • Timeframe: What TF to check (D = daily, recommended)
  • Method: Price vs MA (stable) or Candle Direction (reactive)
  • MA Period: EMA length for Price vs MA method (20 is balanced)
  • Min Strength %: Minimum strength threshold for HTF bias to be considered
    - For "Price vs MA": Minimum distance (%) from moving average
    - For "Candle Direction": Minimum candle body size (%)
    - 0.5% is balanced - increase for stricter filtering
    - Lower values = more signals, higher values = only strong trends


### ALERTS Section

  • Enable Alerts: Master switch (must be ON to use any alerts)
  • Breakout Alerts: Notify on ORB breakouts
  • Retest Alerts: Notify when price retests after breakout
  • Failed Break Alerts: Notify on failed breakouts
  • Stage Complete Alerts: Notify when each ORB stage finishes forming


After enabling desired alert types, click "Create Alert" button, select this indicator, choose "Any alert() function call".

## Tips & Best Practices

### General Trading Tips

  • ORB works best on liquid instruments (stocks with good volume, major crypto pairs)
  • First hour of the session is most important - that's when ORB is forming
  • Breakouts WITH the trend have higher success rates - use the trend filter
  • Failed breakouts are common - use the "Min Bars Outside" setting to filter weak moves
  • Not every day produces good ORB setups - be patient and selective


### Position Sizing Best Practices

  • Never risk more than 1-2% of your account on a single trade
  • Use the built-in calculator - don't guess your position size
  • Update your account size monthly as it grows
  • Smaller accounts: use $ Amount mode for simplicity
  • Larger accounts: use % of Account mode for scaling


### Take Profit Strategy

  • Most traders use: 50% at TP1, 50% at TP2
  • Aggressive: Hold through TP1 for TP2 or TP3
  • Conservative: Full exit at TP1 (1:1 risk/reward)
  • After TP1 hits, consider moving stop to breakeven
  • TP3 rarely hits - only on strong trending days


### Filter Combinations

  • Maximum Quality: Volume + Trend + FVG (fewest signals, highest quality)
  • Balanced: Volume + Trend (good quality, reasonable frequency)
  • Active Trading: No filters or Volume only (many signals, lower quality)
  • Trending Markets: Trend filter essential (indices, crypto)
  • Range-Bound: Volume + FVG (avoid trend filter)


### Common Mistakes to Avoid

  • Chasing breakouts - wait for the bar to close, don't FOMO into wicks
  • Ignoring the stop loss - always use it, move it manually if needed
  • Over-leveraging - the calculator shows MAX shares, you can buy less
  • Trading every signal - quality > quantity, use filters
  • Not tracking results - keep a journal to see what works for YOU


## Pros and Cons

### Advantages

  • Complete all-in-one solution - from signal to position sizing
  • Multiple timeframes tracked simultaneously
  • Visual clarity - easy to see what's happening
  • Cycle tracking catches opportunities others miss
  • Built-in risk management eliminates guesswork
  • Customizable filters for different trading styles
  • No repainting - what you see is locked in
  • Works across multiple markets (stocks, forex, crypto)


### Limitations

  • Intraday strategy only - doesn't work on daily charts
  • Requires active monitoring during first 1-2 hours of session
  • Not suitable for after-hours or extended sessions by default
  • Can produce many signals in choppy markets (use filters)
  • Dashboard can be overwhelming for complete beginners
  • Performance depends on market conditions (trends vs ranges)
  • Requires understanding of risk management concepts


### Best For

  • Day traders who can watch the first 1-2 hours of market open
  • Traders who want systematic entry/exit rules
  • Those learning proper position sizing and risk management
  • Active traders comfortable with multiple signals per day
  • Anyone trading liquid instruments with clear sessions


### Not Ideal For

  • Swing traders holding multi-day positions
  • Set-and-forget / passive investors
  • Traders who can't watch market open
  • Complete beginners unfamiliar with trading concepts
  • Low volume / illiquid instruments


## Frequently Asked Questions

Q: Why are no signals appearing?
A: Check that you're on an intraday timeframe (5min, 15min, etc.) and that the current time is within your session hours. Also verify that "Enable Breakout Detection" is ON and at least one ORB stage is enabled. If using filters, they might be blocking signals - try disabling them temporarily.

Q: What's the best ORB stage to use?
A: ORB15 (15 minutes) is most popular and balanced. ORB5 gives faster signals but more noise. ORB30 and ORB60 are slower but more reliable. Many traders use ORB15 + ORB30 together.

Q: Should I enable all the filters?
A: Start with no filters to see all signals. If too many false signals, add Volume filter first (stocks) or Trend filter (trending markets). FVG filter is most restrictive - use for maximum quality but fewer signals.

Q: How do I know which stop loss method to use?
A: ATR works for most cases - it adapts to volatility. Use ORB% if you want predictable stop placement. Swing is for respecting chart structure. Safer gives you the most room but largest risk.

Q: Can I use this for swing trading?
A: Not really - ORB is fundamentally an intraday strategy. The ranges reset each day. For swing trading, look at weekly support/resistance or moving averages instead.

Q: Why do TP/SL lines disappear sometimes?
A: Lines freeze (stop extending) when: stop loss is hit, the last enabled take-profit is hit, or end of session arrives (if "Freeze at EOD" is enabled). This is intentional - the trade is complete.

Q: What's the difference between "First Only" and "Track Cycles"?
A: "First Only" shows one breakout UP and one DOWN per day maximum - clean but might miss opportunities. "Track Cycles" shows breakout-retest-rebreak sequences - more signals but busier chart.

Q: Is position sizing accurate for options/forex?
A: The calculator is designed for shares (stocks). For options, ignore the share count and use the risk amount. For forex, you'll need to adapt the lot size calculation manually.

Q: How much capital do I need to use this?
A: The indicator works for any account size, but practical day trading typically requires $25,000 in the US due to Pattern Day Trader rules. Adjust the "Account Size" setting to match your capital.

Q: Can I backtest this strategy?
A: This is an indicator, not a strategy script, so it doesn't have built-in backtesting. You can visually review historical signals or code a strategy script using similar logic.

Q: Why does the dashboard show different entry price than the breakout label?
A: If you're looking at an old breakout, the ORB levels may have changed when the next stage completed. The dashboard always shows the CURRENT active range and trade setup.

Q: What's a good win rate to expect?
A: ORB strategies typically see 40-60% win rate depending on market conditions and filters used. The strategy relies on positive risk/reward ratios (2:1 or better) to be profitable even with moderate win rates.

Q: Does this work on crypto?
A: Yes, but crypto trades 24/7 so you need to define what "session start" means. Use Session Mode = Custom and set your preferred daily reset time (e.g., 0000-2359 UTC).

## Credits & Transparency

### Development

This indicator was developed with the assistance of AI technology to implement complex ORB trading logic.

The strategy concept, feature specifications, and trading logic were designed by the publisher. The implementation leverages modern development tools to ensure:
  • Clean, efficient, and maintainable code
  • Comprehensive error handling and input validation
  • Detailed documentation and user guidance
  • Performance optimization


### Trading Concepts

This indicator implements several public domain trading concepts:

  • Opening Range Breakout (ORB): Trading strategy popularized by Toby Crabel, Mark Fisher and many more talanted traders.
  • Fair Value Gap (FVG): Price imbalance concept from ICT methodology
  • SuperTrend: ATR-based trend indicator using public formula
  • Risk/Reward Ratio: Standard risk management principle


All mathematical formulas and technical concepts used are in the public domain.

### Pine Script
Uses standard TradingView built-in functions:
Pine Script®
ta.ema(), ta.atr(), ta.vwap(), ta.highest(), ta.lowest(), request.security()


No external libraries or proprietary code from other authors.

## Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice.

Trading involves substantial risk of loss and is not suitable for every investor. Past performance shown in examples is not indicative of future results.

The indicator provides signals and calculations, but trading decisions are solely your responsibility. Always:
  • Test strategies on paper before using real money
  • Never risk more than you can afford to lose
  • Understand that all trading involves risk
  • Consider seeking advice from a licensed financial advisor


The publisher makes no guarantees regarding accuracy, profitability, or performance. Use at your own risk.

---

Version: 3.0
Pine Script Version: v6
Last Updated: October 2024

For support, questions, or suggestions, please comment below or send a private message.

---

Happy trading, and remember: consistent risk management beats perfect entry timing every time.

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。