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
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.