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
| Feature | Description |
|---|---|
| Buy Conditions | 5 independent conditions, must all be met simultaneously |
| Sell Conditions | 2 basic sell signals (price breakout OR indicator overbought) |
| Protection Mechanisms | ADX trend filtering + KD oversold filtering + loose stop-loss |
| Timeframe | 5 Minutes |
| Dependencies | qtpylib, ta (technical analysis library) |
| Strategy Style | Cautious, 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 Type | Parameter Description | Default | Function |
|---|---|---|---|
| Price Position Protection | Open < EMA(low) | - | Ensures entry at relatively low prices |
| Oversold Protection | fastk < 25, fastd < 25 | 25 | Ensures buying in oversold zone |
| Trend Protection | ADX > 25 | 25 | Ensures 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 Group | Condition # | Core Logic |
|---|---|---|
| Price Position | #1 | Ensures entry at relatively low prices |
| Momentum Indicator | #2, #3, #4 | Ensures buying at golden cross in oversold zone |
| Trend Confirmation | #5 | Ensures 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 Category | Specific Indicators | Purpose |
|---|---|---|
| Momentum Indicator | STOCHF (Fast Stochastic) | Determines overbought/oversold, golden/dead cross signals |
| Trend Indicator | EMA (Exponential Moving Average) | Determines price position, support/resistance levels |
| Strength Indicator | ADX (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
| Parameter | Default | Design 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 Time | Take-Profit Line | Risk Management Significance |
|---|---|---|
| 40+ minutes | 5% | Lock minimum return |
| 30+ minutes | 6% | Progressive protection |
| 20+ minutes | 7% | Medium return protection |
| 0+ minutes | 10% | Short-term high return target |
6.3 Triple Protection Mechanism
| Protection Type | Condition | Risk Management Function |
|---|---|---|
| Trend Protection | ADX > 25 | Filters ranging markets, avoids false signals |
| Oversold Protection | fastk < 25, fastd < 25 | Avoids chasing highs, enters at low prices |
| Price Position Protection | open < ema_low | Ensures not buying at high levels |
VII. Strategy Pros & Cons
Pros
- Multi-Dimensional Filtering: Entry conditions simultaneously consider price position, momentum indicators, and trend strength — effectively reducing false signal probability.
- Clear Logic: Condition combinations are intuitive, easy to understand and modify, suitable for strategy optimization.
- Intraday Adaptation: 5-minute timeframe suitable for capturing short-term fluctuations — matches cryptocurrency market characteristics.
- Adjustable Parameters: Provides hyperparameters for optimization — can adapt to different market environments and trading styles.
- Trend Following: ADX filtering ensures trading only in trending markets, improving win rate.
Cons
- High Stop-Loss Risk: -25% stop-loss in extreme markets may cause significant per-trade losses.
- ADX Lag: ADX's response to trend changes has lag — may fail during trend conversions.
- Parameter Sensitivity: Parameters like buy_fastx, sell_fastx significantly impact results — require careful optimization.
- Average Performance in Ranging Markets: As a trend strategy, signals are scarce or quality degrades during sideways consolidation.
- Timeframe Limitations: 5-minute level requires continuous monitoring — not suitable for traders unable to operate frequently.
VIII. Applicable Scenarios
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| High-Volatility Coins | Default parameters | Like ALT, SHIB and other high-volatility tokens — stop-loss space matches |
| Uptrend Pullback | buy_fastx=20 | Stricter oversold requirement, improves rebound win rate |
| Downtrend Bounce | buy_adx=30 | Requires stronger trend confirmation, avoids false rebounds |
| Low-Volatility Market | Not recommended | Insufficient 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 Type | Rating | Analysis |
|---|---|---|
| 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 Item | Suggested Value | Description |
|---|---|---|
| buy_fastx | 20-30 | Oversold threshold — smaller is stricter |
| buy_adx | 20-30 | Trend strength threshold — larger is stricter |
| sell_fastx | 70-80 | Overbought threshold — smaller exits earlier |
| stoploss | -0.15 ~ -0.25 | Adjust 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 Adjustment | Signal Frequency | Signal Quality | Risk |
|---|---|---|---|
| Lower buy_fastx | ↓ Decrease | ↑ Increase | May miss opportunities |
| Raise buy_fastx | ↑ Increase | ↓ Decrease | More false signals |
| Raise buy_adx | ↓ Decrease | ↑ Increase | Stricter entry conditions |
| Lower sell_fastx | ↑ Increase | ↓ Decrease | Exits 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:
- Complete historical backtesting verification.
- Conduct paper trading testing (at least 1 month).
- Small-position live verification.
- Gradually increase position.
10.4 Hardware and Time Requirements
| Number of Trading Pairs | Monitoring Requirement | Description |
|---|---|---|
| 1-5 pairs | Medium | 5-minute level requires some attention |
| 6-15 pairs | High | Recommend bot automation |
| 15+ pairs | Very High | Must be fully automated |
XI. Summary
CofiBitStrategy is an intraday short-term strategy combining momentum indicators and trend confirmation. Its core value lies in:
- Multi-Dimensional Filtering: 5 buy conditions all must be met — pursues high win rate over high frequency.
- Trend Following: ADX filtering ensures trading only in trending markets, avoiding ranging market false signals.
- 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.