Skip to main content

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

FeatureDescription
Entry Condition1 buy signal (EMA20/50 golden cross + HA trend confirmation)
Exit Condition1 sell signal (EMA50/100 golden cross + HA trend confirmation)
Protection MechanismTrailing stop (activated at 1% profit)
Timeframe5-minute main timeframe
Dependenciestalib, 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 CategorySpecific IndicatorsPurpose
Trend IndicatorsEMA20, EMA50, EMA100Determine trend direction and strength
CandlestickHeikin Ashi open, closeFilter 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 #DescriptionTechnical Meaning
Condition 1EMA20 crosses above EMA50Short-term moving average golden cross, trend strengthening signal
Condition 2HA close > EMA20Price above short-term MA, confirms uptrend
Condition 3HA open < HA closeHeikin 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 #DescriptionTechnical Meaning
Condition 1EMA50 crosses above EMA100Medium-term trend reversal, possibly continuation
Condition 2HA close < EMA20Price below short-term MA, trend weakening
Condition 3HA open > HA closeHeikin 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 MechanismTrigger ConditionPriority
ROI ExitTime-profit target reachedHigh
Trailing Stop1% pullback after profitMedium
Fixed Stop LossLoss reaches 10%High
Signal ExitExit condition satisfiedLow

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 CategorySpecific IndicatorPurpose
Moving AverageEMA20Short-term trend, dynamic support/resistance
Moving AverageEMA50Medium-term trend, golden/death cross signals
Moving AverageEMA100Long-term trend, filter oscillations
CandlestickHeikin AshiFilter 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:

  1. When profit reaches 2%, trailing stop activates
  2. Stop loss line follows price increases upward
  3. 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 TimeTarget ProfitDesign Intent
0 minutes5%Quick explosive moves
20 minutes4%Short-term trend
30 minutes3%Medium-short term trend
60 minutes1%Time for space, lower expectations

6.3 Risk Parameter Summary

ParameterValueDescription
Fixed Stop Loss-10%Maximum single trade loss
Trailing Stop Activation+2%Profit threshold to start trailing
Trailing Stop Distance1%Pullback trigger value
Maximum Target Profit5%Immediate take-profit target

VII. Strategy Advantages and Limitations

✅ Advantages

  1. Simple and Easy to Understand: Less than 100 lines of code, clear logic, best introductory example for learning Freqtrade strategy development
  2. Multiple Confirmations: EMA crossover + HA candlestick dual filtering, reduces false signals
  3. Controllable Risk: Trailing stop + fixed stop loss dual protection, preserves profits

⚠️ Limitations

  1. Trend Dependent: May experience frequent stop losses in oscillating markets
  2. Signal Lag: EMA is a lagging indicator, entry timing may be delayed
  3. Fixed Parameters: No hyperparameter optimization interface, requires manual adjustment

VIII. Applicable Scenarios Recommendations

Market EnvironmentRecommended ConfigurationDescription
Clear Trend MarketDefault configurationStrategy's optimal scenario
Oscillating MarketReduce position or pauseMay experience frequent stop losses
High VolatilityAppropriately loosen stop lossAvoid 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 TypePerformance RatingReason 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 ItemRecommended ValueDescription
Trading PairsMajor coinsGood liquidity reduces slippage
Timeframe5m-15mAdjustable 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 PairsMinimum MemoryRecommended Memory
1-5 pairs2GB4GB
5-20 pairs4GB8GB
20+ pairs8GB16GB

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:

  1. Wait for EMA20 to cross above EMA50
  2. Switch to Heikin Ashi chart to confirm green candle
  3. Price needs to be above EMA20
  4. Set trailing stop to protect profits

XI. Summary

Strategy001 is a simple and practical entry-level trend-following strategy. Its core value lies in:

  1. Educational Value: Clear code structure, best starting point for learning Freqtrade strategy development
  2. Trend Following: EMA crossover + HA confirmation dual filtering, effectively identifies trend initiation
  3. 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.