OPEN-SOURCE SCRIPT
Inside Day Breakout Strategy

# Inside Day Breakout Strategy
The **Inside Day Breakout Strategy** is a price action volatility breakout system designed to capture strong directional moves after periods of market compression.
An **Inside Day** occurs when the entire daily trading range remains inside the previous day’s range, reflecting temporary equilibrium between buyers and sellers. These low-volatility conditions are often followed by expansionary price movements, making the pattern ideal for breakout trading strategies.
The script automatically identifies Inside Day structures and places breakout stop orders above and below the Inside Day range.
---
# 📌 Strategy Concept
The core idea behind this strategy is simple:
> **Trade volatility expansion after price compression.**
When the market contracts into a smaller range, it often precedes a significant directional move. The strategy attempts to capture that move by entering only when price breaks beyond the Inside Day boundaries.
---
# 🔍 1. Inside Day Detection
An Inside Day is detected when the previous day’s range is fully contained within the range of two days ago.
Condition:
High_{1} < High_{2}\quad \text{and} \quad Low_{1} > Low_{2}
Where:
* **High₁** → Previous day high
* **Low₁** → Previous day low
* **High₂** → High from two days ago
* **Low₂** → Low from two days ago
This pattern represents:
* declining volatility
* temporary market balance
* potential breakout energy buildup
When the condition is met, the script highlights the setup visually on the chart.
---
# 🚀 2. Breakout Entry Logic
Once an Inside Day is confirmed, the strategy places pending breakout orders:
### Long Breakout
* Buy stop order above the previous day’s high
### Short Breakout
* Sell stop order below the previous day’s low
Supported trade modes:
* **Both Directions**
* **Long Only**
* **Short Only**
The strategy only allows one active directional position at a time to prevent overlapping exposure.
---
# 💰 3. Position Sizing
The strategy uses an aggressive **100% equity allocation model**.
Position size is dynamically calculated using:
* current account equity
* breakout entry price
This ensures the strategy continuously compounds position sizing based on account growth or drawdown.
---
# 🛡️ 4. Stop Loss Management
Risk management is based on the structure of the Inside Day itself.
### For Long Positions
* Stop Loss = Previous day low
### For Short Positions
* Stop Loss = Previous day high
This creates a clean structural invalidation level:
* if price re-enters the Inside Day range,
* the breakout thesis is considered invalid.
---
# 🎯 5. Optional ATR-Based Take Profit
The strategy optionally supports a fixed take profit target using Daily ATR.
Take profit distance:
TP\ Distance = Daily\ ATR \times Multiplier
### Long Position
* TP = Entry Price + ATR Distance
### Short Position
* TP = Entry Price − ATR Distance
If Take Profit is disabled:
* positions remain open until Stop Loss is triggered
* or until End-of-Day closing occurs
This allows traders to choose between:
* fixed reward targets
* or open-ended trend capture
---
# ⏰ 6. End-of-Day (EOD) Risk Management
To reduce overnight exposure and gap risk, the strategy can automatically close all positions at:
### **16:55 New York Time**
This occurs 5 minutes before market close.
EOD closing can be enabled or disabled through the strategy inputs.
---
# 🔔 7. Webhook Alert System
The script includes fully structured **JSON webhook alerts** for automation and external execution systems.
Alert payload includes:
* Strategy name
* Trading symbol
* Signal type
* Order action
* Entry/exit price
* Position size
* Net profit
* Win rate
* Current equity
* Timestamp
This makes the strategy compatible with:
* trading bots
* exchange APIs
* automation platforms
* copy trading systems
---
# ✨ Key Features
* Automatic Inside Day pattern detection
* Volatility breakout trading system
* Dynamic stop-entry breakout orders
* Optional ATR-based take profit
* Structural stop loss placement
* End-of-day auto close protection
* Webhook-ready JSON alerts
* Long-only / Short-only / Bi-directional modes
* Dynamic 100% equity position sizing
---
# 📈 Best Market Conditions
This strategy tends to perform best during:
✅ Volatility expansion phases
✅ Trending market environments
✅ Momentum-driven sessions
✅ Post-consolidation breakouts
---
# ⚠️ Challenging Market Conditions
Performance may weaken during:
❌ Choppy sideways markets
❌ False breakout environments
❌ Extremely low-volatility conditions
❌ Mean-reverting market behavior
---
# ⚠️ Risk Disclaimer
This strategy uses aggressive capital allocation by deploying **100% of account equity per trade**.
While this approach can maximize returns during strong trends, it can also significantly increase drawdowns during adverse market conditions.
Before using this strategy in live markets, traders should carefully evaluate:
* leverage usage
* slippage
* execution quality
* broker limitations
* personal risk tolerance
Always forward test and paper trade before deploying real capital.
The **Inside Day Breakout Strategy** is a price action volatility breakout system designed to capture strong directional moves after periods of market compression.
An **Inside Day** occurs when the entire daily trading range remains inside the previous day’s range, reflecting temporary equilibrium between buyers and sellers. These low-volatility conditions are often followed by expansionary price movements, making the pattern ideal for breakout trading strategies.
The script automatically identifies Inside Day structures and places breakout stop orders above and below the Inside Day range.
---
# 📌 Strategy Concept
The core idea behind this strategy is simple:
> **Trade volatility expansion after price compression.**
When the market contracts into a smaller range, it often precedes a significant directional move. The strategy attempts to capture that move by entering only when price breaks beyond the Inside Day boundaries.
---
# 🔍 1. Inside Day Detection
An Inside Day is detected when the previous day’s range is fully contained within the range of two days ago.
Condition:
High_{1} < High_{2}\quad \text{and} \quad Low_{1} > Low_{2}
Where:
* **High₁** → Previous day high
* **Low₁** → Previous day low
* **High₂** → High from two days ago
* **Low₂** → Low from two days ago
This pattern represents:
* declining volatility
* temporary market balance
* potential breakout energy buildup
When the condition is met, the script highlights the setup visually on the chart.
---
# 🚀 2. Breakout Entry Logic
Once an Inside Day is confirmed, the strategy places pending breakout orders:
### Long Breakout
* Buy stop order above the previous day’s high
### Short Breakout
* Sell stop order below the previous day’s low
Supported trade modes:
* **Both Directions**
* **Long Only**
* **Short Only**
The strategy only allows one active directional position at a time to prevent overlapping exposure.
---
# 💰 3. Position Sizing
The strategy uses an aggressive **100% equity allocation model**.
Position size is dynamically calculated using:
* current account equity
* breakout entry price
This ensures the strategy continuously compounds position sizing based on account growth or drawdown.
---
# 🛡️ 4. Stop Loss Management
Risk management is based on the structure of the Inside Day itself.
### For Long Positions
* Stop Loss = Previous day low
### For Short Positions
* Stop Loss = Previous day high
This creates a clean structural invalidation level:
* if price re-enters the Inside Day range,
* the breakout thesis is considered invalid.
---
# 🎯 5. Optional ATR-Based Take Profit
The strategy optionally supports a fixed take profit target using Daily ATR.
Take profit distance:
TP\ Distance = Daily\ ATR \times Multiplier
### Long Position
* TP = Entry Price + ATR Distance
### Short Position
* TP = Entry Price − ATR Distance
If Take Profit is disabled:
* positions remain open until Stop Loss is triggered
* or until End-of-Day closing occurs
This allows traders to choose between:
* fixed reward targets
* or open-ended trend capture
---
# ⏰ 6. End-of-Day (EOD) Risk Management
To reduce overnight exposure and gap risk, the strategy can automatically close all positions at:
### **16:55 New York Time**
This occurs 5 minutes before market close.
EOD closing can be enabled or disabled through the strategy inputs.
---
# 🔔 7. Webhook Alert System
The script includes fully structured **JSON webhook alerts** for automation and external execution systems.
Alert payload includes:
* Strategy name
* Trading symbol
* Signal type
* Order action
* Entry/exit price
* Position size
* Net profit
* Win rate
* Current equity
* Timestamp
This makes the strategy compatible with:
* trading bots
* exchange APIs
* automation platforms
* copy trading systems
---
# ✨ Key Features
* Automatic Inside Day pattern detection
* Volatility breakout trading system
* Dynamic stop-entry breakout orders
* Optional ATR-based take profit
* Structural stop loss placement
* End-of-day auto close protection
* Webhook-ready JSON alerts
* Long-only / Short-only / Bi-directional modes
* Dynamic 100% equity position sizing
---
# 📈 Best Market Conditions
This strategy tends to perform best during:
✅ Volatility expansion phases
✅ Trending market environments
✅ Momentum-driven sessions
✅ Post-consolidation breakouts
---
# ⚠️ Challenging Market Conditions
Performance may weaken during:
❌ Choppy sideways markets
❌ False breakout environments
❌ Extremely low-volatility conditions
❌ Mean-reverting market behavior
---
# ⚠️ Risk Disclaimer
This strategy uses aggressive capital allocation by deploying **100% of account equity per trade**.
While this approach can maximize returns during strong trends, it can also significantly increase drawdowns during adverse market conditions.
Before using this strategy in live markets, traders should carefully evaluate:
* leverage usage
* slippage
* execution quality
* broker limitations
* personal risk tolerance
Always forward test and paper trade before deploying real capital.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.