Skip to main content

Strategy002 In-Depth Analysis

Strategy ID: #393 (393rd of 465 strategies) Strategy Type: Multi-Indicator Oversold Bounce + Candlestick Pattern Confirmation Timeframe: 5 minutes (5m)


I. Strategy Overview

Strategy002 is a classic quantitative strategy based on oversold bounce trading. It seeks price bottoms through oversold signals from RSI, Stochastic, and Bollinger Bands, combined with hammer candlestick pattern confirmation for reversal timing. The strategy design is clean and straightforward, making it suitable as an entry-level quantitative strategy for learning.

Core Characteristics

FeatureDescription
Buy Conditions1 comprehensive buy signal, four indicators must all be satisfied
Sell Conditions1 basic sell signal, based on SAR and Fisher RSI
Protection MechanismDual protection with fixed stop-loss + trailing stop
Timeframe5m single timeframe
Dependenciestalib, qtpylib, numpy

II. Strategy Configuration Analysis

2.1 Basic Risk Parameters

# ROI exit table
minimal_roi = {
"60": 0.01, # After 60 minutes, 1% profit is enough to sell
"30": 0.03, # After 30 minutes, 3% profit is enough to sell
"20": 0.04, # After 20 minutes, 4% profit is enough to sell
"0": 0.05 # Immediately, 5% profit target
}

# Stop-loss setting
stoploss = -0.10 # 10% fixed stop-loss

Design Rationale:

  • Tiered take-profit design: The longer the position is held, the lower the profit threshold, avoiding profit drawdown
  • 5% as initial target, only 1% needed to exit after 60 minutes
  • 10% stop-loss provides ample room for price fluctuation

2.2 Trailing Stop Configuration

trailing_stop = True
trailing_stop_positive = 0.01
trailing_stop_positive_offset = 0.02

Trailing Stop Logic:

  • Activates trailing stop when profit reaches 2%
  • Trailing distance is 1%
  • A 1% profit drawdown triggers a sell

2.3 Order Type Configuration

order_types = {
'buy': 'limit',
'sell': 'limit',
'stoploss': 'market',
'stoploss_on_exchange': False
}

Configuration Notes:

  • Buy and sell orders use limit orders for better prices
  • Stop-loss uses market orders to ensure execution

III. Buy Conditions Detailed

3.1 Single Buy Signal

The strategy employs strict four-condition stacking, all conditions must be satisfied simultaneously:

(dataframe['rsi'] < 30) &                    # Condition 1: RSI oversold
(dataframe['slowk'] < 20) & # Condition 2: Stochastic oversold
(dataframe['bb_lowerband'] > dataframe['close']) & # Condition 3: Price below Bollinger lower band
(dataframe['CDLHAMMER'] == 100) # Condition 4: Hammer pattern confirmation

3.2 Condition Logic Analysis

Condition #IndicatorThresholdMarket Meaning
#1RSI< 30Entered oversold zone, price may be oversold
#2Stochastic Slow K< 20Momentum indicator confirms oversold state
#3Close < Bollinger Lower BandPrice below lower bandPrice deviation from mean is excessive
#4Hammer Pattern== 100Candlestick pattern confirms reversal signal

3.3 Buy Logic Summary

The strategy buys when:

  1. RSI indicator shows market is oversold (<30)
  2. Stochastic indicator's Slow K line also confirms oversold (<20)
  3. Price has broken below the Bollinger Band lower band, showing abnormal deviation
  4. Candlestick shows hammer pattern, indicating possible reversal

Typical Scenario: Bottom reversal opportunity after sharp price decline


IV. Sell Logic Detailed

4.1 Sell Signal

(dataframe['sar'] > dataframe['close']) &   # Condition 1: SAR reversal
(dataframe['fisher_rsi'] > 0.3) # Condition 2: Fisher RSI confirms strength

Logic Analysis:

ConditionIndicatorThresholdMeaning
#1Parabolic SAR> Close pricePrice broke below SAR support level, trend may reverse
#2Fisher RSI> 0.3Momentum has exited oversold zone

4.2 Tiered ROI Take-Profit

Holding Time    Minimum Profit Target
─────────────────────────────────────
0-20 minutes 5%
20-30 minutes 4%
30-60 minutes 3%
60+ minutes 1%

Design Philosophy: As holding time extends, lower profit expectations to prioritize locking in gains.


V. Technical Indicator System

5.1 Core Indicators

Indicator CategorySpecific IndicatorPurpose
Momentum IndicatorRSI (14)Identify oversold/overbought
Momentum IndicatorStochastic (Slow K)Confirm oversold state
Volatility IndicatorBollinger Bands (20, 2)Judge price deviation
Trend IndicatorParabolic SARDetermine trend reversal
Momentum IndicatorFisher RSIRSI variant, enhanced signal
Pattern IndicatorHammer CandlestickConfirm reversal pattern

