Strategy001 In-Depth Analysis
Strategy Number: #391 (391st of 465 strategies)
Strategy Type: EMA Crossover + Heikin Ashi Trend Following
Timeframe: 5 minutes (5m)
I. Strategy Overview
Strategy001 is a classic trend-following strategy based on EMA crossovers and Heikin Ashi candlesticks. As an entry-level strategy from the official Freqtrade strategy library, it demonstrates how to implement a complete trading system with concise code, making it an excellent example for beginners learning Freqtrade strategy development.
Core Features
| Feature | Description |
|---|---|
| Entry Condition | 1 buy signal (EMA20/50 golden cross + HA trend confirmation) |
| Exit Condition | 1 sell signal (EMA50/100 golden cross + HA trend confirmation) |
| Protection Mechanism | Trailing stop (activated at 1% profit) |
| Timeframe | 5-minute main timeframe |
| Dependencies | talib, qtpylib |
II. Strategy Configuration Analysis
2.1 Basic Risk Parameters
# ROI exit table
minimal_roi = {
"60": 0.01, # After 60 minutes, exit at 1% profit
"30": 0.03, # After 30 minutes, exit at 3% profit
"20": 0.04, # After 20 minutes, exit at 4% profit
"0": 0.05 # Immediately, exit at 5% profit
}
# Stop loss setting
stoploss = -0.10 # Fixed stop loss at -10%
# Trailing stop
trailing_stop = True
trailing_stop_positive = 0.01 # Activate after 1% profit
trailing_stop_positive_offset = 0.02 # Offset at 2%
Design Rationale:
- The ROI table uses a reverse-order design: the longer the holding period, the lower the target profit, reflecting the philosophy of "quick profit-taking, preserve gains"
- The 10% fixed stop loss is relatively loose, giving the trend enough room for pullbacks
- Trailing stop activates after 2% profit, triggering on 1% pullback, balancing profit protection and trend following
2.2 Order Type Configuration
order_types = {
'buy': 'limit', # Use limit orders for buying
'sell': 'limit', # Use limit orders for selling
'stoploss': 'market', # Use market orders for stop loss
'stoploss_on_exchange': False
}
Design Rationale:
- Use limit orders for entries and exits to reduce slippage costs
- Use market orders for stop loss to ensure execution in emergency situations
- Stop loss not set on exchange, managed locally by Freqtrade
III. Entry Conditions Detailed
3.1 Technical Indicators
The strategy uses the following technical indicators for entry decisions:
| Indicator Category | Specific Indicators | Purpose |
|---|---|---|
| Trend Indicators | EMA20, EMA50, EMA100 | Determine trend direction and strength |
| Candlestick | Heikin Ashi open, close | Filter noise, confirm trend |
3.2 Entry Condition Logic
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
qtpylib.crossed_above(dataframe['ema20'], dataframe['ema50']) &
(dataframe['ha_close'] > dataframe['ema20']) &
(dataframe['ha_open'] < dataframe['ha_close']) # green bar
),
'buy'] = 1
return dataframe
Entry Signal Trigger Conditions (all three must be satisfied):
| Condition # | Description | Technical Meaning |
|---|---|---|
| Condition 1 | EMA20 crosses above EMA50 | Short-term moving average golden cross, trend strengthening signal |
| Condition 2 | HA close > EMA20 | Price above short-term MA, confirms uptrend |
| Condition 3 | HA open < HA close | Heikin Ashi green candle, trend confirmation |
Design Features:
- EMA golden cross provides trend reversal signal
- Heikin Ashi candlesticks filter market noise, avoiding false breakouts
- Triple confirmation mechanism reduces misjudgment probability
IV. Exit Logic Detailed
4.1 Exit Signal
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
qtpylib.crossed_above(dataframe['ema50'], dataframe['ema100']) &
(dataframe['ha_close'] < dataframe['ema20']) &
(dataframe['ha_open'] > dataframe['ha_close']) # red bar
),
'sell'] = 1
return dataframe
Exit Signal Trigger Conditions (all three must be satisfied):
| Condition # | Description | Technical Meaning |
|---|---|---|
| Condition 1 | EMA50 crosses above EMA100 | Medium-term trend reversal, possibly continuation |
| Condition 2 | HA close < EMA20 | Price below short-term MA, trend weakening |
| Condition 3 | HA open > HA close | Heikin Ashi red candle, downtrend confirmation |
Note: EMA50 crossing above EMA100 is typically viewed as a bullish continuation signal in trend-following strategies, but combined with price below EMA20 and red HA candle, forms a trend reversal filter condition.
4.2 Multiple Exit Mechanisms
The strategy provides multiple layers of exit protection:
| Exit Mechanism | Trigger Condition | Priority |
|---|---|---|
| ROI Exit | Time-profit target reached | High |
| Trailing Stop | 1% pullback after profit | Medium |
| Fixed Stop Loss | Loss reaches 10% | High |
| Signal Exit | Exit condition satisfied | Low |
4.3 Exit Configuration
use_sell_signal = True # Enable signal exit
sell_profit_only = True # Only respond to sell signal when profitable
ignore_roi_if_buy_signal = False # ROI doesn't override buy signal
V. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicator | Purpose |
|---|---|---|
| Moving Average | EMA20 | Short-term trend, dynamic support/resistance |
| Moving Average | EMA50 | Medium-term trend, golden/death cross signals |
| Moving Average | EMA100 | Long-term trend, filter oscillations |
| Candlestick | Heikin Ashi | Filter noise, confirm trend direction |
5.2 Heikin Ashi Candlesticks
Heikin Ashi (average bar) is a special candlestick calculation method:
HA Close = (Open + High + Low + Close) / 4
HA Open = (Previous HA Open + Previous HA Close) / 2
Advantages:
- Smooths price fluctuations, reduces false signals
- Consecutive same-colored candles during trends, easy to identify
- Suitable for trend-following strategies
VI. Risk Management Features
6.1 Trailing Stop Mechanism
trailing_stop = True
trailing_stop_positive = 0.01 # Activate after 1% profit
trailing_stop_positive_offset = 0.02 # Start trailing after 2% price increase
How It Works:
- When profit reaches 2%, trailing stop activates
- Stop loss line follows price increases upward
- When price pulls back more than 1% from high, triggers stop loss exit
Example:
- Entry price: 100 USDT
- Price rises to 102 USDT (2% profit): Trailing stop activates
- Price rises to 105 USDT: Stop loss line follows to 103.95 USDT
- Price falls back to 103.95 USDT: Trailing stop triggers exit
6.2 ROI Time Decay
| Holding Time | Target Profit | Design Intent |
|---|---|---|
| 0 minutes | 5% | Quick explosive moves |
| 20 minutes | 4% | Short-term trend |
| 30 minutes | 3% | Medium-short term trend |
| 60 minutes | 1% | Time for space, lower expectations |
6.3 Risk Parameter Summary
| Parameter | Value | Description |
|---|---|---|
| Fixed Stop Loss | -10% | Maximum single trade loss |
| Trailing Stop Activation | +2% | Profit threshold to start trailing |
| Trailing Stop Distance | 1% | Pullback trigger value |
| Maximum Target Profit | 5% | Immediate take-profit target |
VII. Strategy Advantages and Limitations
✅ Advantages
- Simple and Easy to Understand: Less than 100 lines of code, clear logic, best introductory example for learning Freqtrade strategy development
- Multiple Confirmations: EMA crossover + HA candlestick dual filtering, reduces false signals
- Controllable Risk: Trailing stop + fixed stop loss dual protection, preserves profits
⚠️ Limitations
- Trend Dependent: May experience frequent stop losses in oscillating markets
- Signal Lag: EMA is a lagging indicator, entry timing may be delayed
- Fixed Parameters: No hyperparameter optimization interface, requires manual adjustment
VIII. Applicable Scenarios Recommendations
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| Clear Trend Market | Default configuration | Strategy's optimal scenario |
| Oscillating Market | Reduce position or pause | May experience frequent stop losses |
| High Volatility | Appropriately loosen stop loss | Avoid being shaken out |
IX. Applicable Market Environment Detailed
Strategy001 is an entry-level trend-following strategy. Based on its code architecture and long-term community live trading experience, it performs best in clear trend markets, while performing poorly in oscillating markets.
9.1 Strategy Core Logic
- Trend Identification: EMA golden cross to identify trend initiation
- Trend Confirmation: Heikin Ashi candlesticks to filter noise
- Trend Following: Trailing stop mechanism to lock in profits
9.2 Performance in Different Market Environments
| Market Type | Performance Rating | Reason Analysis |
|---|---|---|
| 📈 Uptrend | ⭐⭐⭐⭐⭐ | EMA golden cross + HA green bars work perfectly together |
| 🔄 Oscillating Market | ⭐⭐☆☆☆ | Frequent golden/death crosses, frequent stop losses |
| 📉 Downtrend | ⭐☆☆☆☆ | Counter-trend longs, very few signals |
| ⚡ High Volatility | ⭐⭐⭐☆☆ | Easy to be shaken out, but trailing stop provides protection |
9.3 Key Configuration Recommendations
| Configuration Item | Recommended Value | Description |
|---|---|---|
| Trading Pairs | Major coins | Good liquidity reduces slippage |
| Timeframe | 5m-15m | Adjustable based on market |
| Stop Loss | -5% ~ -10% | Adjust based on volatility |
X. Important Note: The Cost of Complexity
10.1 Learning Cost
Strategy001 has concise code and is Freqtrade's officially recommended learning example. Beginners can understand the core logic within 1-2 hours.
10.2 Hardware Requirements
| Number of Trading Pairs | Minimum Memory | Recommended Memory |
|---|---|---|
| 1-5 pairs | 2GB | 4GB |
| 5-20 pairs | 4GB | 8GB |
| 20+ pairs | 8GB | 16GB |
10.3 Difference Between Backtesting and Live Trading
As a simple strategy, Strategy001 has relatively small performance differences between backtesting and live trading. However, note that:
- Backtesting cannot simulate slippage
- Limit orders may not execute in live trading
- Market condition changes affect strategy performance
10.4 Recommendations for Manual Traders
If using this strategy's logic manually:
- Wait for EMA20 to cross above EMA50
- Switch to Heikin Ashi chart to confirm green candle
- Price needs to be above EMA20
- Set trailing stop to protect profits
XI. Summary
Strategy001 is a simple and practical entry-level trend-following strategy. Its core value lies in:
- Educational Value: Clear code structure, best starting point for learning Freqtrade strategy development
- Trend Following: EMA crossover + HA confirmation dual filtering, effectively identifies trend initiation
- Controllable Risk: Trailing stop mechanism automatically protects profits
For quantitative trading beginners, Strategy001 is an excellent choice for understanding the strategy development process and becoming familiar with the Freqtrade framework. For experienced traders, more filtering conditions and optimized parameters can be added on this foundation.