OPEN-SOURCE SCRIPT
DR/IDR Break .5 TP

DR/IDR Extension Breakout with Custom Stop
This strategy is a systematic, counter-trend, and momentum-based system designed for intraday trading. It operates on the principle of an Opening Range Breakout (ORB), utilizing the initial market consolidation to project high-probability targets, while offering multiple methods for managing risk.
1. Market Identification (The Opening Range)
The strategy begins by defining the market's initial boundaries and volatility:
Session Window: The strategy calculates the Opening Range (OR) over a user-defined time period (default: 9:30 AM to 10:30 AM New York Time).
ORB Levels: Two key price levels are established and locked once the time window closes:
Wick High/Low: The absolute highest and lowest prices of the session. These serve as the entry trigger lines.
Body High/Low (Shaded Range): The highest and lowest open/close prices of the session. The height of this range is used to calculate the Take Profit and Stop Loss levels.
2. Entry Rule (The Breakout)
The strategy is passive until the range is violated, looking for a strong move out of the consolidation area.
Trigger Condition: A trade is signaled when a candle closes either:
Above the Wick High (for a Long entry).
Below the Wick Low (for a Short entry).
Execution: The entry is a Market Order executed on the candle that meets the trigger condition, subject to a user-defined Entry Delay (default 0 bars, meaning the entry is taken immediately upon the breakout candle's close).
Direction Control: The user can select to trade Long Only, Short Only, or Both.
3. Exit and Risk Management
All trades are placed with simultaneous Take Profit and Stop Loss orders (a bracket order) once the entry is filled.
A. Take Profit (TP)
The Take Profit is set at the 0.5 Extension of the Shaded Range (Body Range).
Calculation: The distance from the Body High/Low to the TP level is exactly 50% of the total height of the Shaded Range.
B. Stop Loss (SL)
The Stop Loss is dynamically calculated based on a user-selected method for risk control:
Range 0.5 (Body Range): The Stop Loss is placed an equal distance (0.5 times the Body Range height) outside the opposite side of the Body Range.
Example (Long): If entry is above the Wick High, the SL is set 0.5 times the Body Range height below the Body Low.
ATR Multiple: The Stop Loss distance is determined by the asset's recent volatility.
Calculation: The distance is calculated as a user-defined Multiplier (default 2.0) times the Average True Range (ATR).
Recent Swing Low/High: The Stop Loss is placed based on a structural level defined by recent price action.
Long Entry: SL is placed at the Lowest Swing Low within a user-defined lookback period.
Short Entry: SL is placed at the Highest Swing High within a user-defined lookback period.
Summary of Workflow
The market sets the Wick and Body boundaries (e.g., 9:30–10:30 AM).
Price breaks and closes beyond a Wick boundary, triggering a signal.
The trade enters after the specified delay.
A bracket order is placed: TP is fixed at the 0.5 Extension, and SL is set based on the user's chosen risk method.
The trade is closed upon reaching either the TP or the SL level.
This strategy is a systematic, counter-trend, and momentum-based system designed for intraday trading. It operates on the principle of an Opening Range Breakout (ORB), utilizing the initial market consolidation to project high-probability targets, while offering multiple methods for managing risk.
1. Market Identification (The Opening Range)
The strategy begins by defining the market's initial boundaries and volatility:
Session Window: The strategy calculates the Opening Range (OR) over a user-defined time period (default: 9:30 AM to 10:30 AM New York Time).
ORB Levels: Two key price levels are established and locked once the time window closes:
Wick High/Low: The absolute highest and lowest prices of the session. These serve as the entry trigger lines.
Body High/Low (Shaded Range): The highest and lowest open/close prices of the session. The height of this range is used to calculate the Take Profit and Stop Loss levels.
2. Entry Rule (The Breakout)
The strategy is passive until the range is violated, looking for a strong move out of the consolidation area.
Trigger Condition: A trade is signaled when a candle closes either:
Above the Wick High (for a Long entry).
Below the Wick Low (for a Short entry).
Execution: The entry is a Market Order executed on the candle that meets the trigger condition, subject to a user-defined Entry Delay (default 0 bars, meaning the entry is taken immediately upon the breakout candle's close).
Direction Control: The user can select to trade Long Only, Short Only, or Both.
3. Exit and Risk Management
All trades are placed with simultaneous Take Profit and Stop Loss orders (a bracket order) once the entry is filled.
A. Take Profit (TP)
The Take Profit is set at the 0.5 Extension of the Shaded Range (Body Range).
Calculation: The distance from the Body High/Low to the TP level is exactly 50% of the total height of the Shaded Range.
B. Stop Loss (SL)
The Stop Loss is dynamically calculated based on a user-selected method for risk control:
Range 0.5 (Body Range): The Stop Loss is placed an equal distance (0.5 times the Body Range height) outside the opposite side of the Body Range.
Example (Long): If entry is above the Wick High, the SL is set 0.5 times the Body Range height below the Body Low.
ATR Multiple: The Stop Loss distance is determined by the asset's recent volatility.
Calculation: The distance is calculated as a user-defined Multiplier (default 2.0) times the Average True Range (ATR).
Recent Swing Low/High: The Stop Loss is placed based on a structural level defined by recent price action.
Long Entry: SL is placed at the Lowest Swing Low within a user-defined lookback period.
Short Entry: SL is placed at the Highest Swing High within a user-defined lookback period.
Summary of Workflow
The market sets the Wick and Body boundaries (e.g., 9:30–10:30 AM).
Price breaks and closes beyond a Wick boundary, triggering a signal.
The trade enters after the specified delay.
A bracket order is placed: TP is fixed at the 0.5 Extension, and SL is set based on the user's chosen risk method.
The trade is closed upon reaching either the TP or the SL level.
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.
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 or endorsed by TradingView. Read more in the Terms of Use.
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.
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 or endorsed by TradingView. Read more in the Terms of Use.