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
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.