Skip to main content

CofiBitStrategy Strategy Analysis

Strategy Type: Intraday Short-Term Trend Following Strategy Timeframe: 5 Minutes (5m) Source: Shared by CofiBit on Freqtrade Community Slack


I. Strategy Overview​

CofiBitStrategy is an intraday short-term trend following strategy, shared by a Freqtrade community member named CofiBit. This strategy integrates three core technical indicators — Stochastic (STOCHF), Exponential Moving Average (EMA), and Average Directional Index (ADX) — to capture intraday oversold rebound opportunities through multi-dimensional condition filtering.

Its core logic can be summarized as: Enter at low prices with oversold indicators when a trend is clear; exit when price breaks out or indicators become overbought.

Core Features​

FeatureDescription
Buy Conditions5 independent conditions, must all be met simultaneously
Sell Conditions2 basic sell signals (price breakout OR indicator overbought)
Protection MechanismsADX trend filtering + KD oversold filtering + loose stop-loss
Timeframe5 Minutes
Dependenciesqtpylib, ta (technical analysis library)
Strategy StyleCautious, trend-following, intraday short-term

II. Strategy Configuration Analysis​

2.1 Basic Risk Parameters​

# ROI Exit Table (Staircase Take-Profit)
minimal_roi = {
"40": 0.05, # Hold for 40 minutes, 5% take-profit
"30": 0.06, # Hold for 30 minutes, 6% take-profit
"20": 0.07, # Hold for 20 minutes, 7% take-profit
"0": 0.10 # Immediate take-profit line, 10%
}

# Stop-Loss Settings
stoploss = -0.25 # 25% stop-loss

Design Philosophy:

  • Staircase Take-Profit: Shorter holding time requires higher profit target; longer holding time gradually lowers the take-profit line. This embodies the philosophy of "letting profits run" while setting multiple floor returns.
  • Loose Stop-Loss: The -25% stop-loss is relatively wide, leaving sufficient space for intraday fluctuations, avoiding being stopped out by normal market noise.

2.2 Hyperparameters​

# Buy Hyperparameters
buy_params = {
"buy_fastx": 25, # Stochastic oversold threshold
"buy_adx": 25, # ADX trend strength threshold
}

# Sell Hyperparameters
sell_params = {
"sell_fastx": 75, # Stochastic overbought threshold
}

III. Entry Conditions Details​

3.1 Protection Mechanisms (3 Sets)​

The strategy's buy signals are equipped with 3 layers of protective filtering:

Protection TypeParameter DescriptionDefaultFunction
Price Position ProtectionOpen < EMA(low)-Ensures entry at relatively low prices
Oversold Protectionfastk < 25, fastd < 2525Ensures buying in oversold zone
Trend ProtectionADX > 2525Ensures clear market trend direction

3.2 Entry Conditions Details (5 Conditions)​

The strategy's buy signal requires all 5 conditions to be met simultaneously:

Condition #1: Price at Intraday Low​

dataframe['open'] < dataframe['ema_low']
  • Logic: Open price below 5-period EMA(low)
  • Meaning: Price is at the day's relatively low point, with rebound space — won't buy at the "mountain top"

Condition #2: Stochastic Golden Cross​

qtpylib.crossed_above(dataframe['fastk'], dataframe['fastd'])
  • Logic: fastk line crosses above fastd line from below
  • Meaning: Short-term momentum starting to strengthen — a classic buy signal

Condition #3: Stochastic K Value in Oversold Zone​

dataframe['fastk'] < self.buy_fastx.value  # Default 25
  • Logic: fastk value below threshold 25
  • Meaning: K indicator in oversold zone, price may be undervalued

Condition #4: Stochastic D Value in Oversold Zone​

dataframe['fastd'] < self.buy_fastx.value  # Default 25
  • Logic: fastd value below threshold 25
  • Meaning: D indicator also in oversold zone — dual confirmation improves reliability

Condition #5: Trend Strength Confirmation​

dataframe['adx'] > self.buy_adx.value  # Default 25
  • Logic: ADX value greater than 25
  • Meaning: Market has a clear trend direction, not in consolidation

3.3 Entry Conditions Classification​

Condition GroupCondition #Core Logic
Price Position#1Ensures entry at relatively low prices
Momentum Indicator#2, #3, #4Ensures buying at golden cross in oversold zone
Trend Confirmation#5Ensures market has clear trend

Entry Logic Summary: Only acts when low price + oversold golden cross + trend present — a typical "steady and methodical" strategy.


IV. Exit Conditions Details​

4.1 Staircase Take-Profit System​

The strategy uses a staircase take-profit mechanism where holding time and take-profit threshold have an inverse relationship:

Holding Time    Take-Profit Line    Description
─────────────────────────────────────────────
40+ minutes 5% Longer time, lower requirement
30+ minutes 6% Medium holding
20+ minutes 7% Shorter holding
0+ minutes 10% Immediate take-profit line

4.2 Basic Sell Signals (2)​

The strategy includes two independent sell trigger mechanisms — either triggers an exit:

Sell Signal #1: Price Breaking Intraday High​

dataframe['open'] >= dataframe['ema_high']
  • Condition: Open price above 5-period EMA(high)
  • Meaning: Price has broken above the day's high resistance level — take profits

Sell Signal #2: Stochastic Overbought​

(qtpylib.crossed_above(dataframe['fastk'], self.sell_fastx.value)) |
(qtpylib.crossed_above(dataframe['fastd'], self.sell_fastx.value))
  • Condition: fastk or fastd crosses above threshold 75
  • Meaning: Indicators entering overbought zone, momentum may be exhausting — exit promptly

V. Technical Indicator System​

5.1 Core Indicators​

Indicator CategorySpecific IndicatorsPurpose
Momentum IndicatorSTOCHF (Fast Stochastic)Determines overbought/oversold, golden/dead cross signals
Trend IndicatorEMA (Exponential Moving Average)Determines price position, support/resistance levels
Strength IndicatorADX (Average Directional Index)Determines trend strength, filters ranging markets

5.2 Stochastic (STOCHF) Details​

Parameter Configuration:

fastk_period = 5
fastd_period = 3
fastd_matype = 0 # Simple moving average

Indicator Interpretation:

  • fastk: Fast stochastic, sensitive to price changes — captures short-term momentum.
  • fastd: Slow stochastic, a smoothed version of fastk — confirms signals.
  • Golden Cross (fastk crosses above fastd): Short-term momentum strengthening, buy signal.
  • Dead Cross (fastk crosses below fastd): Short-term momentum weakening, sell signal.
  • Oversold Zone (< 25): Price may be undervalued, rebound opportunity.
  • Overbought Zone (> 75): Price may be overvalued, pullback risk.

5.3 Exponential Moving Average (EMA) Details​

Parameter Configuration:

timeperiod = 5
# Calculate EMA for high, close, low separately

Indicator Interpretation:

  • ema_high: Short-term resistance level reference.
  • ema_close: Short-term average price reference.
  • ema_low: Short-term support level reference.

5.4 Average Directional Index (ADX) Details​

Parameter Configuration:

timeperiod = 14  # Standard period

Indicator Interpretation:

  • Used to measure market trend strength, does not distinguish between up or down direction.
  • ADX > 25: Market has a clear trend (unilateral market).
  • ADX < 20: Market in sideways consolidation.
  • ADX 20-25: Critical zone for trend formation or conversion.

VI. Risk Management Features​

6.1 Loose Stop-Loss Design​

ParameterDefaultDesign Intent
stoploss-25%Leaves sufficient space for intraday fluctuations

Design Philosophy:

  • Intraday short-term trading itself has larger fluctuations.
  • Wider stop-loss avoids being stopped out by normal fluctuations.
  • Suitable for high-volatility cryptocurrency markets.

6.2 Staircase Take-Profit​

Holding TimeTake-Profit LineRisk Management Significance
40+ minutes5%Lock minimum return
30+ minutes6%Progressive protection
20+ minutes7%Medium return protection
0+ minutes10%Short-term high return target

6.3 Triple Protection Mechanism​

Protection TypeConditionRisk Management Function
Trend ProtectionADX > 25Filters ranging markets, avoids false signals
Oversold Protectionfastk < 25, fastd < 25Avoids chasing highs, enters at low prices
Price Position Protectionopen < ema_lowEnsures not buying at high levels

VII. Strategy Pros & Cons​

Pros​

  1. Multi-Dimensional Filtering: Entry conditions simultaneously consider price position, momentum indicators, and trend strength — effectively reducing false signal probability.
  2. Clear Logic: Condition combinations are intuitive, easy to understand and modify, suitable for strategy optimization.
  3. Intraday Adaptation: 5-minute timeframe suitable for capturing short-term fluctuations — matches cryptocurrency market characteristics.
  4. Adjustable Parameters: Provides hyperparameters for optimization — can adapt to different market environments and trading styles.
  5. Trend Following: ADX filtering ensures trading only in trending markets, improving win rate.

Cons​

  1. High Stop-Loss Risk: -25% stop-loss in extreme markets may cause significant per-trade losses.
  2. ADX Lag: ADX's response to trend changes has lag — may fail during trend conversions.
  3. Parameter Sensitivity: Parameters like buy_fastx, sell_fastx significantly impact results — require careful optimization.
  4. Average Performance in Ranging Markets: As a trend strategy, signals are scarce or quality degrades during sideways consolidation.
  5. Timeframe Limitations: 5-minute level requires continuous monitoring — not suitable for traders unable to operate frequently.