5.2 Indicator Calculation Details

Fisher RSI Transformation:

rsi = 0.1 * (dataframe['rsi'] - 50)
dataframe['fisher_rsi'] = (numpy.exp(2 * rsi) - 1) / (numpy.exp(2 * rsi) + 1)
  • Maps RSI from [0, 100] to [-1, 1]
  • Enhances sensitivity to extreme values

VI. Risk Management Features

6.1 Dual Stop-Loss Mechanism

Stop-Loss TypeTrigger ConditionDescription
Fixed Stop-LossLoss reaches 10%Hard protection line
Trailing StopProfit drawdown 1% (after profit > 2%)Locks in floating profit

6.2 Tiered Take-Profit Protection

  • Layered profit targets: Gradually decreasing from 5% to 1%
  • Time-weighted: The longer held, the lower the tolerance
  • Works with trailing stop to form multi-layer exit mechanism

6.3 Order Type Configuration

ScenarioOrder TypeAdvantage
Regular buy/sellLimit orderReduce slippage
Emergency stop-lossMarket orderEnsure execution

VII. Strategy Advantages and Limitations

✅ Advantages

  1. Clear Logic: Four buy conditions are clear and easy to understand and debug
  2. Oversold Capture: Multi-indicator resonance confirms oversold bottom, reducing false signals
  3. Pattern Confirmation: Hammer candlestick adds reversal credibility
  4. Comprehensive Risk Control: Fixed stop-loss + trailing stop + tiered take-profit

⚠️ Limitations

  1. Limited Buy Opportunities: Low probability of all four conditions being satisfied simultaneously
  2. Dependent on Reversal Markets: May trigger repeated stop-losses in continuous downtrends
  3. Single Timeframe: 5-minute frame has more noise, may cause misjudgments
  4. Lack of Filtering Mechanism: No volume confirmation or overall market trend filter

VIII. Applicable Scenario Recommendations

Market EnvironmentRecommended ConfigurationNotes
Oscillating downtrendDefault configurationMany oversold bounce opportunities
Continuous crashUse cautiouslyConsecutive oversold may fail
Continuous uptrendNot recommendedFew buy opportunities
Sideways oscillationDefault configurationCan capture short-term fluctuations

IX. Applicable Market Environment Details

Strategy002 is a classic oversold bounce strategy. Based on its code architecture, it is best suited for markets showing reversal after oscillating decline, and performs poorly during continuous one-way decline.

9.1 Strategy Core Logic

  • Oversold Confirmation: RSI + Stochastic dual verification
  • Price Deviation: Bollinger lower band breakthrough confirms abnormality
  • Pattern Confirmation: Hammer confirms bottom formation
  • Trend Reversal: SAR used for sell signal

9.2 Performance in Different Market Environments

Market TypePerformance RatingAnalysis
📈 Reversal after oscillating decline⭐⭐⭐⭐⭐Exactly the target scenario the strategy was designed for
🔄 Sideways oscillation⭐⭐⭐⭐☆More oversold bounce opportunities
📉 Continuous one-way decline⭐⭐☆☆☆Oversold can continue to be oversold
⚡️ One-way uptrend⭐☆☆☆☆Almost no buy signals

9.3 Key Configuration Recommendations

Configuration ItemRecommended ValueNotes
timeframe5mDefault setting
stoploss-0.10Can adjust based on risk preference
trailing_stop_positive_offset0.02Trailing activates at 2% profit

X. Important Reminder: The Cost of Complexity

10.1 Learning Cost

  • Strategy code is concise, suitable for beginners to understand
  • Indicator calculations are standard, can reference extensive technical analysis materials
  • Candlestick pattern recognition requires some basic knowledge

10.2 Hardware Requirements

Number of Trading PairsMinimum MemoryRecommended Memory
1-102GB4GB
10-504GB8GB

10.3 Backtesting vs Live Trading Differences

  • Candlestick patterns in backtesting may have look-ahead bias
  • Limit orders in live trading may not execute timely
  • Oversold conditions may trigger consecutively in extreme markets

10.4 Manual Trader Recommendations

Strategy logic can be executed manually:

  1. Monitor assets with RSI < 30
  2. Wait for Stochastic Slow K < 20
  3. Check if price has broken below Bollinger lower band
  4. Wait for hammer pattern to appear before entering

XI. Summary

Strategy002 is a concise and effective oversold bounce strategy. Its core value lies in:

  1. Transparent Logic: Four buy conditions are clear and easy to understand and debug
  2. Multi-Indicator Resonance: RSI + Stochastic + Bollinger Bands + Hammer quadruple confirmation
  3. Controllable Risk: Dual stop-loss + tiered take-profit, protecting capital safety

For quantitative trading beginners, this is an excellent learning case; for advanced users, more filter conditions and optimized parameters can be added on this foundation.