OPEN-SOURCE SCRIPT
Hybrid Trend-Following Inside Bar Breakout

Hybrid Trend-Following Inside Bar Breakout Strategy
The Hybrid Trend-Following Inside Bar Breakout Strategy is a rule-based trading system designed to capture strong directional moves while controlling risk during uncertain market conditions. It combines trend-following, price action, and volatility-based risk management into a single robust framework.
Core Concept
The strategy trades inside bar breakouts only in the direction of the dominant market trend. Inside bars represent periods of consolidation, and when price breaks out of this consolidation in a trending market, it often leads to impulsive moves with favorable risk–reward characteristics.
Key Components
1. Trend Filter
This filter prevents counter-trend trades and improves trade quality.
2. Volatility Filter
3. Inside Bar Breakout
4. Candle Quality Filter
Requires a minimum body-to-range ratio, ensuring that the breakout candle has strong momentum and is not driven by weak wicks.
Risk Management & Trade Management
Stop Loss (SL)
Partial Profit Taking
Trailing Stop
Cooldown Mechanism
Why This Strategy Works
Trades only high-probability breakouts in trending markets
Adapts automatically to changing volatility
Combines price action precision with systematic risk control
Designed for consistent performance over long historical periods
The Hybrid Trend-Following Inside Bar Breakout Strategy is a rule-based trading system designed to capture strong directional moves while controlling risk during uncertain market conditions. It combines trend-following, price action, and volatility-based risk management into a single robust framework.
Core Concept
The strategy trades inside bar breakouts only in the direction of the dominant market trend. Inside bars represent periods of consolidation, and when price breaks out of this consolidation in a trending market, it often leads to impulsive moves with favorable risk–reward characteristics.
Key Components
1. Trend Filter
- Uses 50 EMA and 200 EMA to define the market trend.
- Bullish bias: 50 EMA above 200 EMA
- Bearish bias: 50 EMA below 200 EMA
This filter prevents counter-trend trades and improves trade quality.
2. Volatility Filter
- Compares fast ATR (14) with slow ATR (50).
- Trades are taken only when volatility is expanding or above a minimum threshold.
- This avoids low-volatility, choppy market conditions.
3. Inside Bar Breakout
- An inside bar forms when the current candle’s high is lower than the previous candle’s high and the low is higher than the previous candle’s low.
- A trade is triggered only when price breaks above or below the inside bar range in the direction of the trend.
4. Candle Quality Filter
Requires a minimum body-to-range ratio, ensuring that the breakout candle has strong momentum and is not driven by weak wicks.
Risk Management & Trade Management
Stop Loss (SL)
- Placed using ATR-based dynamic stops, adapting to current market volatility.
- Prevents tight stops in volatile conditions and wide stops in calm markets.
Partial Profit Taking
- 50% of the position is exited at 1.5R, locking in profits early.
- This reduces psychological pressure and improves equity stability.
Trailing Stop
- After partial profit is taken, the remaining position is managed with an ATR-based trailing stop.
- Allows the strategy to capture large trend moves while protecting gains.
Cooldown Mechanism
- After a losing trade, the system enters a cooldown period and skips a fixed number of bars.
- This helps avoid revenge trading and overtrading during unfavorable market phases.
Why This Strategy Works
Trades only high-probability breakouts in trending markets
Adapts automatically to changing volatility
Combines price action precision with systematic risk control
Designed for consistent performance over long historical periods
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。