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
| Feature | Description |
|---|---|
| Buy Condition | 1 core buy signal (MACD bullish confirmation) |
| Sell Condition | 1 basic sell signal (MACD bearish confirmation) |
| Protection Mechanism | Fixed stop-loss + ROI tiered take-profit |
| Timeframe | 5 Minutes (5m) |
| Dependencies | talib, 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 Element | Parameter | Description |
|---|---|---|
| MACD > 0 | Above zero line | Momentum is positive, in bullish market |
| MACD > Signal | Above signal line | MACD line crossed above signal line, momentum accelerating |
3.2 Buy Signal Interpretation
This is a classic MACD bullish entry signal:
- MACD > 0: Indicates short-term moving average is above long-term moving average, market is in uptrend
- 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 Element | Parameter | Description |
|---|---|---|
| MACD < Signal | Below signal line | MACD 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
| Scenario | MACD Position | Signal Position | Triggers Sell |
|---|---|---|---|
| Crossover above zero | > 0 | MACD crosses down | ✅ Yes |
| Crossover below zero | < 0 | MACD crosses down | ✅ Yes |
| Oscillation near zero | ≈ 0 | MACD 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:
| Indicator | Description | Purpose |
|---|---|---|
| MACD Line | DIF line (fast line) | Determine momentum direction |
| Signal Line | DEA line (slow line) | Determine momentum change |
| Histogram | Bar 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 Time | Take-Profit Threshold | Description |
|---|---|---|
| 0 minutes | 5% | Demands 5% return from entry |
| 20 minutes | 4% | Reduces requirements after ~4 candles |
| 30 minutes | 6 candles | Continues to reduce requirements |
| 60 minutes | 1% | 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
- Classic Logic: MACD is a mature technical indicator with solid theoretical foundation
- Clear Signals: Buy/sell conditions are unambiguous
- Simple Code: About 60 lines, easy to understand and maintain
- Trend-Friendly: Performs well in trending markets
- Quick Response: Sell signal only looks at MACD vs Signal, doesn't wait for zero line
⚠️ Limitations
- Oscillation Market Noise: MACD frequently crosses during sideways oscillation, generating false signals
- Wide Stop-Loss: 30% stop-loss may be too large
- No Market Filter: Enters on signals regardless of market state
- Single Indicator: Relies entirely on MACD, lacks confirmation mechanism
VIII. Applicable Scenario Recommendations
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| Trending Market | Default Configuration | Suitable for uptrends |
| Oscillating Market | Pause Usage | Too many false signals |
| High Volatility Market | Add ADX Filter | Confirm trend strength |
| Conservative Trading | Tighten 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 Type | Performance Rating | Analysis |
|---|---|---|
| 📈 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 Item | Recommended Value | Description |
|---|---|---|
| Timeframe | 5m/15m | Avoid lower timeframe noise |
| Stop-Loss | -15% | Original -30% is too wide |
| ADX Filter | Optional Addition | Only 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 Pairs | Minimum Memory | Recommended Memory |
|---|---|---|
| 1-10 pairs | 512MB | 1GB |
| 10-50 pairs | 1GB | 2GB |
| 50+ pairs | 2GB | 4GB |
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:
- Open 5-minute candlestick chart
- Add MACD indicator (default parameters 12, 26, 9)
- Buy when MACD > 0 and MACD > Signal
- Sell when MACD < Signal
XI. Conclusion
ASDTSRockwellTrading is a classic MACD trend-following strategy. Its core value lies in:
- Classic Logic: Based on the mature MACD indicator
- Clear Signals: Buy/sell conditions are unambiguous
- Simple Code: Easy to understand and modify
- 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