Skip to main content

NFI46 Strategy Analysis

Strategy ID: #261 (261st of 465 strategies)
Strategy Type: Multi-condition Trend Following + Multi-layer Protection Mechanisms
Timeframe: 5 Minutes (5m) + 1 Hour (1h) Informational Layer


I. Strategy Overview

NFI46 is the 46th strategy in the NostalgiaForInfinityV4 series, developed by iterativ. This is a typical complex trend-following strategy that combines multiple entry conditions, dynamic take-profit logic, and comprehensive risk protection mechanisms. The strategy captures entry opportunities across different market environments through 17 independent buy signals and implements refined profit management via a 12-level dynamic take-profit system.

Core Features

FeatureDescription
Entry Conditions17 independent buy signals, independently enableable/disableable
Exit Conditions8 basic sell signals + 12-level dynamic take-profit + multi-scenario sell logic
Protection MechanismsDip Protection (12 thresholds) + Pump Protection (9 parameter sets)
Timeframe5m primary framework + 1h informational framework
Dependenciesqtpylib, talib, numpy, pandas

II. Strategy Configuration Analysis

2.1 Basic Risk Parameters

# ROI Exit Table
minimal_roi = {
"0": 0.10, # Immediate: 10%
"30": 0.05, # After 30 minutes: 5%
"60": 0.02 # After 60 minutes: 2%
}

# Stop Loss Settings
stoploss = -0.10 # 10% hard stop loss

# Trailing Stop
trailing_stop = True
trailing_stop_positive = 0.01 # Activates after 1% profit
trailing_stop_positive_offset = 0.025 # Triggers at 2.5% profit

Design Philosophy:

  • ROI uses a three-tier declining design, encouraging longer holds while locking in partial profits
  • 10% hard stop loss as the last line of defense, paired with dynamic trailing stop for dual protection
  • Trailing stop parameters are relatively conservative, allowing price room for fluctuation

2.2 Order Type Configuration

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

All orders use market orders to ensure fast execution.


III. Entry Conditions Details

3.1 Protection Mechanisms (3 Groups)

Each entry condition is equipped with independent protection parameter groups, using a dual-protection architecture:

Dip Protection (Pullback Protection)

TypeParametersFunction
Normalthreshold_1~4Standard pullback protection (1, 2, 12, 144 periods)
Strictthreshold_5~8Strict pullback protection (tighter thresholds)
Loosethreshold_9~12Loose pullback protection (allows larger pullbacks)
# Normal Dip Protection Example
safe_dips_normal = (
((open - close) / close < threshold_1) &
((open.rolling(2).max() - close) / close < threshold_2) &
((open.rolling(12).max() - close) / close < threshold_3) &
((open.rolling(144).max() - close) / close < threshold_4)
)

Pump Protection (Pump-Up Protection)

Time WindowNormalStrictLoose
24hthreshold_1/4/7pull_threshold_1/4/7Looser parameters
36hthreshold_2/5/8pull_threshold_2/5/8Looser parameters
48hthreshold_3/6/9pull_threshold_3/6/9Looser parameters

3.2 Typical Entry Condition Examples

Condition #1: Trend Pullback Entry

# Logic
- 1h EMA50 > EMA200 golden cross
- SMA200 uptrend
- Safe pullback protection + 48h Pump protection
- RSI oversold (< 21.6)
- MFI money flow low (< 47.4)

Characteristics: Classic trend pullback strategy, seeking oversold entry points in an uptrend.

Condition #3: Bollinger Band Breakout Pullback

# Logic
- Price above 1h EMA200's 99.8%
- Multiple EMAs in bullish alignment
- BB40 lower band breakout + price regression
- Special condition: bbdelta > close * 5.3%

Characteristics: Uses Bollinger Band width to identify breakout opportunities after volatility contraction.

Condition #8: Alligator Breakout

# Logic
- Price above 1h EMA200's 99.4%
- Alligator three-line bullish alignment
- All three lines rising simultaneously (momentum confirmation)
- Bullish candle close
- RSI < 30.4

Characteristics: Combines Alligator indicator to capture trend initiation points.

3.3 Classification of 17 Entry Conditions

