Skip to main content

MACD_Cross Strategy Analysis

Strategy Number: #190 (190th of 465 strategies)
Strategy Type: Trend Following / Moving Average Crossover
Timeframe: 5 Minutes (5m)


I. Strategy Overview

MACD_Cross is a simplified version of the MACD strategy, focusing exclusively on MACD's crossover signals, removing the CCI condition constraint. The core idea is: buy when the MACD line crosses above the Signal line from below, and sell when it crosses from above.

Core Features

FeatureDescription
Entry ConditionMACD crosses above Signal line + CCI < -50
Exit ConditionMACD crosses below Signal line + CCI > 100
ProtectionHard stop-loss
Timeframe5 Minutes
DependenciesTA-Lib, technical (qtpylib)

II. Strategy Configuration Analysis

2.1 Basic Risk Parameters

minimal_roi = {
"60": 0.01, # After 60 minutes: 1% exit
"30": 0.03, # After 30 minutes: 3% exit
"20": 0.04, # After 20 minutes: 4% exit
"0": 0.05 # Immediate: 5% exit
}

stoploss = -0.30 # -30% hard stop-loss

Design Philosophy:

  • Identical risk parameter settings to the MACD strategy
  • Streamlined entry/exit conditions

2.2 Fixed Parameters

# Entry Condition
buy_cci_threshold = -50.0

# Exit Condition
sell_cci_threshold = 100.0

III. Entry Conditions Details

3.1 Core Entry Logic

# Entry Condition
(
qtpylib.crossed_above(dataframe['macd'], dataframe['macdsignal']) & # MACD crosses above Signal
(dataframe['cci'] <= -50.0) # CCI oversold
)

Interpretation:

  1. MACD crosses above Signal: MACD line just crossed from below to above (key crossover signal)
  2. CCI <= -50: CCI is in oversold territory

3.2 Crossover Detection

# Using qtpylib's crossover detection function
qtpylib.crossed_above(array1, array2)

Characteristics:

  • Detects "just crossed" rather than a sustained state
  • More sensitive than simple "MACD > Signal"
  • Earlier signals, but may increase false signals

IV. Exit Conditions Details

4.1 Core Exit Logic

# Exit Condition
(
qtpylib.crossed_below(dataframe['macd'], dataframe['macdsignal']) & # MACD crosses below Signal
(dataframe['cci'] >= 100.0) # CCI overbought
)

Interpretation:

  1. MACD crosses below Signal: MACD line just crossed from above to below
  2. CCI >= 100: CCI is in overbought territory

V. Technical Indicator System

5.1 MACD Indicator

IndicatorCalculationDefault Period
MACDEMA12 - EMA2612, 26
SignalEMA9 of MACD9
HistogramMACD - Signal-

5.2 CCI Indicator

CCI = (Typical Price - SMA) / (0.015 × Mean Deviation)
ZoneCCI Value
Oversold< -100
Neutral-100 ~ 100
Overbought> 100

VI. Risk Management

6.1 ROI Exit Strategy

TimeMinimum Profit
0 minutes5%
20 minutes4%
30 minutes3%
60 minutes1%

6.2 Stop-Loss Strategy

ParameterValue
Hard Stop-30%

VII. Strategy Pros & Cons

✅ Pros

  1. Earlier Signals: crossed_above/below is more sensitive than sustained states
  2. Clean & Clear: Logic is simple, easy to understand
  3. Classic Combo: MACD crossover + CCI filtering
  4. Fast Response: Catches trend changes more quickly

⚠️ Cons

  1. More False Signals: Crossover signals are more prone to false signals than sustained states
  2. No Parameter Optimization: Fixed CCI thresholds, no auto-optimization
  3. Inherent Lag: MACD's lagging nature cannot be fully eliminated
  4. Large Stop-Loss: -30% is a wide stop

VIII. MACD vs. MACD_Cross Comparison

CharacteristicMACDMACD_Cross
MACD ConditionMACD > Signalcrossed_above
CCI ConditionOptimizableFixed (-50/100)
Signal SensitivityLowerHigher
False SignalsFewerMore
Optimization SpaceSupports hyperoptFixed parameters

IX. Applicable Scenarios

Market EnvironmentPerformanceDescription
Trending Up⭐⭐⭐⭐⭐Perfectly captures crossover points
Trending Down⭐⭐⭐⭐⭐Same logic applied for shorting
Ranging Upward⭐⭐⭐Crossover signals are frequent
Sideways Ranging⭐⭐False signals increase

X. Parameter Adjustment

10.1 Adjustable Parameters

ParameterCurrent ValueAdjustment Suggestion
buy_cci-50-100 ~ 0
sell_cci1000 ~ 500
timeframe5mAdjust per style
stoploss-0.30-0.20 ~ -0.40

10.2 Timeframe

TimeframeCharacteristics
1m/5mMore signals, higher noise
15m/1hBalanced
4hFewer signals but more stable

XI. Summary

MACD_Cross is a simplified version of the classic MACD strategy, focusing on the moment of MACD line crossovers. Compared to the standard MACD strategy, it uses more sensitive crossover detection functions, catching trend changes earlier — but may also generate more false signals.

Core characteristics:

  1. Crossover Signals: Uses crossed_above/below to detect instant crossings
  2. CCI Filtering: Fixed CCI thresholds as auxiliary confirmation
  3. Simple Logic: Conditions are easy to understand and implement
  4. Fast Response: Issues signals earlier than sustained-state conditions

Usage recommendations:

  • Suitable for traders seeking earlier entry timing
  • Needs trend filtering to reduce false signals
  • Best performance in clearly trending markets
  • Validate signal quality on paper trading first