
The Breakout Trend Reversal Exit Strategy is a quantitative trading system based on price breakouts of historical high and low points, combined with trend reversal signals as an exit mechanism. This strategy monitors the highest and lowest prices of the past three trading days, executing entries when prices break through these key levels and exiting positions when opposite breakout signals appear. This approach captures short-term price momentum while promptly cutting losses or securing profits when trends change, forming a complete trading cycle.
The core principles of this strategy are based on price breakouts and trend reversals:
high3 = ta.highest(high[1], 3)
low3 = ta.lowest(low[1], 3)
longEntry = close > high3
shortEntry = close < low3
isLong = strategy.position_size > 0
isShort = strategy.position_size < 0
wasLong = nz(strategy.position_size[1] > 0)
wasShort = nz(strategy.position_size[1] < 0)
longExit = shortEntry
shortExit = longEntry
Simple and Effective: The strategy is based on straightforward price action principles, easy to understand and implement without complex technical indicators, reducing the risk of overfitting.
Highly Adaptive: By using relatively recent three-day high/low points as references, the strategy can adapt to different market environments and volatility conditions, being neither too sensitive nor too sluggish.
Clear Entry and Exit Rules: The strategy provides definitive entry signals and exit conditions, eliminating subjective judgment during the trading process and helping maintain trading discipline.
Trend Reversal Protection: Using trend reversals as exit signals allows rapid position closure when market direction changes, effectively controlling drawdowns and protecting accumulated profits.
Complete Money Management: The strategy employs a percentage-of-equity approach to position sizing, which is more flexible than fixed lot sizes and automatically adjusts trading volume as account size changes.
Clear Visual Feedback: Through buy, sell, and exit markers on the strategy chart, traders can visually understand strategy execution, facilitating backtesting analysis and strategy optimization.
False Breakout Risk: Markets may experience short-term false breakouts, causing the strategy to face immediate adverse movement after entry, resulting in unnecessary trading costs and losses. Solution: Add confirmation filters, such as volume confirmation or wait for price to remain at breakout level for a certain period.
Frequent Trading Risk: In highly volatile markets, prices may frequently break through three-day high/low points, leading to overtrading and commission erosion. Solution: Extend the reference period or add a cooling period to reduce trading frequency.
Lack of Stop-Loss Mechanism: The current strategy relies solely on reverse trend signals for exits, which may lead to significant losses under extreme market conditions. Solution: Add fixed stop-loss or volatility-adjusted stop-loss mechanisms as additional protection.
Market Gap Risk: After overnight gaps or major news events, prices may gap significantly, causing actual entry or exit prices to be far from expected. Solution: Set maximum allowed slippage or use stop orders.
Trend-Absent Environment Risk: In range-bound markets, the three-day breakout strategy may perform poorly, generating multiple false signals. Solution: Add market state filters to apply the strategy only in environments with clear trends.
Optimize Reference Period: The current fixed three-day reference period may not be suitable for all market conditions. Consider implementing dynamic adjustment of the reference period based on market volatility, using longer periods in highly volatile markets and shorter periods in low volatility markets.
Add Filtering Conditions: Additional filtering conditions can be introduced to improve signal quality, such as:
Enhance Exit Mechanisms: Beyond trend reversal exits, multiple exit mechanisms can be added:
Introduce Partial Position Management: The current strategy uses 100% equity percentage trading; consider dynamically adjusting position size based on signal strength or market conditions, increasing positions on stronger signals and reducing positions on weaker signals.
Add Timeframe Filtering: Confirm trend direction on longer timeframes and only trade in the direction consistent with the long-term trend to reduce the risk of counter-trend trading. This multi-timeframe analysis can significantly improve the strategy’s success rate.
The Three-Day Breakout Trend Reversal Exit Strategy combines price breakout and trend following principles, using short-term price high/low points to construct entry signals while utilizing reverse breakouts as exit mechanisms. The strategy’s strengths lie in its simple concept, clear rules, and strong adaptability, making it suitable for both beginners and experienced traders. However, the strategy also faces risks of false breakouts, overtrading, and lacks comprehensive stop-loss mechanisms. By optimizing the reference period, adding filtering conditions, enhancing exit mechanisms, and introducing smarter position management, the strategy’s stability and profitability can be significantly improved. This strategy is particularly suitable for market environments with clear trends, while requiring caution or additional filtering conditions in range-bound markets.
/*backtest
start: 2025-03-30 00:00:00
end: 2025-04-29 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("3-Day Breakout Strategy with Trend Change Exit", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === Calculate 3-day high/low (excluding current bar) ===
high3 = ta.highest(high[1], 3)
low3 = ta.lowest(low[1], 3)
// === Entry conditions ===
longEntry = close > high3
shortEntry = close < low3
// === Track position state ===
isLong = strategy.position_size > 0
isShort = strategy.position_size < 0
wasLong = nz(strategy.position_size[1] > 0)
wasShort = nz(strategy.position_size[1] < 0)
// === Exit conditions ===
// Exit on trend reversal (new signal)
longExit = shortEntry // Exit long position when a short signal occurs
shortExit = longEntry // Exit short position when a long signal occurs
// === Execute entries ===
buySignal = longEntry and not isLong and not isShort
sellSignal = shortEntry and not isLong and not isShort
if (buySignal)
strategy.entry("Long", strategy.long)
if (sellSignal)
strategy.entry("Short", strategy.short)
// === Execute exits on opposite signal (trend change) ===
if (isLong and longExit)
strategy.close("Long")
if (isShort and shortExit)
strategy.close("Short")
// === Exit markers (on actual exit bar only) ===
exitLongSignal = wasLong and not isLong
exitShortSignal = wasShort and not isShort
// === Plot entry signals only on the entry bar ===
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// === Plot exit signals only on the exit bar ===
plotshape(exitLongSignal, title="Exit Long", location=location.abovebar, color=color.orange, style=shape.labeldown, text="EXIT")
plotshape(exitShortSignal, title="Exit Short", location=location.belowbar, color=color.orange, style=shape.labelup, text="EXIT")