Skip to main content

ASDTSRockwellTrading Strategy In-Depth Analysis

Strategy Number: #414 (414th of 465 strategies)
Strategy Type: MACD Trend Following
Timeframe: 5 Minutes (5m)


I. Strategy Overview

ASDTSRockwellTrading is a minimalist trend-following strategy based on the MACD (Moving Average Convergence Divergence) indicator. The strategy concept is derived from a YouTube trading tutorial, with clear and concise core logic: buy when MACD is above the zero line and above the signal line, sell when MACD falls below the signal line. This is a classic momentum trend strategy suitable for trending markets.

Core Features

FeatureDescription
Buy Condition1 core buy signal (MACD bullish confirmation)
Sell Condition1 basic sell signal (MACD bearish confirmation)
Protection MechanismFixed stop-loss + ROI tiered take-profit
Timeframe5 Minutes (5m)
Dependenciestalib, qtpylib

II. Strategy Configuration Analysis

2.1 Basic Risk Parameters

# ROI exit table
minimal_roi = {
"0": 0.05, # Exit immediately at 5% profit
"20": 0.04, # Exit at 4% after 20 minutes
"30": 0.03, # Exit at 3% after 30 minutes
"60": 0.01 # Exit at 1% after 60 minutes
}

# Stop-loss setting
stoploss = -0.30 # -30% stop-loss

Design Rationale:

  • Quick Take-Profit: 5% take-profit at start, pursuing rapid gains
  • Time Decay: Longer holding periods reduce profit requirements
  • Moderate Stop-Loss: 30% stop-loss provides time for trend development

2.2 Order Type Configuration

The strategy does not customize order_types, using default configuration.

2.3 Timeframe

timeframe = '5m'  # 5-minute candlesticks

III. Buy Condition Details

3.1 Core Buy Logic

def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['macd'] > 0) &
(dataframe['macd'] > dataframe['macdsignal'])
),
'buy'] = 1
return dataframe

Dual Confirmation Buy Signal:

Condition ElementParameterDescription
MACD > 0Above zero lineMomentum is positive, in bullish market
MACD > SignalAbove signal lineMACD line crossed above signal line, momentum accelerating

3.2 Buy Signal Interpretation

This is a classic MACD bullish entry signal:

  1. MACD > 0: Indicates short-term moving average is above long-term moving average, market is in uptrend
  2. MACD > Signal: Indicates MACD line is above signal line, momentum is strengthening

Signal Strength: Dual confirmation, more reliable than single crossover signals

3.3 Entry Timing

Best entry timing:

  • MACD just crossed above zero line (trend initiation)
  • MACD accelerating upward above zero line (trend strengthening)
  • Signal line starting to diverge upward below zero line

IV. Sell Logic Details

4.1 Sell Conditions

def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['macd'] < dataframe['macdsignal'])
),
'sell'] = 1
return dataframe

Single Sell Signal: MACD crosses below signal line

Condition ElementParameterDescription
MACD < SignalBelow signal lineMACD line crossed below signal line, momentum weakening

4.2 Sell Condition Analysis

Sell Signal Trigger Conditions:

  • Triggered when MACD crosses below signal line
  • Does not require MACD < 0: Sells even if MACD is above zero line, as long as it crosses below signal line

Design Considerations:

  • Quick response to momentum decay
  • Does not wait for complete trend reversal
  • Better to exit early than to be deeply trapped

4.3 Sell Signal Analysis

ScenarioMACD PositionSignal PositionTriggers Sell
Crossover above zero> 0MACD crosses down✅ Yes
Crossover below zero< 0MACD crosses down✅ Yes
Oscillation near zero≈ 0MACD crosses down✅ Yes

V. Technical Indicator System

5.1 Core Indicator: MACD

def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
macd = ta.MACD(dataframe)
dataframe['macd'] = macd['macd']
dataframe['macdsignal'] = macd['macdsignal']
dataframe['macdhist'] = macd['macdhist']
return dataframe

MACD Indicator Components:

IndicatorDescriptionPurpose
MACD LineDIF line (fast line)Determine momentum direction
Signal LineDEA line (slow line)Determine momentum change
HistogramBar chart (difference)Not used in this strategy

MACD Default Parameters (talib default):

  • Fast period: 12
  • Slow period: 26
  • Signal period: 9

5.2 Indicator Calculation Principle

MACD calculation formula:

MACD = EMA(12) - EMA(26)
Signal = EMA(MACD, 9)
Histogram = MACD - Signal

Indicator Meaning:

  • MACD > 0: Short-term moving average above long-term moving average, uptrend
  • MACD < 0: Short-term moving average below long-term moving average, downtrend
  • MACD crosses above Signal: Momentum accelerating
  • MACD crosses below Signal: Momentum decelerating

