RobotradingBody Strategy In-Depth Analysis
Strategy Number: #350 (350th of 465 strategies)
Strategy Type: Candlestick Body Reversal Strategy + Parameter Optimization
Timeframe: 4 hours (4h)
1. Strategy Overview
RobotradingBody is a reversal trading strategy based on candlestick body size. Its core philosophy is: buy when an abnormally large bearish candle appears (considered oversold), sell when a bullish candle appears (considered rebound complete). The strategy design is concise and clear, with less than 100 lines of code — a typical "small but beautiful" strategy.
This strategy originates from a public script on TradingView, ported to the Freqtrade framework by viksal1982.
Core Features
| Feature | Description |
|---|---|
| Buy Conditions | 1 independent buy signal (large bearish candle reversal) |
| Sell Conditions | 1 basic sell signal (bullish candle appears) |
| Protection Mechanisms | Fixed stop-loss + ultra-high ROI target |
| Timeframe | 4 hours (4h) |
| Dependencies | talib, qtpylib |
| Optimizable Parameters | 2 (body multiplier, SMA period) |
2. Strategy Configuration Analysis
2.1 Basic Risk Parameters
# ROI Exit Table
minimal_roi = {
"0": 0.9 # 90% profit target
}
# Stop-loss setting
stoploss = -0.10 # 10% stop-loss
Design Rationale:
- Ultra-high ROI target: A 90% profit target is very aggressive, meaning the strategy tends to hold long-term waiting for significant profits
- Moderate stop-loss: 10% stop-loss gives the strategy enough volatility room, avoiding premature stop-outs
- No trailing stop:
trailing_stop = False, the strategy uses fixed take-profit/stop-loss logic
2.2 Order Type Configuration
order_types = {
'buy': 'limit',
'sell': 'limit',
'stoploss': 'market',
'stoploss_on_exchange': False
}
order_time_in_force = {
'buy': 'gtc',
'sell': 'gtc'
}
Configuration Explanation:
- Both buy and sell use limit orders, ensuring controllable execution prices
- Stop-loss uses market orders, ensuring fast execution
- Order validity GTC (Good Till Cancel), valid until filled or cancelled
3. Buy Conditions Explained
3.1 Buy Logic
The strategy has only one buy condition, but the core judgment criteria are relatively refined:
# Buy condition
(
(dataframe['open'] > dataframe['close']) & # Condition 1: Bearish candle
(dataframe['body'] > dataframe['body_sma']) & # Condition 2: Large body
(dataframe['volume'] > 0) # Condition 3: Has volume
)
Condition Analysis:
| Condition | Logic | Meaning |
|---|---|---|
| Condition 1 | open > close | Current candle is bearish (declining) |
| Condition 2 | body > body_sma | Body larger than historical mean × multiplier |
| Condition 3 | volume > 0 | Has volume (prevents abnormal data) |
3.2 Body Size Judgment Mechanism
The strategy uses a dynamic benchmark to judge "large body":
# Calculate body size
dataframe['body'] = (dataframe['close'] - dataframe['open']).abs()
# Calculate body SMA × multiplier
dataframe['body_sma'] = ta.SMA(dataframe['body'], timeperiod=for_sma_length) * for_mult
Judgment Logic:
- Calculate the absolute body value of each candle
- Calculate the SMA mean of body sizes
- Multiply the SMA by an adjustable multiplier
- When body > adjusted SMA, consider it a "large body"
3.3 Optimizable Parameters
| Parameter | Range | Default Value | Description |
|---|---|---|---|
for_mult | 1-20 | 3 | Amplification multiplier for body judgment |
for_sma_length | 20-200 | 100 | SMA calculation period |
Parameter Interpretation:
- Larger multiplier: Stricter buy conditions, only captures extreme large bearish candles
- Longer period: More stable benchmark, but slower reaction to recent market changes
4. Sell Logic Explained
4.1 Sell Conditions
The strategy's sell conditions are equally concise:
# Sell condition
(
(dataframe['close'] > dataframe['open']) & # Condition 1: Bullish candle
(dataframe['volume'] > 0) # Condition 2: Has volume
)
Condition Analysis:
| Condition | Logic | Meaning |
|---|---|---|
| Condition 1 | close > open | Current candle is bullish (rising) |
| Condition 2 | volume > 0 | Has volume (prevents abnormal data) |
4.2 Sell Logic Analysis
Core Idea:
- Buy timing: Large bearish candle (oversold signal)
- Sell timing: Bullish candle (rebound signal)
- Strategy essence is a simplified version of "bottom fishing and top escaping"
Note:
- Sell condition doesn't require a large bullish candle — any bullish candle triggers
- This means the strategy may sell early during the initial rebound, missing larger gains
4.3 Take-Profit and Stop-Loss Mechanism
Exit Mechanism Trigger Condition
────────────────────────────────────────
ROI Take-Profit Profit ≥ 90%
Stop-Loss Exit Loss ≥ 10%
Signal Sell Bullish candle appears
5. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicator | Purpose |
|---|---|---|
| Candlestick Pattern | Open Price, Close Price | Judge bullish/bearish candles |
| Body Indicator | Body (absolute value) | Measure candlestick body size |
| Trend Indicator | SMA (body) | Dynamic benchmark judgment |
| Volume | Volume | Filter abnormal data |
5.2 Indicator Calculation
# Body size (absolute value)
dataframe['body'] = (dataframe['close'] - dataframe['open']).abs()
# Body SMA × multiplier
dataframe['body_sma'] = ta.SMA(dataframe['body'], timeperiod=for_sma_length) * for_mult
Design Features:
- Uses only the most basic candlestick data
- No reliance on complex technical indicators (such as RSI, MACD, Bollinger Bands, etc.)
- Code is concise, easy to understand and verify
6. Risk Management Features
6.1 Fixed Stop-Loss Mechanism
The strategy uses a fixed 10% stop-loss:
stoploss = -0.10 # 10% stop-loss
Characteristics:
- Simple and direct, no dynamic calculation needed
- Gives the strategy enough volatility room
- Avoids premature stop-outs due to normal fluctuations
6.2 Ultra-High ROI Target
minimal_roi = {"0": 0.9} # 90% target
Design Intent:
- Strategy pursues significant profits, not satisfied with small gains
- Combined with signal selling, actual exit may occur much earlier than 90%
- ROI is more of an "insurance" than a "target"
6.3 Risk Exposure
| Risk Point | Description |
|---|---|
| Trend Risk | Strategy has no trend filtering, may repeatedly bottom-fish during downtrends |
| False Breakouts | Bullish candle sell may be too early, missing larger gains |
| Parameter Sensitivity | Body multiplier and SMA period have significant impact on results |
7. Strategy Advantages and Limitations
✅ Advantages
- Extremely Simple Code: Less than 100 lines, easy to understand and verify
- Clear Logic: Buy on large bearish candles, sell on bullish candles — straightforward reversal logic
- Optimizable Parameters: 2 parameters can be optimized through hyperparameter optimization to find optimal configuration
- Efficient Calculation: No complex indicator calculations, fast execution
⚠️ Limitations
- Single Signal Source: Relies only on candlestick patterns, lacks multiple confirmations
- No Trend Judgment: May trade against the trend, frequently stop out in downtrends
- Loose Sell Conditions: Any bullish candle triggers sell, may exit too early
- Wide Stop-Loss: 10% stop-loss may be too large for high-frequency strategies
8. Applicable Scenario Recommendations
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| Ranging Market | Default Parameters | Frequent rebounds in ranging markets, suitable for bottom-fishing strategies |
| Downtrend | Use Cautiously | May repeatedly fail to bottom-fish, recommend reducing position size |
| Uptrend | Not Recommended | Strategy designed for bottom-fishing, no use in uptrends |
| High Volatility Market | Increase Multiplier | Raise buy threshold, filter false signals |
9. Suitable Market Environment Explained
RobotradingBody is a typical reversal bottom-fishing strategy. Based on its code architecture, it is most suitable for high-volatility ranging markets and performs poorly in one-way downtrends.
9.1 Strategy Core Logic
- Bottom-Fishing Mindset: Buy during extreme declines, expect rebound
- Quick Take-Profit: Sell on any bullish candle, not greedy
- Dynamic Benchmark: Body size compared to historical mean, adapts to different instruments
9.2 Performance in Different Market Environments
| Market Type | Performance Rating | Reason Analysis |
|---|---|---|
| 📈 One-Way Uptrend | ⭐⭐☆☆☆ | Strategy looks for decline opportunities, few entry points in uptrends |
| 🔄 High-Volatility Ranging | ⭐⭐⭐⭐⭐ | Frequent rebounds after large bearish candles, perfectly matches strategy logic |
| 📉 One-Way Downtrend | ⭐☆☆☆☆ | High bottom-fishing failure rate, may have consecutive stop-outs |
| ⚡️ Low-Volatility Sideways | ⭐⭐☆☆☆ | Bodies too small, difficult to satisfy buy conditions |
9.3 Key Configuration Recommendations
| Configuration Item | Recommended Value | Description |
|---|---|---|
for_mult | 2-4 | Balance signal quantity and quality |
for_sma_length | 50-150 | Medium period, balances stability and flexibility |
| Stop-Loss | -0.08 to -0.12 | Adjust based on instrument volatility |
| Timeframe | 4h-1d | Original design timeframe, not recommended to reduce |
10. Important Reminder: The Cost of Complexity
10.1 Learning Curve
This strategy has an extremely low learning curve:
- Only about 80 lines of code
- No complex indicators
- Intuitive and easy to understand logic
10.2 Hardware Requirements
| Number of Trading Pairs | Minimum RAM | Recommended RAM |
|---|---|---|
| 1-20 pairs | 512MB | 1GB |
| 20-50 pairs | 1GB | 2GB |
| 50+ pairs | 2GB | 4GB |
Strategy calculation volume is extremely small, hardware requirements are very low.
10.3 Backtesting vs Live Trading Differences
Need to Note:
- Backtesting may show high win rates, but slippage and fees in live trading will erode profits
- 90% ROI target may trigger rarely in backtesting, mainly relies on signal selling
- Candle close confirmation has delays in live trading
10.4 Manual Trader Recommendations
If you want to use this strategy's logic for manual trading:
- Wait for a large bearish candle on 4-hour or daily chart
- Confirm body is significantly larger than recent average body
- Buy and wait for bullish candle to appear
- Set 10% stop-loss for protection
11. Summary
RobotradingBody is an extremely simple reversal bottom-fishing strategy. Its core value lies in:
- Simple Code: Clear logic, easy to understand and modify
- Adjustable Parameters: Two optimizable parameters, adapts to different instruments
- Efficient Calculation: No complex indicators, fast execution
For quantitative traders, this is a suitable introductory strategy for learning, and also suitable as a foundational framework for more complex strategies. However, note that the strategy lacks trend filtering and multi-factor confirmation, and may perform poorly in one-way downtrend markets.
It is recommended to verify through backtesting, then combine with other indicators (such as trend filters, volatility indicators) for improvement, or use it as part of a portfolio strategy.