Skip to main content

LinReg Strategy Analysis

Strategy Number: #186 (186th of 465 strategies)
Strategy Type: Trend Following / Linear Regression
Timeframe: 15 Minutes (15m)


I. Strategy Overview

LinReg (Linear Regression) is a quantitative trading strategy based on linear regression analysis. Linear regression is a statistical method used to find the best-fit line for price movements, thereby judging trend direction and strength.

Core Features

FeatureDescription
Entry ConditionPrice breaks above linear regression upper band + volume confirmation
Exit ConditionPrice falls below linear regression lower band
ProtectionTrailing stop
Timeframe15 Minutes
DependenciesTA-Lib, numpy

II. Strategy Configuration Analysis

2.1 Basic Risk Parameters

minimal_roi = {
"0": 0.05,
"30": 0.02,
"60": 0.01
}

stoploss = -0.10 # -10%

2.2 Parameter Settings

timeframe = '15m'
linreg_period = 20 # Linear regression period
std_dev_multiplier = 2 # Standard deviation multiplier

III. Entry Conditions Details

3.1 Linear Regression Calculation

# Calculate linear regression line
linreg = np.polyfit(range(period), close, 1)
slope = linreg[0]
intercept = linreg[1]

# Calculate upper and lower bands
upper_band = intercept + slope * np.arange(period) + std_dev_multiplier * std
lower_band = intercept + slope * np.arange(period) - std_dev_multiplier * std

3.2 Entry Signal

# Price breaks above upper band and in an uptrend
Conditions:
- slope > 0 (uptrend)
- price > upper_band (upper band breakout)
- volume > volume_ma (volume expansion)

IV. Exit Conditions Details

4.1 Exit Conditions

# Price falls below lower band
Conditions:
- price < lower_band
- OR slope < 0 (trend reversal)

V. Technical Indicator System

IndicatorDescription
Linear RegressionLinear regression trend line
Standard DeviationStandard deviation (volatility)
Volume MAVolume moving average

VI. Risk Management

ParameterValue
Hard Stop-10%
Take-Profit5%-1% declining

VII. Strategy Pros & Cons

✅ Pros

  1. Clear Trend: Linear regression provides unambiguous trend direction
  2. Breakout Signals: Upper band breakout gives clear entry points
  3. Simple & Intuitive: Easy to understand and implement

⚠️ Cons

  1. Parameter Sensitive: Period and standard deviation multiplier have significant impact
  2. Average Ranging Performance
  3. Dependent on Historical Data

VIII. Applicable Scenarios

Market EnvironmentPerformance
Trending Up⭐⭐⭐⭐
Trending Down⭐⭐⭐⭐
Ranging⭐⭐

IX. Parameter Optimization

ParameterDefaultDescription
Regression Period20Longer = more stable
Std Dev Multiplier2Larger = more lenient

Timeframe

Recommended 15 minutes or 1 hour.


X. Summary

LinReg is a statistics-based trend strategy that uses linear regression to determine trend direction and price boundaries. Best used in markets with clear trends.