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
| Feature | Description |
|---|---|
| Entry Condition | Price breaks above linear regression upper band + volume confirmation |
| Exit Condition | Price falls below linear regression lower band |
| Protection | Trailing stop |
| Timeframe | 15 Minutes |
| Dependencies | TA-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
| Indicator | Description |
|---|---|
| Linear Regression | Linear regression trend line |
| Standard Deviation | Standard deviation (volatility) |
| Volume MA | Volume moving average |
VI. Risk Management
| Parameter | Value |
|---|---|
| Hard Stop | -10% |
| Take-Profit | 5%-1% declining |
VII. Strategy Pros & Cons
✅ Pros
- Clear Trend: Linear regression provides unambiguous trend direction
- Breakout Signals: Upper band breakout gives clear entry points
- Simple & Intuitive: Easy to understand and implement
⚠️ Cons
- Parameter Sensitive: Period and standard deviation multiplier have significant impact
- Average Ranging Performance
- Dependent on Historical Data
VIII. Applicable Scenarios
| Market Environment | Performance |
|---|---|
| Trending Up | ⭐⭐⭐⭐ |
| Trending Down | ⭐⭐⭐⭐ |
| Ranging | ⭐⭐ |
IX. Parameter Optimization
| Parameter | Default | Description |
|---|---|---|
| Regression Period | 20 | Longer = more stable |
| Std Dev Multiplier | 2 | Larger = 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.