INVITE-ONLY SCRIPT
Break & Retest of ORB (Backtesting)

Break & Retest v4.5 — What it does
Goal: Trade a single “break + retest” of the configurable Opening Range (OR) during a specific time window, with clean risk/return control and optional volume and side filters.
1) Define today’s Opening Range
2) Detect the first clean break
3) Wait for the retest (entry signal)
Inside that window:
4) Invalidation (one-time alert)
5) Risk & reward
6) Limits and session management
7) Visuals & alerts
Goal: Trade a single “break + retest” of the configurable Opening Range (OR) during a specific time window, with clean risk/return control and optional volume and side filters.
1) Define today’s Opening Range
- You choose the OR start time (Eastern Time) and the OR length in minutes (e.g., 9:30–9:45 ET).
- At the first bar of that OR window (on the chosen OR resolution), the script captures:
- Range High (ORH) and Range Low (ORL).
- The OR is drawn with configurable line and fill colors.
2) Detect the first clean break
- After the OR is set, the script waits for the first breakout past ORH or ORL.
- The break must move at least minBreakPts and at most maxBreakPts beyond the boundary (keeps out tiny pokes and runaway moves).
- If price first breaks above ORH, we mark a bullish break.
- If price first breaks below ORL, we mark a bearish break.
3) Wait for the retest (entry signal)
- From the breakout bar, a retest window opens for a fixed number of 1-minute bars: between minRetestBars and maxRetestBars.
Inside that window:
- Long setup (after bullish break): we require a bar whose low trades back into the range (between ORL and ORH). That is the “retest”.
- Short setup (after bearish break): we require a bar whose high trades back into the range.
- Entries can be restricted to a custom entry time window (ET) and optionally gated by a minimum volume.
- You can enable/disable longs or shorts independently.
4) Invalidation (one-time alert)
- If a bullish break later sees price dip below ORL, or a bearish break later sees price pop above ORH, the script flags a “First Invalidation” and prints a label once (with the reason).
- This is informational; it doesn’t auto-lock the system, but it’s a strong “structure broken” signal.
5) Risk & reward
- Stop loss (points) can be:
- Default: (ORH − ORL) + 1 point, capped at stopLossCap, or
- Custom fixed number of points.
- Take profit (points) can be:
- Default: RR × SL (not less than minTPpts), or
- Custom fixed (capped by maxTPpts logic in the input).
- When a trade fires, the script draws risk/reward boxes from the entry candle forward and (optionally) shows live R:R labels updating over time.
6) Limits and session management
- Daily entry cap: At most maxRetestsPerDay retest entries per day.
- Forced exit: Close any open position at a custom ET time (e.g., 12:00 ET).
- Daily reset: At 00:00 ET, the strategy resets its internal state for the new session (drawings remain on the chart).
7) Visuals & alerts
- OR high/low lines and the fill are color-configurable.
- Risk/Reward boxes and their transparency are configurable.
- A one-time alert fires on the first invalidation of the day.
- TL;DR workflow
- Build the OR at your chosen time and length.
- Wait for the first valid break (not too small/large).
- Look for a timely retest back into the range (long: bar low inside range; short: bar high inside range), within your entry window and volume filter.
- Enter with your chosen SL/TP scheme; track boxes and (optionally) live R:R labels.
- Respect the daily cap and force-exit time; reset at midnight ET.
仅限邀请脚本
只有经作者批准的用户才能访问此脚本。您需要申请并获得使用权限。该权限通常在付款后授予。如需了解更多详情,请按照以下作者的说明操作,或直接联系codyxbustamante。
除非您完全信任其作者并了解脚本的工作原理,否則TradingView不建议您付费或使用脚本。您还可以在我们的社区脚本中找到免费的开源替代方案。
作者的说明
Please send an email to BustamanteXLLC@gmail.com to request access
提醒:在请求访问权限之前,请阅读仅限邀请脚本指南。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
仅限邀请脚本
只有经作者批准的用户才能访问此脚本。您需要申请并获得使用权限。该权限通常在付款后授予。如需了解更多详情,请按照以下作者的说明操作,或直接联系codyxbustamante。
除非您完全信任其作者并了解脚本的工作原理,否則TradingView不建议您付费或使用脚本。您还可以在我们的社区脚本中找到免费的开源替代方案。
作者的说明
Please send an email to BustamanteXLLC@gmail.com to request access
提醒:在请求访问权限之前,请阅读仅限邀请脚本指南。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。