Skip to main content

Ninja_SMA Strategy: In-Depth Analysis

Strategy ID: #244 (Strategy #244 of 465) Strategy Type: NFI Series - Ninja SMA Mode Timeframe: 15 Minutes (15m)


I. Strategy Overview

Ninja_SMA is the "Ninja" version within the NFI (Nostalgia For Infinity) series, using SMA (Simple Moving Average) as its core analytical tool. The Ninja version represents an agile, fast trading style. While maintaining NFI's multi-condition architecture advantages, signal response speed has been optimized.

SMA is one of the most basic and classic trend indicators in technical analysis, smoothing price fluctuations by calculating the average price over a certain period to reflect market trend direction. Ninja_SMA combines SMA's stability with Ninja's agility, forming a trading system that is both robust and flexible.

Core Characteristics

FeatureDescription
Entry ConditionsMultiple SMA-based trend signals
Exit ConditionsMulti-layer take-profit + stop-loss protection
Protection MechanismsSMA trend filtering + dynamic stop-loss
Timeframe15-minute primary timeframe
Dependenciespandas, numpy, TA-Lib

II. Strategy Configuration Analysis

2.1 Core Risk Parameters

# ROI Exit Table (Time: Minimum Profit Rate)
minimal_roi = {
"0": 0.10, # Immediate exit: 10% profit
"30": 0.06, # After 30 minutes: 6% profit
"60": 0.035, # After 60 minutes: 3.5% profit
"120": 0.015 # After 120 minutes: 1.5% profit
}

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

# Trailing Stop
trailing_stop = True
trailing_stop_positive = 0.03 # 3% trailing activation point
trailing_stop_positive_offset = 0.05 # 5% offset trigger

Design Philosophy:

  • Moderate ROI (10%): Balances profit expectation with probability of achievement
  • Standard Stop-Loss (-10%): Controllable loss baseline
  • Flexible Trailing (3-5%): Protects existing profits

2.2 Order Type Configuration

order_types = {
"entry": "limit",
"exit": "limit",
"stoploss": "limit",
"stoploss_on_exchange": False,
"exit_timeout_count": 0,
}

III. Entry Conditions Details

3.1 SMA Core Mechanism

SMA (Simple Moving Average) calculation method:

SMA = (P1 + P2 + ... + Pn) / n

Where P is the closing price for each period and n is the calculation period.

SMA Characteristics:

  • All prices treated equally, equal weighting
  • Good smoothing effect, effectively filters noise
  • Relatively lagging but highly stable

3.2 Core Entry Conditions

Condition Group 1: Golden Cross

  • Short-term SMA crosses above long-term SMA
  • Volume expands with confirmation
  • Price stands above MAs

Condition Group 2: Price Pullback to SMA

  • Price retraces to near SMA and finds support
  • SMA slopes upward
  • Candlestick shows bounce-back signal

Condition Group 3: SMA Multi-Asset Arrangement

  • Short, medium, and long-term SMAs arranged upward in sequence
  • Price above all MAs
  • Trend clearly upward

3.3 Protection Mechanisms

Protection TypeParametersFunction
Trend FilteringPrice vs. SMA relationshipOnly trade with the trend
MA ConfirmationShort-term SMA crosses above long-term SMATrend strengthening confirmation
Support VerificationSMA as dynamic supportConfirm valid support
Multi-Period ResonanceDifferent period SMAs simultaneously metImprove signal quality

IV. Exit Logic Details

4.1 Multi-Layer Take-Profit System

Strategy uses a tiered take-profit mechanism:

Profit Rate Zone     Threshold       Signal Name
─────────────────────────────────────────────
0-30 minutes 10% Quick Profit
30-60 minutes 6% Medium-term Target
60-120 minutes 3.5% Conservative Exit
120+ minutes 1.5% End-of-Session Breakeven

4.2 Special Exit Scenarios

ScenarioTrigger ConditionSignal Name
Death CrossShort-term SMA crosses below long-term SMATrend Exit
Price Breaks Below SMAPrice breaks below key MASupport Breakdown
High Altitude PullbackPrice deviates far from SMAProfit-taking
Stop-Loss TriggeredLoss exceeds 10%Hard Stop

4.3 Basic Exit Signals

# Exit Signal 1: Death Cross
- Short-term SMA crosses below long-term SMA
- Trend weakening

# Exit Signal 2: Breaks Below MA Support
- Price breaks below SMA
- Support becomes resistance

# Exit Signal 3: Stop-Loss Triggered
- Loss reaches -10%
- Protect capital

