Tracking Breakout Strategy
Overview
This strategy mainly uses the “Donchian Channel” indicator to implement a tracking breakout trading strategy. The strategy combines trend following and breakout trading ideas, seeking breakout points in shorter cycles based on identification of the major trend, in order to trade along the trend. In addition, the strategy sets stop loss and take profit levels to control the risk/reward of each trade. Overall, the strategy has the advantage of tracking the trend, and trading in the direction of the major trend.
Strategy Logic
-
Set parameters for “Donchian Channel” indicator, default period is 20;
-
Set EMA moving average, default period is 200;
-
Set risk/reward ratio, default is 1.5;
-
Set pullback parameters after breakout for long and short;
-
Record if previous breakout was a high or low point;
-
Long signal: if previous breakout was a low, price breaks above Donchian upper band and above EMA line;
-
Short signal: if previous breakout was a high, price breaks below Donchian lower band and below EMA line;
-
After long entry, set stop loss at Donchian lower band minus 5 points, take profit at risk/reward ratio times stop loss distance;
-
After short entry, set stop loss at Donchian upper band plus 5 points, take profit at risk/reward ratio times stop loss distance.
In this way, the strategy combines trend following and breakout trading, to trade along with major trend. Meanwhile, stop loss and take profit controls the risk/reward of each trade.
Advantage Analysis
-
Follow major trend, avoid trading against the trend.
-
Donchian Channel as long term indicator, combining with EMA filter, can effectively identify the trend.
-
Stop loss and take profit controls risk per trade, limits potential losses.
-
Optimizing risk/reward ratio can increase profit factor, pursuing excess returns.
-
Flexible backtest parameters, can optimize parameters for different markets.
Risk Analysis
-
Donchian Channel and EMA may give wrong signals sometimes.
-
Breakout trading can easily be trapped, need to identify trend background clearly.
-
Fixed stop loss and take profit cannot adjust based on market volatility.
-
Limited optimization space for parameters, live performance not guaranteed.
-
Trading systems vulnerable to black swan events, may lead to severe losses.
Optimization Directions
-
Consider adding more filters like oscillators to improve signal quality.
-
Set adaptive stop loss and take profit based on market volatility and ATR.
-
Use machine learning to test and optimize parameters to fit real markets.
-
Optimize entry logic with volume or volatility as condition to avoid traps.
-
Combine with trend following systems or machine learning to create hybrid models for robustness.
Conclusion
This strategy is a tracking breakout strategy, with the logic of trading along the major trend identified, and taking breakout as entry signal, while setting stop loss and take profit to control risk per trade. The strategy has some advantages, but also room for improvements. Overall, with proper parameter tuning, entry timing, and enhancements with other techniques, it can become a practical trend following strategy. But investors should always keep in mind that no trading system can eliminate market risk entirely, and risk management is essential.
/*backtest
start: 2023-09-16 00:00:00
end: 2023-10-16 00:00:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
// Welcome to my second script on Tradingview with Pinescript
// First of, I'm sorry for the amount of comments on this script, this script was a challenge for me, fun one for sure, but I wanted to thoroughly go through every step before making the script public
// Glad I did so because I fixed some weird things and I ended up forgetting to add the EMA into the equation so our entry signals were a mess- 1

