OPEN-SOURCE SCRIPT
15m ORB + FVG Strategy (ChadAnt)

Core Logic
The indicator's logic revolves around three main phases:
1. Defining the 15-Minute Opening Range (ORB)
The script calculates the highest high (rangeHigh) and lowest low (rangeLow) that occurred during the first 15 minutes of the trading day.
This time window is defined by the sessionStr input, which defaults to 0930-0945 (exchange time).
The high and low of this range are plotted as small gray dots once the session ends (rangeSet = true).
2. Identifying a Fair Value Gap (FVG) Setup
After the 15-minute range is set, the indicator waits for a breakout of either the range high or range low.
A "Strict FVG breakout" requires two conditions on the first candle that closes beyond the range:
The candle before the breakout candle ([2] bars ago) must have been inside the range.
The breakout candle ([1] bar ago) must have closed outside the range.
A Fair Value Gap (FVG) must form on the most recent three candles (the current bar and the two previous bars).
Bullish FVG (Long Setup): The low of the current bar (low) is greater than the high of the bar two periods prior (high[2]). This FVG represents a price inefficiency that the trade expects to fill.
Bearish FVG (Short Setup): The high of the current bar (high) is less than the low of the bar two periods prior (low[2]).
If a valid FVG setup occurs, the indicator marks a pending setup and draws a colored box to highlight the FVG area (Green for Bullish FVG, Red for Bearish FVG).
3. Trade Entry and Management
If a pending setup is identified, the trade is structured as a re-entry trade into the FVG zone:
Entry Price: Set at the outer boundary of the FVG, which is the low of the current bar for a Long setup, or the high of the current bar for a Short setup.
Stop Loss (SL): Set at the opposite boundary of the FVG, which is the low[2] for a Long setup, or the high[2] for a Short setup.
The trade is triggered (tradeActive = true) once the price retraces to the pendingEntry level.
Risk/Reward (RR) Targets: Three Take Profit (TP) levels are calculated based on the distance between the Entry and Stop Loss:
$$\text{Risk} = | \text{Entry} - \text{SL} |$$
$$\text{TP}n = \text{Entry} \pm (\text{Risk} \times \text{RR}n)$$
where $n$ is 1, 2, or 3, corresponding to the input $\text{RR}1$, $\text{RR}2$, and $\text{RR}3$ values (defaults: 1.0, 1.5, and 2.0).
Trade Lines: Upon triggering, lines for the Entry, Stop Loss, and three Take Profit levels are drawn on the chart for a specified length (lineLength).
A crucial feature is the directional lock (highBroken / lowBroken):
If the price breaks a range level (e.g., simpleBrokeHigh) but without a valid FVG setup, the corresponding directional flag (e.g., highBroken) is set to true permanently for the day.
This prevents the indicator from looking for any subsequent trade setups in that direction for the rest of the day, suggesting that the initial move, without an FVG, exhausted the opportunity.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
ChadAnt
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied
The indicator's logic revolves around three main phases:
1. Defining the 15-Minute Opening Range (ORB)
The script calculates the highest high (rangeHigh) and lowest low (rangeLow) that occurred during the first 15 minutes of the trading day.
This time window is defined by the sessionStr input, which defaults to 0930-0945 (exchange time).
The high and low of this range are plotted as small gray dots once the session ends (rangeSet = true).
2. Identifying a Fair Value Gap (FVG) Setup
After the 15-minute range is set, the indicator waits for a breakout of either the range high or range low.
A "Strict FVG breakout" requires two conditions on the first candle that closes beyond the range:
The candle before the breakout candle ([2] bars ago) must have been inside the range.
The breakout candle ([1] bar ago) must have closed outside the range.
A Fair Value Gap (FVG) must form on the most recent three candles (the current bar and the two previous bars).
Bullish FVG (Long Setup): The low of the current bar (low) is greater than the high of the bar two periods prior (high[2]). This FVG represents a price inefficiency that the trade expects to fill.
Bearish FVG (Short Setup): The high of the current bar (high) is less than the low of the bar two periods prior (low[2]).
If a valid FVG setup occurs, the indicator marks a pending setup and draws a colored box to highlight the FVG area (Green for Bullish FVG, Red for Bearish FVG).
3. Trade Entry and Management
If a pending setup is identified, the trade is structured as a re-entry trade into the FVG zone:
Entry Price: Set at the outer boundary of the FVG, which is the low of the current bar for a Long setup, or the high of the current bar for a Short setup.
Stop Loss (SL): Set at the opposite boundary of the FVG, which is the low[2] for a Long setup, or the high[2] for a Short setup.
The trade is triggered (tradeActive = true) once the price retraces to the pendingEntry level.
Risk/Reward (RR) Targets: Three Take Profit (TP) levels are calculated based on the distance between the Entry and Stop Loss:
$$\text{Risk} = | \text{Entry} - \text{SL} |$$
$$\text{TP}n = \text{Entry} \pm (\text{Risk} \times \text{RR}n)$$
where $n$ is 1, 2, or 3, corresponding to the input $\text{RR}1$, $\text{RR}2$, and $\text{RR}3$ values (defaults: 1.0, 1.5, and 2.0).
Trade Lines: Upon triggering, lines for the Entry, Stop Loss, and three Take Profit levels are drawn on the chart for a specified length (lineLength).
A crucial feature is the directional lock (highBroken / lowBroken):
If the price breaks a range level (e.g., simpleBrokeHigh) but without a valid FVG setup, the corresponding directional flag (e.g., highBroken) is set to true permanently for the day.
This prevents the indicator from looking for any subsequent trade setups in that direction for the rest of the day, suggesting that the initial move, without an FVG, exhausted the opportunity.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
ChadAnt
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.