VI. Risk Management Features

6.1 Tiered Take-Profit Mechanism

Holding TimeTake-Profit ThresholdDescription
0 minutes5%Demands 5% return from entry
20 minutes4%Reduces requirements after ~4 candles
30 minutes6 candlesContinues to reduce requirements
60 minutes1%Accepts minimal profit after 12 candles

6.2 Fixed Stop-Loss

  • Stop-Loss Value: -30%
  • Characteristics: Relatively loose, provides room for trend development
  • Risk: May incur significant drawdown

6.3 No Trailing Stop

The strategy does not enable trailing_stop, relying on fixed stop-loss and ROI exits.


VII. Strategy Advantages and Limitations

✅ Advantages

  1. Classic Logic: MACD is a mature technical indicator with solid theoretical foundation
  2. Clear Signals: Buy/sell conditions are unambiguous
  3. Simple Code: About 60 lines, easy to understand and maintain
  4. Trend-Friendly: Performs well in trending markets
  5. Quick Response: Sell signal only looks at MACD vs Signal, doesn't wait for zero line

⚠️ Limitations

  1. Oscillation Market Noise: MACD frequently crosses during sideways oscillation, generating false signals
  2. Wide Stop-Loss: 30% stop-loss may be too large
  3. No Market Filter: Enters on signals regardless of market state
  4. Single Indicator: Relies entirely on MACD, lacks confirmation mechanism

VIII. Applicable Scenario Recommendations

Market EnvironmentRecommended ConfigurationDescription
Trending MarketDefault ConfigurationSuitable for uptrends
Oscillating MarketPause UsageToo many false signals
High Volatility MarketAdd ADX FilterConfirm trend strength
Conservative TradingTighten Stop-Loss to -15%Reduce risk exposure

IX. Applicable Market Environment Details

ASDTSRockwellTrading is a pure trend-following strategy. Based on its code architecture, it is best suited for clear trending markets, while performing poorly in oscillating markets.

9.1 Strategy Core Logic

  • Trend Confirmation: MACD > 0 indicates bullish trend
  • Momentum Confirmation: MACD > Signal indicates strengthening momentum
  • Exit Mechanism: MACD < Signal indicates momentum decay

9.2 Performance in Different Market Environments

Market TypePerformance RatingAnalysis
📈 Uptrend⭐⭐⭐⭐⭐MACD bullish confirmation, following the trend
🔄 Sideways Oscillation⭐☆☆☆☆Frequent crossovers, signal whipsaws
📉 Downtrend⭐☆☆☆☆MACD < 0, no entry, stays in cash
⚡️ High Volatility⭐⭐⭐☆☆Many false signals, needs filtering

9.3 Key Configuration Recommendations

Configuration ItemRecommended ValueDescription
Timeframe5m/15mAvoid lower timeframe noise
Stop-Loss-15%Original -30% is too wide
ADX FilterOptional AdditionOnly enter when ADX > 25

X. Important Note: The Cost of Complexity

10.1 Learning Cost

The strategy code is extremely simple, and MACD is an entry-level technical analysis indicator with low learning cost.

10.2 Hardware Requirements

Number of Trading PairsMinimum MemoryRecommended Memory
1-10 pairs512MB1GB
10-50 pairs1GB2GB
50+ pairs2GB4GB

10.3 Differences Between Backtesting and Live Trading

  • Backtesting: Performs well in trending markets, frequent stop-losses in oscillating markets
  • Live Trading: Need to monitor slippage and fees' impact on short-term strategies

10.4 Manual Trading Recommendations

Strategy core can be executed manually:

  1. Open 5-minute candlestick chart
  2. Add MACD indicator (default parameters 12, 26, 9)
  3. Buy when MACD > 0 and MACD > Signal
  4. Sell when MACD < Signal

XI. Conclusion

ASDTSRockwellTrading is a classic MACD trend-following strategy. Its core value lies in:

  1. Classic Logic: Based on the mature MACD indicator
  2. Clear Signals: Buy/sell conditions are unambiguous
  3. Simple Code: Easy to understand and modify
  4. Educational Value: Suitable as a starting point for strategy learning

For quantitative traders, this is a strategy that can serve as a foundational framework. It is recommended to add trend filtering and risk management modules before committing to live trading.


XII. Strategy Source

This strategy is based on concepts from a YouTube video tutorial: https://www.youtube.com/watch?v=mmAWVmKN4J0

Author: Gert Wohlgemuth

Core Concepts:

  • Uptrend definition: MACD above zero line and above signal line
  • Downtrend definition: MACD below zero line and below signal line
  • Sell signal: MACD below signal line