Overview
This is a mean reversion trading strategy that captures short-term price reversal opportunities by identifying consecutive bearish and bullish candle patterns. The core logic enters a long position after three consecutive bearish candles and exits after three consecutive bullish candles. The strategy can optionally incorporate an EMA filter to enhance trade quality.
Strategy Principles
The strategy is based on the following core elements:
- Consecutive candle counter: Tracks the number of consecutive bullish and bearish candles
- Entry condition: Triggers a long signal when specified number (default 3) of consecutive lower closing prices occurs
- Exit condition: Triggers a closing signal when specified number (default 3) of consecutive higher closing prices occurs
- EMA filter: Optional 200-period exponential moving average as trend filter
- Trading time window: Can set specific trading start and end times to limit trading periods
Strategy Advantages
- Simple and clear logic: Strategy uses simple candle counting method, easy to understand and implement
- High adaptability: Can be applied to different timeframes and trading instruments
- Flexible parameters: Consecutive candle counts, EMA period and other parameters can be adjusted as needed
- Comprehensive risk control: Multiple mechanisms including time window and trend filter to control risk
- High computational efficiency: Core logic only requires comparing adjacent candle closing prices, low computational load
Strategy Risks
- Trend market risk: May encounter frequent false breakouts in strong trending markets
- Parameter sensitivity: Number of consecutive candles setting significantly impacts strategy performance
- Slippage impact: May face significant slippage risk in volatile markets
- False signal risk: Consecutive candle patterns may be affected by market noise
- Lack of stop loss: Strategy lacks explicit stop loss mechanism, may lead to large drawdowns
Strategy Optimization Directions
- Add stop loss mechanism: Recommend adding fixed or trailing stop loss to control risk
- Optimize filter conditions: Can introduce volume, volatility and other indicators as auxiliary filters
- Dynamic parameter adjustment: Consider dynamically adjusting consecutive candle count requirements based on market conditions
- Enhance position management: Can design partial position building and reduction mechanisms to improve returns
- Improve time management: Set different trading parameters for different time periods
Summary
This is a well-designed mean reversion strategy that generates returns by capturing short-term oversold bounce opportunities. The strategy's main advantages are simple logic and high adaptability, but risk control needs attention in practical application. It is recommended to enhance strategy stability through adding stop loss mechanisms, optimizing filter conditions and other improvements.
/*backtest
start: 2025-01-19 00:00:00
end: 2025-02-18 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("3 Down, 3 Up Strategy", overlay=true, initial_capital = 1000000, default_qty_value = 200, default_qty_type = strategy.percent_of_equity, process_orders_on_close = true, margin_long = 5, margin_short = 5, calc_on_every_tick = true)
- 1

