ORB Laboratory v1.0.12 — Strategy by DominicFerri
By DominicFerri
Performance Metrics
- Author: DominicFerri
- Symbol: CRYPTO:LINKUSD
- Timeframe: 1 minute
- Win Rate: 30.0%
- Profit Factor: 0.847
Description
ORB LABORATORY v1.0.12Opening Range Breakout Research & Backtesting FrameworkORB Laboratory is a modular Opening Range Breakout strategy designed for systematic research, backtesting, robustness testing, and experimentation across different markets, sessions, symbols, timeframes, execution assumptions, and ORB methodologies.This is not a single hard-coded ORB strategy.The purpose of ORB Laboratory is to provide a flexible environment where traders and researchers can isolate individual variables, compare different approaches to opening-range behavior, and test whether an idea remains viable under different conditions rather than relying on one fixed set of rules.The script includes multiple ORB sessions, seven entry models, configurable breakout buffers, several confirmation methods, market-condition filters, multiple stop-loss and profit-target models, position sizing, trade-frequency controls, execution modeling, breakeven and trailing-stop management, forced exits, and visual/debugging tools.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━1. MULTI-SESSION ORB ENGINE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ORB Laboratory supports up to three independent Opening Range windows:• ORB 1• ORB 2• ORB 3Each ORB can be configured independently with:• Enable / Disable• Custom session name• Starting hour• Starting minute• ORB duration in minutes• Long trades enabled / disabled• Short trades enabled / disabledThis makes it possible to research multiple market opens or intraday expansion periods within the same strategy.Examples could include:• New York open• London open• Secondary morning range• Later-session expansion• Crypto-specific session windows• Custom event-based time windowsORB lengths can range from very short opening ranges to much longer windows.The strategy continuously tracks the highest high and lowest low while an ORB is forming.When the ORB finishes, the final:• ORB High• ORB Low• ORB Midpointare stored and projected forward on the chart.The ORB is finalized on the close of the final range-building bar so resting breakout orders can be prepared before the first post-range bar begins.The implementation also supports one-bar ORBs correctly.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━2. STRATEGY TIME ZONE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━The entire strategy uses a configurable strategy time zone.This allows ORB sessions, entry cutoffs, forced closes, weekdays, and other time-sensitive logic to remain anchored to the desired market time regardless of the exchange or chart time zone.Default:America/New_York━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━3. DIRECTION CONTROL━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Global direction can be set to:• Both• Long Only• Short OnlyEach individual ORB also has independent Long and Short permissions.This means direction can be controlled both globally and per session.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━4. ENTRY ALLOWANCE / TRADE FREQUENCY━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ORB Laboratory includes several trade-frequency modes:ONE TOTALOnly one entry may be taken from an ORB.ONCE PER DIRECTIONAllows one long and one short opportunity per ORB.MAXIMUM NUMBERAllows a configurable maximum number of entries per ORB.UNLIMITEDRemoves the per-ORB entry restriction while remaining subject to other global limits.Additional controls include:• Maximum entries per ORB• Maximum entries per day• Stop trading after first winning trade• Stop trading after first losing trade• Maximum planned daily riskThese tools make it possible to research whether an ORB performs better as a single-shot setup, one trade per direction, or as a multi-entry strategy.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━5. ENTRY MODEL — BREAKOUT (TOUCH)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Breakout (Touch) is designed to model a traditional stop-order breakout.After the ORB is complete, resting stop entries are prepared at:Long:ORB High + Long Breakout BufferShort:ORB Low - Short Breakout BufferThe entry can therefore occur when price touches the breakout threshold rather than waiting for a candle close.The strategy uses resting stop orders for this mode.Long and short breakout orders are placed into an OCA cancellation group.When one side fills, competing unfilled breakout orders are cancelled.This allows the strategy to model a two-sided opening-range breakout where both directions may initially be armed but only the triggered side remains active.Unfilled Breakout (Touch) orders are also cancelled when the configured entry cutoff is reached.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━6. ENTRY MODEL — BREAKOUT (CLOSE)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Breakout (Close) requires confirmation from the candle close.Long:Candle closes above the ORB High + Long Breakout Buffer.Short:Candle closes below the ORB Low - Short Breakout Buffer.This model is useful for comparing immediate touch-based breakout execution against the additional confirmation of a completed candle outside the range.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━7. ENTRY MODEL — BREAK + RETEST ORB━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━This model waits for a confirmed breakout and then looks for price to retest the broken ORB boundary.After a breakout, the retest can be confirmed using one of three methods:TOUCH ONLYPrice only needs to return to the broken ORB boundary.CLOSE OUTSIDEPrice must retest the boundary and close back on the breakout side.REJECTION CANDLEPrice must retest the boundary and produce directional rejection.For a bullish retest, the candle must interact with the ORB High and confirm back above it.For a bearish retest, the candle must interact with the ORB Low and confirm back below it.Additional controls include:• Retest expiry in bars• Maximum extension before a retest is considered too lateOnce a valid retest is consumed, the retest setup is disarmed.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━8. ENTRY MODEL — BREAK + RETEST FVG━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ORB Laboratory includes directional Fair Value Gap detection following an ORB breakout.A bullish FVG is detected when a three-candle imbalance exists with the current low above the high from two bars earlier.A bearish FVG is detected when the current high is below the low from two bars earlier.The minimum FVG size can be defined as an ATR multiple.Optional logic can require the FVG to remain outside the ORB.Three FVG entry depths are available:NEAR EDGEUses the first edge of the FVG encountered on the retracement.MIDPOINTUses the 50% level of the FVG.FULL FILLRequires price to reach the opposite edge of the FVG.Additional controls include:• Minimum FVG size as ATR ו FVG must remain outside ORB• FVG expiry in barsIf price reaches the selected FVG level while the setup is valid, an entry is submitted in the direction of the original breakout.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━9. ENTRY MODEL — SWEEP REVERSAL━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Sweep Reversal is designed to research failed breaks of the opening range.A high sweep occurs when price trades above:ORB High + Long Breakout Bufferbut then closes back below the ORB High.A low sweep occurs when price trades below:ORB Low - Short Breakout Bufferbut then closes back above the ORB Low.Two confirmation modes are available:CLOSE BACK INSIDEThe breakout only needs to fail and close back inside the ORB.REJECTION CANDLEThe failed breakout must also produce a directional rejection candle.A failed high produces a potential short setup.A failed low produces a potential long setup.Sweep trades are treated as fade/reversal trades and can use dedicated fade-target logic.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━10. ENTRY MODEL — FADE FIRST BREAKOUT━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━This model records which side of the ORB breaks first.The strategy permanently tracks:• First breakout direction• First breakout bar• Maximum extension reached by that breakoutIf the first breakout subsequently fails and closes back inside the ORB within the configured failure window, the strategy can fade that failed move.First high breakout fails:Potential short.First low breakout fails:Potential long.The model also includes a Maximum Extension Before Retest/Fade setting.This prevents an extremely extended move from later being treated as a normal failed breakout simply because price eventually returns to the range.A configurable First-Break Failure Timeout controls how many bars the setup remains eligible.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━11. ENTRY MODEL — FIRST-BREAK DECISION TREE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━The First-Break Decision Tree is a hybrid model that evaluates what happens after the first ORB break.Instead of automatically assuming that the first breakout should either be followed or faded, the script waits to determine whether the move confirms continuation or fails.The first breakout direction and extreme are recorded.Continuation can then be defined as:TOUCHPrice reaches the breakout threshold.CLOSE OUTSIDEPrice closes outside the ORB in the breakout direction.RETEST HOLDSPrice retests the broken boundary and closes back on the breakout side.If continuation confirms, the strategy trades in the direction of the original breakout.If the first breakout instead fails and closes back inside the ORB during the allowed failure window, the strategy can reverse and trade against the failed breakout.This allows a single model to test both:• Breakout continuation• Failed-break reversalusing the first interaction with the opening range as the decision point.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━12. BREAKOUT BUFFER SYSTEM━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Long and short breakout buffers are independently configurable.Buffers can be expressed using:TICKSBuffer is based on the symbol's minimum tick size.ORB %Buffer is calculated as a percentage of the completed ORB range.ATRBuffer is calculated as a multiple of ATR.This allows breakout confirmation to be normalized in several different ways.For example, researchers can test whether a fixed one-tick breakout behaves differently from a volatility-adjusted or range-adjusted breakout.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━13. BID / ASK TRIGGER MODEL━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Breakout (Touch) includes an optional bid/ask trigger-timing model.Application can be set to:• Off• Longs Only• Shorts Only• BothSpread can be entered as:• Ticks• Absolute priceThe model allows the visible TradingView trigger to be shifted relative to the intended execution level.For example, on a bid-based chart, a long ask-trigger may occur while the visible bid remains one spread below the intended buy price.The model therefore allows researchers to approximate the difference between:• Structural/intended execution level• Visible chart trigger levelIMPORTANT:TradingView Strategy Tester still records the chart-trigger price as the actual historical fill.Because of this limitation, built-in Strategy Tester P&L remains an approximation when bid/ask trigger modeling is enabled.The feature is intended for execution research and timing approximation, not as a claim of perfect historical bid/ask reconstruction.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━14. BID / ASK STOP MODEL━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ORB Laboratory separately includes a spread model for stop-loss triggering.Application options include:• Off• Long Stops Only• Short Stops Only• BothThis allows the displayed TradingView stop trigger to be shifted relative to the structural stop by the modeled spread.The structural stop itself is still retained internally for calculations when desired.This makes the entry-side spread assumption and stop-side spread assumption independently configurable.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━15. ENTRY CALCULATION PRICE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━When spread modeling is active, Fixed-R calculations can use either:CORRECTED ENTRYUses the intended execution level.CHART TRIGGERUses the spread-shifted TradingView trigger.This setting affects Fixed-R target calculations.It does not independently change the actual submitted quantity or order execution.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━16. STOP CALCULATION PRICE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Risk calculations can use either:CORRECTED STOPUses the modeled spread-adjusted stop.ORIGINAL STOPUses the underlying structural stop.This selection can affect:• Position sizing• Original risk calculation• Fixed-R target calculationsThis allows researchers to separate structural price levels from the levels used to approximate executable stop behavior.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━17. EMA FILTER━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━An optional EMA directional filter is included.The EMA length is configurable.Available rules:PRICE VS EMALong:Price must be above the EMA.Short:Price must be below the EMA.EMA SLOPELong:EMA must be rising.Short:EMA must be falling.BOTHRequires both the appropriate price relationship and EMA slope.When enabled, the EMA is also plotted on the chart.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━18. VWAP FILTER━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━An optional VWAP directional filter is available.Rules include:PRICE VS VWAPLong:Price above VWAP.Short:Price below VWAP.VWAP SLOPELong:VWAP rising.Short:VWAP falling.BOTHRequires both conditions.When enabled, VWAP is plotted directly on the chart.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━19. PREVIOUS CLOSE FILTER━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━The script retrieves the confirmed previous daily close without lookahead.Two filtering modes are available:PRICE VS PREVIOUS CLOSELong:Current price must be above the previous close.Short:Current price must be below the previous close.ORB VS PREVIOUS CLOSELong:The entire ORB must be above the previous close.Short:The entire ORB must be below the previous close.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━20. ORB RANGE FILTER━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━A configurable minimum and maximum ORB range filter is included.The ORB size can be measured in:• Ticks• ATR multiples• Percentage of priceThis allows researchers to reject ranges that are considered:• Too small• Too large• Abnormally compressed• Abnormally volatileIt also makes range thresholds more portable across different symbols and volatility environments.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━21. RELATIVE VOLUME FILTER━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━An optional relative-volume condition compares current volume with a moving average of volume.Controls include:• Volume average length• Minimum relative-volume multiplierA trade is permitted only when current volume meets or exceeds the selected multiple of average volume.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━22. ADX FILTER━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━An optional ADX filter is included.Controls:• ADX length• Minimum ADX valueThis can be used to research whether ORB setups behave differently during stronger or weaker directional conditions.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━23. MAXIMUM BREAKOUT CANDLE SIZE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━The strategy can reject entry conditions when the current candle becomes excessively large relative to ATR.Maximum breakout candle size is expressed as:ATR × multiplierThis can be used to study whether chasing unusually extended breakout candles damages expectancy.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━24. STOP LOSS — CANDLE EXTREME━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━For long trades:Stop is placed below the relevant candle low, with an optional tick buffer.For short trades:Stop is placed above the relevant candle high, with an optional tick buffer.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━25. STOP LOSS — ATR━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Places the stop a configurable ATR distance from the entry/reference price.Long:Entry/reference price - ATR × multiplierShort:Entry/reference price + ATR × multiplier━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━26. STOP LOSS — ORB MIDPOINT━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Uses the midpoint between the ORB High and ORB Low as the structural stop.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━27. STOP LOSS — ORB OPPOSITE RANGE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Long:Stop below the ORB Low.Short:Stop above the ORB High.An optional stop buffer in ticks can be applied beyond the opposite boundary.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━28. STOP LOSS — BREAKOUT EXTREME━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Uses the relevant breakout extreme as the stop reference, with the optional stop buffer applied beyond that level.This is useful for retest, failure, sweep, and other models where the breakout structure itself provides the invalidation point.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━29. STOP LOSS — ORB PERCENTAGE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Stop distance is calculated as a configurable percentage of the completed ORB range.This allows the stop distance to scale directly with the size of the opening range.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━30. STOP LOSS — FVG INVALIDATION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Uses the relevant FVG boundary as the stop reference.Long:Below the FVG bottom.Short:Above the FVG top.The configured stop buffer may also be applied.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━31. STOP BUFFER━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━A configurable stop buffer can be added in ticks.This allows the structural stop to sit beyond the selected invalidation level rather than directly on it.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━32. PROFIT TARGET — FIXED R━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Profit target is calculated as a multiple of the original trade risk.Long:Entry + Risk × R MultipleShort:Entry - Risk × R MultipleThe R multiple is fully configurable.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━33. PROFIT TARGET — ORB PROJECTION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Projects a configurable multiple of the complete ORB range beyond the breakout boundary.Long:ORB High + ORB Range × multiplierShort:ORB Low - ORB Range × multiplier━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━34. PROFIT TARGET — ATR━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Sets the target a configurable ATR multiple away from entry.Long:Entry + ATR × multiplierShort:Entry - ATR × multiplier━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━35. PROFIT TARGET — ORB MIDPOINT━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Uses the ORB midpoint as the target.This can be useful when researching reversal or mean-reversion behavior.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━36. PROFIT TARGET — ORB OPPOSITE RANGE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Targets the opposite ORB boundary.This is especially useful for studying moves that rotate from one side of the range toward the other.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━37. DEDICATED FADE TARGETS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Fade/reversal entries can use their own target preference:• Midpoint• Opposite Boundary• Fixed RThis allows continuation trades and fade trades to be researched using different exit logic.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━38. POSITION SIZING — FIXED USD RISK━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Position size can be calculated so the planned loss between entry and stop corresponds to a fixed dollar amount.The script calculates:• Entry-to-stop distance• Cash risk per unit• Required quantityand then rounds quantity according to the configured quantity step.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━39. POSITION SIZING — RISK % OF EQUITY━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Position size can dynamically scale with strategy equity.The selected percentage of current equity is divided by the calculated cash risk per unit to determine quantity.This allows compounding-based position sizing to be researched.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━40. POSITION SIZING — FIXED QUANTITY━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━A fixed position size can be used instead of risk-based sizing.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━41. QUANTITY CONSTRAINTS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Position sizing supports:• Quantity step• Minimum quantity• Maximum quantityCalculated quantity is stepped downward to the permitted increment and then constrained within the configured minimum and maximum.This makes sizing adaptable to instruments with different contract or quantity requirements.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━42. MAXIMUM DAILY PLANNED RISK━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━An optional daily planned-risk ceiling can prevent new entries when another planned trade would push total daily risk above the configured limit.A value of zero disables this restriction.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━43. STOP AFTER FIRST WIN━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━When enabled, the strategy prevents further entries after the first profitable closed trade of the day.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━44. STOP AFTER FIRST LOSS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━When enabled, the strategy prevents further entries after the first losing closed trade of the day.These two controls can be used independently to study daily stopping rules.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━45. ENTRY CUTOFF━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━A configurable time prevents new entries after a chosen hour and minute.For Breakout (Touch), any remaining unfilled resting breakout orders are cancelled when the cutoff is reached.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━46. FORCE CLOSE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━An optional forced-close time exits any remaining open position at or after the configured time.This is useful for strictly intraday strategies that should not carry positions beyond a session boundary.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━47. WEEKDAY FILTERS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Every day of the week can be independently enabled or disabled:• Monday• Tuesday• Wednesday• Thursday• Friday• Saturday• SundayThis allows weekday effects to be researched without modifying the strategy code.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━48. BREAKEVEN MANAGEMENT━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━An optional breakeven system can move the active stop after price reaches a configurable R multiple.Controls:• Breakeven activation R• Breakeven offset in ticksFor a long position, the stop can move to entry plus the selected offset.For a short position, the stop can move to entry minus the selected offset.The stop is only tightened; the logic does not intentionally loosen an existing stop.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━49. BAR-CLOSE ATR TRAILING STOP━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━An optional ATR trailing system activates after the trade reaches a configurable R threshold.The strategy tracks the best confirmed close reached during the trade.After activation:Long:Trail candidate = Best Close - Entry ATR × Trail MultiplierShort:Trail candidate = Best Close + Entry ATR × Trail MultiplierThe stop only ratchets in the favorable direction.The trailing logic operates on confirmed bars.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━50. TIME-BASED EXIT━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Positions can optionally be closed after a specified number of bars.Setting the value to zero disables the time exit.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━51. ONE ACTIVE POSITION / NO PYRAMIDING━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━The strategy is configured with pyramiding disabled.New setups also require the strategy to be flat before entry.This keeps the framework focused on one active position at a time rather than stacking multiple simultaneous positions.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━52. OCA BREAKOUT ORDER MANAGEMENT━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Breakout (Touch) orders use One-Cancels-All behavior.When one resting breakout order fills, competing unfilled touch orders are cancelled.The strategy then records the filled ORB, direction, stop, target, entry ATR, and original risk for active position management.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━53. ORB VISUALIZATION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Optional ORB boxes display the opening-range construction directly on the chart.Once complete, the script extends:• ORB High• ORB Low• Optional ORB Midpointforward on the chart.This allows the strategy logic to be inspected visually rather than only through Strategy Tester results.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━54. SIGNAL LABELS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Optional labels identify strategy entries and their originating logic.Examples include:• Breakout Touch Fill• Breakout Close• ORB Retest• FVG Retest• High Sweep• Low Sweep• Fade First High Break• Fade First Low Break• Decision: Continuation• Decision: Failed High• Decision: Failed Low━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━55. BLOCKED-REASON DEBUGGING━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Optional debugging labels can show why an otherwise evaluated setup was blocked.Possible reasons include:• Direction disabled• Range filter• Entry / daily limit• Bias / condition filter• Other blocked conditionThis feature is designed to make strategy research easier by showing not only where entries occurred, but also why expected entries did not occur.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━56. ACTIVE STOP & TARGET PLOTS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━While a position is open, the strategy can display:• Active Stop• Active Targetdirectly on the chart.Stops dynamically reflect breakeven or trailing-stop adjustments when those systems are active.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━57. RESEARCH DASHBOARD━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━An optional dashboard displays current strategy information including:• Selected Entry Model• Daily Entries vs Maximum• Planned Daily Risk• EMA Bias• VWAP Bias• Previous Daily Close• Current Position: Long / Short / Flat• Entry Cutoff TimeThe dashboard provides a compact view of the currently active configuration and state.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━58. PREVIOUS DAILY CLOSE WITHOUT LOOKAHEAD━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━The previous-close feature retrieves confirmed daily data using lookahead disabled and then references the prior confirmed daily close.This avoids intentionally using future daily information in the previous-close filter.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━59. RESEARCH-FIRST DESIGN━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ORB Laboratory is intentionally modular.Many settings are not intended to be enabled simultaneously.The purpose is to allow individual hypotheses to be isolated.Examples:• Does Touch outperform Close confirmation?• Does requiring a retest improve expectancy?• Are failed first breaks more useful as fades?• Does the ORB midpoint outperform an ATR stop?• Does an EMA or VWAP filter improve results?• Are very small or very large ORBs less effective?• Does a breakout buffer improve robustness?• Does performance survive different stop models?• Does Fixed-R outperform range projection?• How sensitive are results to spread assumptions?• How does limiting entries affect drawdown?• Do certain weekdays behave differently?• Does breakeven improve or damage expectancy?The framework is designed to answer those questions with data rather than intuition.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━IMPORTANT BACKTESTING NOTES━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ORB Laboratory is a research and backtesting tool.Historical results can change significantly based on:• Symbol• Exchange / broker data feed• Timeframe• ORB session• ORB length• Entry model• Breakout buffer• Stop model• Target model• Position sizing• Spread assumptions• Commission• Slippage• Filters• Test period• Market regimeDifferent data feeds can produce different highs and lows and therefore different ORB boundaries, triggers, stops, targets, and trade sequences.Results from one feed should not be assumed to reproduce another feed trade-for-trade.The optional bid/ask modeling system is an approximation built around TradingView's historical-chart limitations.TradingView may still report the chart trigger as the historical fill even when the strategy is using a corrected/intended price internally for risk or target calculations.Users should configure TradingView's Strategy Properties appropriately for the instrument and execution assumptions being researched, including commissions and any additional slippage assumptions.No backtest guarantees future results.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━INTENDED USE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ORB Laboratory is intended for:• Strategy research• Backtesting• Robustness testing• Parameter sensitivity testing• Comparing ORB entry models• Comparing stop and target logic• Studying opening-range behavior• Execution-model research• Market and data-feed comparison• Educational experimentationIt is not intended to provide financial advice, guaranteed signals, or guaranteed profitability.A profitable historical configuration may fail in future market conditions.Users should independently validate any configuration before considering live execution.Build the range.Define the rules.Stress the assumptions.Test the edge.