Trend Breakout Moving Average Tracking Strategy
Overview
This strategy identifies trend direction by golden cross and dead cross of simple moving averages, goes long or short with full position size at the beginning of a trend, and sets up stop loss and take profit orders to control risks. After entering the position, it keeps tracking the trend using moving averages and cuts loss in time when there is trend reversal. This strategy also has configurable modules for stop loss, take profit and position sizing, which allows flexible adjustment of parameters for different products.
Strategy Logic
The core of this strategy is to determine trend start and end using golden cross and dead cross of simple moving averages. It first identifies trend direction based on the relationship between fast SMA (e.g. 21-period) and slow SMA (e.g. 49-period). When fast SMA crosses above slow SMA, it signals an uptrend, and the strategy will go long. When fast SMA crosses below slow SMA, it signals a downtrend, and the strategy will go short.
After entering the position, the strategy keeps monitoring the price relative to SMA in real time. It will close long position when price breaks SMA from above, and close short position when price breaks SMA from below, as trend reversal signals.
To control risks, the strategy sets up stop loss and take profit orders simultaneously when opening position. Stop loss distance is based on ATR, while take profit distance can be configured as percentage or ATR multiples. After opening position, stop loss keeps tracking price to realize trend following. When take profit is touched, it closes partial position first while keeping the rest to continue tracking until fully closed.
The strategy also has position sizing module to limit funds utilized for each trade and control per trade risk exposure. In addition, max drawdown limit helps restrict overall strategy risk.
Advantages
- Simple to understand, using SMA cross to determine trend direction
- Real-time tracking of stop loss after entering can lock in most profits
- Customizable stop loss and take profit for different products
- Per trade risk controllable, no full position trading
- Max drawdown limit to restrict total loss
Risks and Solutions
- SMA cross has some lag, may miss best entry at trend start
- Need repeated adjustment of parameters and testing of different SMA periods
- SMA cross has some whipsaws, entry accuracy cannot be 100%
- Trailing stop loss may be hit easily, unable to lock entire profit
- Need reasonable stop loss distance for price retracement
- Max drawdown limit may be too conservative, missing upside potential
- Can relax max drawdown allowance for more strategy tolerance
Enhancement Opportunities
- Test different parameter combinations to find optimal SMA periods
- Add trend strength indicator to improve entry accuracy
- Optimize stop loss strategy to chase uptrend and downtrend as much as possible
- Test different take profit strategies to find optimal exit points
- Refine position sizing scheme to improve capital utilization
- Adjust max drawdown setting to balance return vs risk
Conclusion
In summary, this is a very suitable starter strategy for beginners, with simple logic and easy understanding. It also has proper risk control capabilities to reduce large losses. Good results can be achieved through parameter tuning. But its intrinsic weaknesses also determine that it cannot operate with high precision. It is recommended for beginners to practice, but may not suit advanced traders pursuing high efficiency and win rate. To obtain better trading performance, strategies with stronger predictive power should be sought.
/*backtest
start: 2023-01-01 00:00:00
end: 2023-11-02 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ------------------------------------------------------------------------------ 1

