Ltend Strategy: In-Depth Analysis
Strategy Number: #229 (the 229th of 465 strategies)
Strategy Type: Trend Following / Linear Trend
Timeframe: 15 Minutes (15m)
I. Strategy Overview
Ltend is a trading strategy based on linear trend analysis. This strategy calculates price trends using linear regression and generates trading signals when linear trends change direction. The strategy uses statistical methods to objectively identify trends, avoiding subjective judgment.
The name "Ltend" stands for Linear Trend, indicating that this strategy focuses on identifying and following linear price trends.
Core Characteristics
| Attribute | Description |
|---|---|
| Entry Conditions | 2 sets of linear trend-based buy signals |
| Exit Conditions | 1 set of base exit signals + take-profit and stop-loss |
| Protections | 1 set of entry protection parameters |
| Timeframe | 15-minute primary timeframe |
| Dependencies | scipy, pandas, numpy |
II. Strategy Configuration Analysis
2.1 Base Risk Parameters
# ROI Exit Table
minimal_roi = {
"0": 0.08,
"25": 0.05,
"50": 0.025,
"100": 0
}
# Stop Loss Settings
stoploss = -0.10
# Trailing Stop
trailing_stop = True
trailing_stop_positive = 0.025
trailing_stop_positive_offset = 0.03
Design Philosophy:
- Moderate Take-Profit: 8% initial target, moderate for trend-following strategy
- Standard Stop Loss: -10% stop loss magnitude
- Trailing Stop: Enabled to lock in profits
2.2 Linear Regression Parameters
# Linear Regression Parameters
lr_window = 30 # Regression window size
lr_slope_threshold = 0.01 # Slope threshold
lr_r2_threshold = 0.6 # R² threshold (trend strength)
III. Entry Conditions Details
3.1 Linear Trend Analysis Principle
The strategy uses linear regression to calculate price trends:
from scipy.stats import linregress
# Linear Regression Calculation
x = np.arange(lr_window)
y = close[-lr_window:]
slope, intercept, r_value, p_value, std_err = linregress(x, y)
# Slope: Trend direction
# R²: Trend strength (goodness of fit)
3.2 Entry Conditions Details
Condition #1: Linear Trend Turns Positive
Logic:
- Calculate linear regression slope over the most recent N periods
- Slope transitions from negative to positive (trend shifts from down to up)
- R² value reaches threshold (trend strength is sufficient)
# Logic Judgment
slope_positive = slope > lr_slope_threshold
slope_turning = slope > slope.shift(1) # Slope is upward
trend_strength = r_value**2 > lr_r2_threshold
entry_signal = slope_positive and slope_turning and trend_strength
Condition #2: Trend Strength Breakout
Logic:
- Trend strength (R²) breaks through threshold
- Price breaks through along the trend direction
- Slope absolute value is sufficiently large
# Logic Judgment
strong_trend = r_value**2 > 0.7
price_breakout = close > high[-10:].max()
slope_significant = abs(slope) > lr_slope_threshold * 2
entry_signal = strong_trend and price_breakout and slope_significant
IV. Exit Logic Details
4.1 Multi-Layer Take-Profit System
Take-Profit Point 8% Hold 0-25 minutes
Take-Profit Point 5% Hold 25-50 minutes
Take-Profit Point 2.5% Hold 50-100 minutes
Stop-Loss Point -10% Any time
4.2 Trailing Stop
When profit exceeds 2.5%, a trailing stop automatically activates, locking in at least 3% profit.
4.3 Trend Reversal Exit
If the linear regression slope reverses direction, an early exit may be triggered.
V. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicator | Purpose |
|---|---|---|
| Trend Indicator | Linear Regression Slope | Trend direction |
| Strength Indicator | R² Value | Trend strength (goodness of fit) |
| Confirmation Indicator | Slope Change | Reversal signal |
5.2 Linear Regression Analysis Principle
# Linear Regression Interpretation
# Slope > 0: Uptrend
# Slope < 0: Downtrend
# Larger absolute slope value: Stronger trend
# R² Value Interpretation
# R² close to 1: Price perfectly fits a straight line, trend is clear
# R² close to 0: Price is scattered, no clear trend
# Strategy Logic
# 1. Find trends with high R² (price moves along a straight line)
# 2. Wait for slope to turn positive (trend turns bullish)
# 3. Enter with the trend
VI. Risk Management Highlights
6.1 Trend Strength Filtering
Use R² value to filter weak trends, only trading when trends are clear.
6.2 Slope Threshold
Set slope threshold to filter small fluctuations.
6.3 Trailing Stop
Trend-following strategies use trailing stops to let profits run.
VII. Strategy Strengths and Limitations
✅ Strengths
- Objective and Quantitative: Based on statistical methods, no subjective judgment
- Clear Trends: Linear trends are clearly visible
- Simple and Direct: Clear logic, few parameters
- High Adaptability: Adjustable windows to suit different markets
⚠️ Limitations
- Inherent Lag: Linear regression is based on historical data
- False Signals: More false signals in ranging markets
- Parameter Sensitivity: Window size affects signals
- Nonlinear Markets: Not suitable for nonlinear price movements
VIII. Applicable Scenarios Recommendations
| Market Environment | Recommended Configuration | Notes |
|---|---|---|
| Clear Trends | Window 30 | Most effective when trends are clear |
| Ranging Markets | Stand by | Too many false signals |
| Rapid Changes | Reduce window | Improve response speed |
IX. Applicable Market Environment Details
Ltend is a linear regression-based trend-following strategy. Code volume is approximately 180 lines, focused on objectively identifying trend direction.
Its Money-Making Philosophy: Find trends using mathematical methods, then follow them
- Linear Regression: Find the best fit line
- Slope Direction: Determine trend direction
- R² Strength: Confirm trend reliability
9.1 Performance in Different Market Environments
| Market Type | Performance Rating | Analysis |
|---|---|---|
| 📈 Uptrend | ⭐⭐⭐⭐⭐ | Perfect following |
| 📉 Downtrend | ⭐⭐⭐⭐⭐ | Equally effective |
| 🔄 Ranging Market | ⭐⭐☆☆☆ | Too many false signals |
| ⚡ Fast Moves | ⭐⭐⭐⭐☆ | Trends are clear |
9.2 Key Configuration Recommendations
| Configuration Item | Recommended Value | Notes |
|---|---|---|
| lr_window | 30 | Regression window |
| lr_slope_threshold | 0.01 | Slope threshold |
| lr_r2_threshold | 0.6 | Trend strength threshold |
X. Important Notes: The Cost of Complexity
10.1 Learning Curve
Understanding linear regression and statistical concepts is required. Learning related knowledge first is recommended.
10.2 Hardware Requirements
| Number of Trading Pairs | Minimum RAM | Recommended RAM |
|---|---|---|
| 5-10 | 1GB | 2GB |
| 20-30 | 2GB | 3GB |
10.3 Backtesting vs Live Trading Differences
Linear regression strategies may be over-fitted in backtesting. Parameter robustness needs verification.
10.4 Manual Trading Recommendations
TradingView's linear regression channel indicator can be used to observe slope and price position. Enter when trends are clear!
XI. Summary
Ltend is a linear trend-following strategy. Its core value lies in:
- Objective and Quantitative: Based on statistical methods
- Clear Trends: Linear trends are clearly visible
- Simple and Direct: Few parameters, clear logic
- High Adaptability: Adjustable parameters to suit markets
For quantitative traders, this strategy is suitable for investors who prefer objective indicators and pursue simple logic. It is recommended to use with other indicators to filter ranging markets.