Skip to main content

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

AttributeDescription
Entry Conditions2 sets of linear trend-based buy signals
Exit Conditions1 set of base exit signals + take-profit and stop-loss
Protections1 set of entry protection parameters
Timeframe15-minute primary timeframe
Dependenciesscipy, 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 CategorySpecific IndicatorPurpose
Trend IndicatorLinear Regression SlopeTrend direction
Strength IndicatorR² ValueTrend strength (goodness of fit)
Confirmation IndicatorSlope ChangeReversal 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

  1. Objective and Quantitative: Based on statistical methods, no subjective judgment
  2. Clear Trends: Linear trends are clearly visible
  3. Simple and Direct: Clear logic, few parameters
  4. High Adaptability: Adjustable windows to suit different markets

⚠️ Limitations

  1. Inherent Lag: Linear regression is based on historical data
  2. False Signals: More false signals in ranging markets
  3. Parameter Sensitivity: Window size affects signals
  4. Nonlinear Markets: Not suitable for nonlinear price movements

VIII. Applicable Scenarios Recommendations

Market EnvironmentRecommended ConfigurationNotes
Clear TrendsWindow 30Most effective when trends are clear
Ranging MarketsStand byToo many false signals
Rapid ChangesReduce windowImprove 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 TypePerformance RatingAnalysis
📈 Uptrend⭐⭐⭐⭐⭐Perfect following
📉 Downtrend⭐⭐⭐⭐⭐Equally effective
🔄 Ranging Market⭐⭐☆☆☆Too many false signals
⚡ Fast Moves⭐⭐⭐⭐☆Trends are clear

9.2 Key Configuration Recommendations

Configuration ItemRecommended ValueNotes
lr_window30Regression window
lr_slope_threshold0.01Slope threshold
lr_r2_threshold0.6Trend 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 PairsMinimum RAMRecommended RAM
5-101GB2GB
20-302GB3GB

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:

  1. Objective and Quantitative: Based on statistical methods
  2. Clear Trends: Linear trends are clearly visible
  3. Simple and Direct: Few parameters, clear logic
  4. 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.