Condition GroupCondition NumbersCore Logic
Trend Pullback#1, #5, #14, #15Seeking oversold pullback entries in uptrends
Bollinger Band Strategy#2, #3, #4, #5, #6, #14Using BB lower band breakouts for rebound opportunities
EMA Difference#5, #6, #7, #14, #15Using EMA26-EMA12 difference for trend momentum
Alligator#8Using Alligator alignment for trend initiation
EWO Strategy#12, #13, #16, #17Using Elliott Wave Oscillator for wave trading

IV. Exit Conditions Details

4.1 Multi-Level Take-Profit System

The strategy employs a 12-level dynamic take-profit mechanism:

Profit Range           Take-Profit Threshold    Signal Name
─────────────────────────────────────────────────────────────
> 23.7% RSI < 39.31 signal_profit_11
11.1% ~ 23.7% RSI < 42.94 signal_profit_10
...
1% ~ 2.2% RSI < 38.65 signal_profit_1
0.1% ~ 2.2% RSI < 32.69 signal_profit_0

Core Logic: Higher profit yields looser RSI thresholds, encouraging longer holds during trends.

4.2 Special Exit Scenarios

ScenarioTrigger ConditionSignal Name
Below EMA200 Take-Profitclose < EMA200 with profit conditions metsignal_profit_u_*
Post-Pump Take-Profit24h/36h/48h surge exceeds thresholdsignal_profit_p_*
SMA Decline Take-ProfitSMA200 downtrendsignal_profit_d_*
Trailing Take-ProfitMax profit drawdown exceeds thresholdsignal_profit_t_*
Stop-Loss ScenarioPost-pump loss + SMA declinesignal_stoploss_p_*

4.3 Basic Sell Signals (8)

# Sell Signal 1: BB Upper Band Continuous Breakout + RSI Overbought
- RSI > 64.9
- 6 consecutive candle closes above BB upper band

# Sell Signal 2: BB Upper Band Short-Term Breakout + RSI Extreme Overbought
- RSI > 72.8
- 3 consecutive candle closes above BB upper band

# Sell Signal 3: RSI Extreme Overbought
- RSI > 90.0

# Sell Signal 4: Dual RSI Overbought
- 5m RSI > 76.1 AND 1h RSI > 82.1

# Sell Signal 6: EMA50~200 Zone + RSI Overbought
- close between EMA50 and EMA200
- RSI > 83.7

# Sell Signal 7: 1h RSI Overbought + EMA Death Cross
- 1h RSI > 93.7
- EMA12 crosses below EMA26

# Sell Signal 8: Price Breaks BB Upper Band
- close > 1h BB upper band * 1.158

V. Technical Indicator System

5.1 Core Indicators

Indicator CategorySpecific IndicatorsPurpose
TrendEMA 12/15/20/26/35/50/100/200, SMA 5/30/200Trend identification, support/resistance
MomentumRSI 14, MFIOverbought/oversold identification
VolatilityBB 20/40Volatility channels, breakout signals
SpecialEWO (Elliott Wave), AlligatorWave identification, trend initiation
Money FlowCMF 20Money inflow/outflow analysis

5.2 Informational Timeframe Indicators (1h)

The strategy uses 1h as the informational layer for higher-dimensional trend judgment:

  • EMA series (12/15/20/26/35/50/100/200)
  • SMA 200 and its directional judgment
  • RSI 14
  • BB 20
  • CMF 20
  • Pump/Safe Pump markers (24h/36h/48h windows)

VI. Risk Management Highlights

6.1 Dip Protection Mechanism

The strategy monitors pullback depth across four time dimensions, preventing "catching a falling knife":

PeriodFunctionDefault Threshold
1Current candle pullback3.2%
22-period max pullback5.3%
12Short-term pullback35.8%
144Long-term pullback24.8%

6.2 Pump Protection Mechanism

Prevents chasing after significant price surges:

safe_pump = (
(range_percent_change < thresh) | # Surge not exceeding threshold
(range_maxgap_adjusted > range_height) # Or sufficient pullback already occurred
)

6.3 Trailing Stop

trailing_stop = True
trailing_stop_positive = 0.01
trailing_stop_positive_offset = 0.025

Trailing stop activates after 2.5% profit and triggers on 1% drawdown.


VII. Strategy Pros & Cons

✅ Pros

  1. Rich Signals: 17 entry conditions covering multiple entry scenarios, improving opportunity capture
  2. Comprehensive Protection: Dip + Pump dual protection, effectively avoiding chasing highs and catching falling knives
  3. Refined Take-Profit: 12-level dynamic take-profit + multi-scenario sell logic for refined profit management
  4. Framework Synergy: 5m trading + 1h trend confirmation reduces false signals
  5. Adjustable Parameters: All conditions independently enableable/disableable for easy optimization