VIII. Applicable Scenarios​

Market EnvironmentRecommended ConfigurationDescription
High-Volatility CoinsDefault parametersLike ALT, SHIB and other high-volatility tokens — stop-loss space matches
Uptrend Pullbackbuy_fastx=20Stricter oversold requirement, improves rebound win rate
Downtrend Bouncebuy_adx=30Requires stronger trend confirmation, avoids false rebounds
Low-Volatility MarketNot recommendedInsufficient price fluctuation to trigger valid signals

IX. Applicable Market Environment Details​

CofiBitStrategy is an intraday short-term trend following strategy. Based on its code architecture and strategy logic, it is best suited for high-volatility markets with clear trends and performs poorly during ranging consolidation periods.

9.1 Core Strategy Logic​

  • Low Price Entry: Buy at relatively low prices, reducing risk.
  • Oversold Capture: Uses stochastic to capture oversold rebound opportunities.
  • Trend Confirmation: ADX filtering ensures trading only in markets with clear trends.
  • Multi-Layer Filtering: 5 conditions all must be met before opening positions — pursues high win rate over high frequency.

9.2 Performance in Different Market Environments​

Market TypeRatingAnalysis
Uptrend Pullback⭐⭐⭐⭐⭐Clear trend + pullback entry = optimal entry point, ADX filtering effective
Downtrend Bounce⭐⭐⭐⭐☆Oversold rebound signals accurate, but watch stop-loss risk
Ranging Consolidation⭐⭐☆☆☆ADX filters block most signals, low capital utilization
Unilateral Surge⭐☆☆☆☆Entry too conservative, may miss most of the rally
Low-Volatility Market⭐☆☆☆☆Insufficient fluctuation to trigger signals, strategy "hibernates"

9.3 Key Configuration Recommendations​

Configuration ItemSuggested ValueDescription
buy_fastx20-30Oversold threshold — smaller is stricter
buy_adx20-30Trend strength threshold — larger is stricter
sell_fastx70-80Overbought threshold — smaller exits earlier
stoploss-0.15 ~ -0.25Adjust based on coin volatility

X. Important Reminder: The Cost of Complexity​

10.1 Parameter Optimization Pitfalls​

This strategy contains three key adjustable parameters:

  • buy_fastx (default 25)
  • buy_adx (default 25)
  • sell_fastx (default 75)

Warning: Over-optimizing these parameters may cause overfitting — excellent performance in historical backtesting but poor live performance.

Recommendations:

  • Control parameter adjustment within ±20% of default values.
  • Use out-of-sample data to verify optimization results.
  • Avoid frequent parameter adjustments.

10.2 Trade-off Between Signal Frequency and Quality​

Parameter AdjustmentSignal FrequencySignal QualityRisk
Lower buy_fastx↓ Decrease↑ IncreaseMay miss opportunities
Raise buy_fastx↑ Increase↓ DecreaseMore false signals
Raise buy_adx↓ Decrease↑ IncreaseStricter entry conditions
Lower sell_fastx↑ Increase↓ DecreaseExits too early

10.3 Backtesting vs. Live Trading Differences​

Common Differences:

  • Slippage: Live fill prices differ from backtest prices.
  • Liquidity: May not fill at expected prices during extreme markets.
  • Emotional Interference: Psychological pressure in live trading may affect execution.

Recommended Process:

  1. Complete historical backtesting verification.
  2. Conduct paper trading testing (at least 1 month).
  3. Small-position live verification.
  4. Gradually increase position.

10.4 Hardware and Time Requirements​

Number of Trading PairsMonitoring RequirementDescription
1-5 pairsMedium5-minute level requires some attention
6-15 pairsHighRecommend bot automation
15+ pairsVery HighMust be fully automated

XI. Summary​

CofiBitStrategy is an intraday short-term strategy combining momentum indicators and trend confirmation. Its core value lies in:

  1. Multi-Dimensional Filtering: 5 buy conditions all must be met — pursues high win rate over high frequency.
  2. Trend Following: ADX filtering ensures trading only in trending markets, avoiding ranging market false signals.
  3. Controllable Risk: Staircase take-profit + loose stop-loss — balances return and risk.

For quantitative traders, this strategy is suitable for investors with some trading experience, who can accept higher stop-loss levels, and prefer intraday short-term trading. Before use, recommend:

  • Fully understand technical meanings of stochastic, EMA, and ADX.
  • Conduct sufficient historical backtesting verification.
  • Verify effectiveness in paper trading before live use.
  • Adjust parameters based on target coin's volatility characteristics.

Core Principle: Under clear trend conditions, buy at oversold zones, sell at overbought zones, strict discipline, steady and methodical.