V. Technical Indicator System

5.1 Core Indicator: SMA

IndicatorParametersPurpose
Short-Term SMA5, 10Sensitive short-term price changes
Medium-Term SMA20, 30Confirm medium-term trend direction
Long-Term SMA50, 100, 200Determine long-term trend direction

5.2 Auxiliary Indicators

IndicatorPurpose
RSIMomentum verification, overbought/oversold judgment
ATRVolatility measurement, dynamic stop-loss reference
VolumeTrend confirmation, price-volume coordination

5.3 SMA Trading Signal Interpretation

Signal TypeConditionMeaning
Golden CrossShort SMA crosses above long SMABuy signal, trend turns bullish
Death CrossShort SMA crosses below long SMASell signal, trend turns bearish
SupportPrice retraces to SMA without breakingBuy opportunity, support valid
Multi-Asset UpSMAs arranged upward in sequenceStrong uptrend, hold positions

VI. Risk Management Features

6.1 SMA Trend Filtering

SMA, as a trend judgment tool, provides the following protection:

Filtering TypeDescription
Trend TradingOnly go long when SMA is upward
MA AngleOnly enter when SMA slopes upward
Multi-Period ConfirmationOnly trade when multiple SMAs resonate

6.2 Tiered Stop-Loss Mechanism

Stop-Loss TypeTrigger ConditionDescription
Hard Stop-10%Final defense, protect principal
Trailing Stop3% activation, 5% triggerProtect existing profits
MA StopPrice breaks below SMATrend exit

6.3 Capital Management Recommendations

Number of PairsSingle Position SizeDescription
5-1010-15%Moderate diversification
10-205-10%Diversify risk
20+3-5%Maximum diversification

VII. Strategy Pros & Cons

✅ Pros

  1. Simple and Intuitive: SMA is the most basic indicator, easy to understand and use
  2. Computationally Efficient: Low resource consumption, fast response
  3. Clear Trends: MA direction is clear, signals are not confusing
  4. Mature and Reliable: Classic method verified by decades of market testing
  5. Ninja Agility: Optimized response speed while maintaining stability

⚠️ Cons

  1. Lagging: SMA is a lagging indicator, relatively slow to respond
  2. Average Ranging Market Performance: Frequent false signals in sideways
  3. Parameter Sensitive: Different period parameters have significantly different effects
  4. Requires Trend: Easily beaten up in ranging markets

VIII. Applicable Scenarios

Market EnvironmentRecommended ConfigDescription
Trending UpActively go longMA multi-asset bullish arrangement
Trending DownShort or stand asideMA multi-asset bearish arrangement
Ranging MarketReduce tradesFilter false signals
Clear TrendFocus participationTrend is a friend

IX. Applicable Market Environment Details

Ninja_SMA is a strategy within the NFI series that combines SMA stability with Ninja agility. Based on its code architecture and market characteristics, it is most suitable for markets with clear trends, while performing average in ranging markets.

9.1 Strategy Core Logic

  • SMA Trend Judgment: Use simple moving average to determine major direction
  • Trend Trading: Go long when SMA is upward, stand aside when downward
  • Ninja Agility: Optimized signal triggering, fast response
  • Multi-Condition Confirmation: Filter false signals, improve win rate

9.2 Performance in Different Market Environments

Market TypeRatingAnalysis
📈 Trending Up⭐⭐⭐⭐⭐MA multi-asset bullish, signals clear, profit by following trend
🔄 Ranging Market⭐⭐☆☆☆Frequent golden/death crosses, many false signals
📉 Downtrend⭐⭐⭐⭐☆MA multi-asset bearish, can short or stand aside
⚡️ Extreme Volatility⭐⭐⭐☆☆Trend clear but volatile, requires caution

9.3 Key Configuration Recommendations

Config ItemRecommended ValueDescription
SMA Period5, 20, 50Classic combination
Stop-Loss-10%Strict stop-loss
Trading Pairs5-15Moderate diversification

X. Summary

Ninja_SMA is a strategy within the NFI series that combines SMA stability with Ninja agility. Its core value lies in:

  1. Simple and Reliable: SMA is the most classic trend indicator, enduring
  2. Computationally Efficient: Low resource consumption, suitable for long-term operation
  3. Clear Trends: MA direction is clear, signals are not confusing
  4. Ninja Optimization: Response speed improved while maintaining stability

For quantitative traders, Ninja_SMA provides a concise, reliable, and easy-to-understand trading system. It is suitable for investors pursuing stable trend trading and is also an introductory choice for learning quantitative trading.