⚠️ Cons

  1. Many Parameters: 150+ parameters, high optimization difficulty, easy to overfit
  2. Computational Complexity: Requires 400 candles for startup, high memory and computation requirements
  3. Complex Logic: High learning curve, not suitable for beginners
  4. Trend-Dependent: May underperform in ranging markets

VIII. Applicable Scenarios

Market EnvironmentRecommended ConfigurationNotes
Slow Bull TrendAll entry conditions enabledFully utilize trend pullback opportunities
Ranging MarketOnly EWO conditions enabled (#12, #13, #16, #17)Wave strategies may perform better
Bear MarketDisable strategy or only use strictest conditionsTrend strategies have high risk in bear markets
High VolatilityEnable Strict Dip/Pump protectionTighter protection parameters

IX. Applicable Market Environment Details

NFI46 is the "all-around warrior" of the NostalgiaForInfinity series. Based on its code architecture and community long-term live-trading validation, it is best suited for markets with clear trends, and underperforms during ranging consolidations or sharp crashes.

9.1 Core Strategy Logic

  • Trend-Following Nature: Most entry conditions require EMA50 > EMA200 and other trend confirmations
  • Pullback Entry Philosophy: Seeking oversold opportunities within uptrends, not chasing rallies
  • Protection-First Principle: Dip/Pump protection avoids entering at unfavorable timings

9.2 Performance in Different Market Environments

Market TypeRatingAnalysis
📈 Slow Bull Trend⭐⭐⭐⭐⭐Perfectly matches strategy design; trend pullbacks provide entry opportunities
🔄 Ranging Sideways⭐⭐☆☆☆Trend conditions hard to satisfy; false signals increase
📉 Bear Market Decline⭐☆☆☆☆Trend strategies face extreme risk from counter-trend trades
⚡️ Sharp Volatility⭐⭐⭐☆☆Protection mechanisms may filter some opportunities, but reduces risk

9.3 Key Configuration Recommendations

ConfigurationRecommended ValueNotes
Number of Pairs40~80 pairsOfficial recommendation, ensures sufficient entry opportunities
Concurrent Positions4~6Balance risk and return
BlacklistLeveraged tokens (*BULL, *BEAR, etc.)Avoid abnormal volatility
TimeframeMust use 5mOther timeframes not validated

X. Important Notes: The Cost of Complexity

10.1 Learning Curve

Understanding NFI46 requires mastering:

  • The independent logic of 17 entry conditions
  • The trigger conditions of the 12-level take-profit system
  • The calculation method of Dip/Pump protection
  • The complete flow of the custom_sell function

Recommendation: First disable most conditions, only retain 2-3 core conditions for testing, and gradually enable more conditions after understanding.

10.2 Hardware Requirements

Number of PairsMinimum MemoryRecommended Memory
40 pairs4GB8GB
80 pairs8GB16GB
100+ pairs16GB32GB

Note: startup_candle_count = 400, requires loading a large amount of historical data.

10.3 Backtesting vs. Live Trading Differences

  • Overfitting Risk: Many parameters may produce "perfect" backtesting performance
  • Slippage Impact: Market orders may incur additional costs in live trading
  • Execution Delay: Complex calculations may cause signal delays

10.4 Manual Trading Recommendations

If considering using NFI46 signals manually:

  1. Focus on entry condition #1 (trend pullback) as the primary signal
  2. Use condition #3 (Bollinger Band) as auxiliary confirmation
  3. Strictly follow Dip/Pump protection logic
  4. Set take-profit targets instead of waiting for signals

XI. Summary

NFI46 is a fully-featured trend-following strategy. Its core value lies in:

  1. Multi-Dimensional Entry: 17 entry conditions covering different market states
  2. Comprehensive Protection: Dip/Pump dual protection mechanism effectively controls risk
  3. Refined Take-Profit: 12-level dynamic take-profit system maximizes profit capture
  4. High Customizability: All conditions independently switchable for easy personalization

For quantitative traders, NFI46 is a strategy framework worthy of deep research and optimization, but be aware of overfitting risks and the complexity of live execution. It is recommended to conduct sufficient backtesting and dry-run validation before gradually deploying real funds into live trading.