Skip to main content

SampleStrategy Strategy Analysis

Strategy Number: #371 (371st of 465 strategies)
Strategy Type: Multi-condition Trend Following + Multi-layer Protection Mechanism
Timeframe: 5 minutes (5m) + 1 hour (1h) informative layer


I. Strategy Overview

SampleStrategy is a highly complex trend-following strategy based on the NostalgiaForInfinityV7 architecture. This strategy builds a comprehensive signal capture system with up to 26 independent buy conditions and 8 sell conditions, equipped with multiple layers of dynamic protection mechanisms to ensure entry safety.

Core Features

FeatureDescription
Buy Conditions26 independent buy signals, can be enabled/disabled independently
Sell Conditions8 base sell signals + custom_sell dynamic take-profit logic
Protection Mechanisms26 groups of buy protection parameters (EMA filtering, safe Dip, safe Pump, etc.)
TimeframeMain timeframe 5m + informative timeframe 1h
Dependenciestalib, qtpylib, technical (zema)

II. Strategy Configuration Analysis

2.1 Basic Risk Parameters

# ROI exit table
minimal_roi = {
"0": 0.10, # Exit at 10% profit immediately
"30": 0.05, # Exit at 5% profit after 30 minutes
"60": 0.02, # Exit at 2% profit after 60 minutes
}

# Stop loss setting
stoploss = -0.10 # Fixed stop loss at 10%

# Trailing stop
trailing_stop = True
trailing_only_offset_is_reached = True
trailing_stop_positive = 0.01 # Start trailing at 1% profit
trailing_stop_positive_offset = 0.03 # Begin trailing at 3% profit

Design Rationale:

  • ROI table adopts a progressive design: longer holding time means lower profit target
  • 10% fixed stop loss as bottom-line protection
  • Trailing stop used to lock in profits, activated after reaching 3% profit

2.2 Order Type Configuration

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

All orders use limit orders to ensure precise price execution.


III. Buy Conditions Detailed Analysis

3.1 Protection Mechanisms (26 Groups)

Each buy condition is paired with independent protection parameter groups, including:

Protection TypeParameter DescriptionDefault Example
EMA Fast FilterCheck if fast line is above slow lineema_fast_len: 26/50/100/200
EMA Slow FilterCheck slow line trend directionema_slow_len: 26/50/100/200
Close Above EMAVerify price positionclose_above_ema_fast_len: 12-200
SMA200 RisingConfirm long-term trend upwardsma200_rising_val: 20-50
1h SMA200 RisingMulti-timeframe trend confirmationsma200_1h_rising_val: 20-50
Safe Dip ProtectionPrevent entry during crashessafe_dips_type: 10-100 level
Safe Pump ProtectionPrevent entry after surgessafe_pump_type: 10-120 level

3.2 Typical Buy Condition Examples

Condition #1: Basic Trend Buy

# Logic
- EMA fast line > EMA 200 (trend confirmation)
- SMA200 rising (long-term trend upward)
- Safe Dip protection (prevent crash entry)
- Safe Pump protection (prevent post-surge entry)

Condition #2: EMA Slope Buy

# Logic  
- EMA slow line trend confirmation
- Safe Dip level 50
- Close above EMA verification

3.3 Classification of 26 Buy Conditions

The strategy's buy conditions can be categorized into the following types:

Condition GroupCondition NumbersCore Logic
Trend Type1, 2, 3, 4, 5EMA/SMA trend confirmation + protection filtering
RSI+MFI Type6, 7, 8RSI indicator combined with money flow
Bollinger Band Type9, 10, 11, 12BB lower band breakout + RSI verification
EWO Type13, 16, 17Elliott Wave Oscillator signals
Composite Type14, 15, 18, 19, 20, 21, 22, 23, 24, 26Multi-indicator combination verification
Special Type25Special signal conditions

IV. Sell Logic Detailed Analysis

4.1 Multi-layer Take-Profit System

The strategy adopts a tiered take-profit mechanism, combined with custom_sell:

Profit Range        RSI Threshold    Signal Name
─────────────────────────────────────────────────
> 20% < 34 signal_profit_11
12-20% < 42 signal_profit_10
10-12% < 54 signal_profit_9
8-10% < 54 signal_profit_8
7-8% < 48 signal_profit_7
6-7% < 45 signal_profit_6
5-6% < 43 signal_profit_5
4-5% < 42 signal_profit_4
3-4% < 37 signal_profit_3
2-3% < 35 signal_profit_2
1-2% < 34 signal_profit_1
0-1% < 34 signal_profit_0

4.2 Special Sell Scenarios

ScenarioTrigger ConditionSignal Name
Below EMA200 Take-ProfitPrice below EMA200 + RSI conditionsignal_profit_u_*
Post-Pump Take-Profit48h/36h/24h pump identificationsignal_profit_p_*
SMA Declining Take-ProfitSMA200 downtrend + profit rangesignal_profit_d_*
Trailing Take-ProfitPullback from high + RSI rangesignal_profit_t_*

4.3 Base Sell Signals (8 Total)

# Sell Signal 1: RSI + BB combination
- RSI > sell_rsi_bb_1 (79.5)
- Price near BB upper band

# Sell Signal 2: High RSI warning
- RSI > sell_rsi_bb_2 (81)
- Overbought signal confirmation

# Sell Signal 3: Main RSI threshold
- RSI > sell_rsi_main_3 (82)
- Strong overbought confirmation

# Sell Signal 4: Dual RSI confirmation
- 5m RSI > 73.4
- 1h RSI > 79.6

# Sell Signal 5: EMA relative position
- Price deviation from EMA
- RSI difference verification

# Sell Signal 6: RSI below threshold
- RSI > sell_rsi_under_6 (79)
- Overbought pullback confirmation

# Sell Signal 7: 1h RSI trigger
- 1h RSI > sell_rsi_1h_7 (81.7)
- Large timeframe overbought

# Sell Signal 8: BB relative position
- Price exceeds BB middle band by 110%
- Bollinger band deviation sell

V. Technical Indicator System

5.1 Core Indicators

Indicator CategorySpecific IndicatorsPurpose
Trend TypeEMA(12,15,20,26,35,50,100,200)Trend direction confirmation
Trend TypeSMA(5,30,200)Long-term trend verification
Momentum TypeRSI(14)Overbought/oversold judgment
Momentum TypeMFIMoney flow verification
Volatility TypeBB(20,40) - STD2Price volatility boundary
Volatility TypeEWO(50,200)Elliott Wave Oscillator
Special TypeZEMA(61)Zero-Lag EMA
Special TypeChoppiness(14)Market oscillation indicator

5.2 Informative Timeframe Indicators (1h)

The strategy uses 1h as the informative layer, providing higher-dimension trend judgment:

  • EMA(12,15,20,26,35,50,100,200) - Large cycle trend
  • SMA200 decline detection - 20-period slope judgment
  • RSI(14) - Large cycle momentum
  • BB(20) - Large cycle volatility range
  • CMF(20) - Chaikin Money Flow
  • Pump protection calculation - 24/36/48h gain monitoring

VI. Risk Management Features

6.1 Dip Protection System

The strategy includes 12 levels of Dip protection parameters, from strict to loose:

LevelNameApplication Scenario
10Strict DipPrevent deep drop entry
20-40Moderate DipBalance drop entry
50-80Normal DipGeneral drop protection
90-110Loose DipHigher drop tolerance

6.2 Pump Protection System

Prevent chasing highs after surges:

Time Window    Gain Threshold    Pullback Threshold
─────────────────────────────────────────────────────
24h 0.42-0.78 1.5-2.2
36h 0.58-0.78 1.5-2.0
48h 0.8-2.0 1.3-2.0

6.3 Long-term Position Take-Profit

For positions held over 900-1200 minutes:

sell_custom_long_duration_min_1 = 900  # 15 hours
sell_custom_long_profit_min_1 = 0.03 # 3% profit
sell_custom_long_profit_max_1 = 0.04 # 4% profit

VII. Strategy Advantages and Limitations

✅ Advantages

  1. Multi-layer Protection System: 26 independent protection parameter groups effectively filter false signals
  2. Flexible Buy Combination: Any buy condition can be independently enabled/disabled for easy optimization
  3. Dynamic Take-Profit Mechanism: custom_sell provides profit locking and pullback protection
  4. Multi-timeframe Verification: 1h informative layer provides large-cycle trend confirmation

⚠️ Limitations

  1. High Complexity: Over 300 parameters, difficult to tune
  2. Computational Resource Requirements: startup_candle_count = 400, requires longer historical data
  3. Overfitting Risk: Numerous parameters may lead to excellent historical performance but large real trading differences

VIII. Applicable Scenario Recommendations

Market EnvironmentRecommended ConfigurationDescription
Slow Bull TrendEnable all buy conditionsFollow trend, catch pullbacks
Oscillating MarketEnable BB + RSI conditionsUtilize volatility boundary signals
DowntrendEnable strict Dip protection levelsWait for deep drops before rebound
Surge MarketEnable strict Pump protection levelsAvoid chasing highs

IX. Applicable Market Environment Details

SampleStrategy is a typical complex trend-following strategy. Based on its code architecture, it is most suitable for mild trend markets, while performance may be unstable in extreme market conditions.

9.1 Strategy Core Logic

  • Multi-layer Protection Philosophy: Build a defense network through 26 protection parameter groups
  • Tiered Take-Profit Design: Dynamically adjust sell thresholds based on profit ranges
  • Multi-timeframe Verification: 1h trend confirmation + 5m entry execution

9.2 Performance in Different Market Environments

Market TypePerformance RatingReason Analysis
📈 Mild Uptrend⭐⭐⭐⭐⭐Multi-layer protection effectively filters, trend following is smooth
🔄 Oscillating Sideways⭐⭐⭐☆☆BB+RSI conditions can catch oscillation, but signals may be too many
📉 Slow Decline⭐⭐☆☆☆Dip protection prevents crash entry, but frequent stop losses
⚡ Fast Surge⭐☆☆☆☆Pump protection may prevent entry, missing opportunities

9.3 Key Configuration Recommendations

Configuration ItemRecommended ValueDescription
Number of Trading Pairs40-80 pairsOfficial recommended range
Parallel Trades4-6Balance risk diversification
Timeframe5m (fixed)Cannot be changed
Trading Pair TypeUSDT stable pairsAvoid BTC/ETH pairs

X. Important Note: The Cost of Complexity

10.1 Learning Curve

The strategy has over 300 parameters. Understanding all logic requires:

  • Familiarity with Freqtrade strategy framework
  • Understanding of various technical indicator principles
  • Mastery of relationships between protection parameters

10.2 Hardware Requirements

Number of PairsMinimum MemoryRecommended Memory
20-404GB8GB
40-808GB16GB

10.3 Backtest vs Real Trading Differences

Complex strategies often perform better in backtests:

  • Backtests cannot simulate slippage and delays
  • Many parameters easily fit historical optimum
  • Recommend dry-run verification first

10.4 Manual Trader Advice

Not recommended for manual traders to use this strategy directly:

  • Condition judgment is overly complex
  • Requires real-time monitoring of multiple timeframes
  • Manual execution difficult to achieve strategy effectiveness

XI. Conclusion

SampleStrategy is a highly complex multi-condition trend-following strategy. Its core value lies in:

  1. Defensive Design: 26 protection parameter groups build multiple safety nets
  2. Flexible Combination: Buy conditions can be independently controlled for targeted optimization
  3. Dynamic Take-Profit: custom_sell provides profit protection mechanism

For quantitative traders, this strategy is suitable for experienced users for secondary development. It is not recommended for beginners to use directly in live trading. Recommend dry-run testing first, and adjust the buy condition enablement combination based on specific markets.