CCI Dual Timeframe Trend Following Strategy
Overview
This strategy is a trend following strategy based on the CCI indicator. It generates trading signals by monitoring the crossover between two CCIs of different timeframes. Specifically, it will detect if a shorter period CCI breaks through a longer period CCI and determine long or short positions based on the breakthrough direction.
Strategy Logic
The core logic of this strategy is:
- Define two CCIs, ci1 as 14 periods, ci2 as 56 periods
- When ci1 breaks above ci2, go long
- When ci1 breaks below ci2, go short
- Use the values of ci1 and ci2 to determine exits after signals triggered
Specific long rules:
- ci1 breaks above ci2, the shorter period CCI above longer period CCI
- Stop loss condition: ci1 <-50 and change rate < 0 or ci1 breaks below -100
Specific short rules:
- ci1 breaks below ci2, the shorter period CCI below longer period CCI
- Stop loss condition: ci1 > 100 and change rate > 0 or ci2 breaks above 100
As we can see, this strategy takes advantage of the sensitivity of shorter period CCI and the stability of longer period CCI to identify and follow trends.
Advantages
The advantages of this strategy:
- Effectively identifies trends using the strength of CCI indicator
- Dual CCI design filters some noise trades
- The combination of long and short period CCIs controls risk while following trends
- Simple and clear strategy rules, easy to understand and implement
- Highly configurable, both CCI periods and stop loss conditions are customizable
Risks
There are also some risks:
- Weak ability to identify range-bound and volatile markets using CCI
- Divergence may happen between long and short period CCIs, causing wrong signals
- Improper stop loss setting may lead to huge loss
- Inappropriate parameter tuning also largely impacts strategy profitability
Solutions:
- Incorporate other indicators to determine market condition, avoid trading in volatile period
- Add filters to avoid errors from CCI divergence
- Optimize and test different stop loss levels
- Find suitable parameter sets through backtesting and tuning
Optimization Directions
Areas that the strategy can be further optimized:
- Add more indicators to build a more systematic trading system
- Test profitability difference between weekdays and sessions
- Search for better parameters using machine learning
- Tune parameters for different products
- Optimize entry and exit rules
Conclusion
In conclusion, this is a simple trend following strategy based on CCI crossover. It can effectively identify trend direction and follow trends. Meanwhile it controls risk via stop loss. This strategy is simple, practical, flexible in parameter tuning, and can serve as a starter quant strategy. It can be enhanced into more powerful system via further optimization and combination.
/*backtest
start: 2023-10-24 00:00:00
end: 2023-11-23 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy(title="my work",calc_on_order_fills=true,currency=currency.USD, default_qty_type=strategy.percent_of_equity,commission_type=strategy.commission.percent)
- 1

