---
title: linear_regression_channel · 线性回归通道
description: 线性回归通道，OLS回归趋势线与标准差通道
---

# `linear_regression_channel`

> 类别:**波动率** · 复合指标 · 关键词:linear_regression, 回归通道, 线性回归, OLS, 趋势线, 回归趋势, 斜率

::: tip 给 Skill / AI Agent 的提示
调 `POST /api/indicators?explain=true` 时,本页下方的 **解读重点 / 信号 / 注意事项** 内容会以 `knowledge` 字段塞进响应。**把它和数值一起喂给下游 LLM**,杜绝幻觉规则,不要让 LLM 自己猜阈值。
:::

线性回归通道，基于OLS回归的趋势线与标准差通道


线性回归通道，OLS回归趋势线与标准差通道


## 参数

| 参数 | 类型 | 默认值 |
|------|------|--------|
| `length` | int | `100` |
| `devlen` | float | `2` |

## 输出列

| 列名 | 含义 |
|------|------|
| `lr_mid` | 线性回归拟合值（中线/趋势线） |
| `lr_lower` | 下轨（回归值-标准差倍数） |
| `lr_slope` | 回归斜率，正值上升趋势，负值下降趋势 |
| `lr_upper` | 上轨（回归值+标准差倍数） |

## 解读重点

1. lr_slope 方向和斜率大小，判断趋势方向和速度
2. 价格在通道中的位置（上轨/中线/下轨）
3. 近期是否发生通道突破
4. 三个周期的斜率方向是否一致

## 信号

| 信号 | 含义 |
|------|------|
| `uptrend` | lr_slope > 0，统计上升趋势 |
| `at_lower` | 价格接近下轨，可能回归中线 |
| `at_upper` | 价格接近上轨，可能回归中线 |
| `downtrend` | lr_slope < 0，统计下降趋势 |
| `break_upper` | 价格突破上轨，强势或异常偏离 |

## 注意事项

线性回归假设线性关系，在剧烈波动或趋势反转时拟合可能失真


## 调用示例

```bash
curl -X POST -H "Authorization: Bearer mq_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "exchange": "binance",
    "market":   "perp",
    "symbol":   "BTCUSDT",
    "interval": "5m",
    "limit":    100,
    "calc":     [{"name": "linear_regression_channel", "params": {"length": 100, "devlen": 2}}]
  }' \
  https://api.mobiusquant.ai/api/indicators
```

## 同类指标

[atr](./atr) · [bollinger](./bollinger) · [chande_kroll_stop](./chande_kroll_stop) · [donchian_channels](./donchian_channels) · [fibonacci_bollinger_bands](./fibonacci_bollinger_bands) · [historical_volatility](./historical_volatility) · [keltner_channels](./keltner_channels) · [mass_index](./mass_index)

---

_本页由 `scripts/sync-indicators.mjs` 自动生成。手动编辑会被下次 sync 覆盖。_
