OPEN-SOURCE SCRIPT

Scout Regiment - Bias

73
# Scout Regiment - Bias Indicator

## English Documentation

### Overview
Scout Regiment - Bias is a technical indicator that measures the deviation (bias) between the current price and exponential moving averages (EMAs). It helps traders identify overbought/oversold conditions, trend strength, and potential reversal points through divergence detection.

### What is Bias?
Bias measures how far the price has moved away from a moving average, expressed as a percentage:
- **Positive Bias**: Price is above the EMA (potential overbought)
- **Negative Bias**: Price is below the EMA (potential oversold)
- **Formula**: Bias = (Price - EMA) / EMA × 100

### Key Features

#### 1. **Triple EMA Bias Lines**
The indicator calculates bias from three different EMAs:
- **EMA 55 Bias** (Default: Green/Red, 1px line)
- Short-term bias measurement
- Quick response to price changes
- Best for intraday and swing trading

- **EMA 144 Bias** (Pink, 2px line)
- Medium-term bias measurement
- Balanced response to price movements
- Ideal for swing trading

- **EMA 233 Bias** (White, 2px line)
- Long-term bias measurement
- Slower response, more stable
- Best for position trading

**Color Coding:**
- Green: Price above EMA (bullish)
- Red: Price below EMA (bearish)

#### 2. **Visual Components**

**Histogram Display**
- Shows EMA 55 bias as a histogram for easy visualization
- Green bars: Price above EMA 55
- Red bars: Price below EMA 55
- Can be toggled on/off

**Background Color**
- Light green background: Bullish bias (price above EMA 55)
- Light red background: Bearish bias (price below EMA 55)
- Optional display for cleaner charts

**Zero Line**
- White horizontal line at 0%
- Reference point for positive/negative bias
- Crossovers indicate trend changes

**Crossover Labels**
- "突破" (Breakout): When bias crosses above zero
- "跌破" (Breakdown): When bias crosses below zero
- Can be enabled/disabled for clarity

#### 3. **Divergence Detection**
The indicator automatically detects regular divergences for all three bias lines:

**Bullish Divergence (Yellow Labels)**
- Price makes lower lows
- Bias makes higher lows
- Suggests potential upward reversal
- Labels: "55涨", "144涨", "233涨"

**Bearish Divergence (Blue Labels)**
- Price makes higher highs
- Bias makes lower highs
- Suggests potential downward reversal
- Labels: "55跌", "144跌", "233跌"

**Divergence Parameters** (Customizable for each EMA):
- Left Lookback: Bars to the left of pivot (default: 5)
- Right Lookback: Bars to the right of pivot (default: 1)
- Max Lookback Range: Maximum distance between pivots (default: 60)
- Min Lookback Range: Minimum distance between pivots (default: 5)

### Configuration Settings

#### Bias Settings
- **EMA Periods**: Customize lengths for EMA 55, 144, and 233
- **Price Source**: Choose calculation source (default: close)
- **Enable/Disable**: Toggle each bias line independently

#### Display Settings
- **Show Histogram**: Toggle histogram display
- **Show Background Color**: Toggle background coloring
- **Show Crossover Labels**: Toggle breakout/breakdown labels

#### Divergence Settings (Per EMA)
- Individual controls for EMA 55, 144, and 233 divergences
- Customizable lookback parameters for precision tuning
- Adjustable range settings for different market conditions

### How to Use

#### For Trend Trading
1. **Identify Trend Direction**
- Price above zero = Uptrend
- Price below zero = Downtrend

2. **Confirm with Multiple Timeframes**
- EMA 55: Short-term trend
- EMA 144: Medium-term trend
- EMA 233: Long-term trend

3. **Trade in Direction of Bias**
- All three lines positive = Strong uptrend
- All three lines negative = Strong downtrend

#### For Mean Reversion Trading
1. **Identify Extremes**
- High positive bias (>5-10%) = Overbought
- High negative bias (<-5 to -10%) = Oversold

2. **Wait for Confirmation**
- Look for bias to turn back toward zero
- Watch for crossover labels

3. **Enter on Reversal**
- Enter long when extreme negative bias starts rising
- Enter short when extreme positive bias starts falling

#### For Divergence Trading
1. **Spot Divergence Labels**
- Yellow labels = Bullish divergence (potential buy)
- Blue labels = Bearish divergence (potential sell)

2. **Confirm with Price Action**
- Wait for price to confirm with structure break
- Look for support/resistance reactions

3. **Use Multiple EMAs**
- EMA 55 divergence: Quick reversals
- EMA 144 divergence: Reliable signals
- EMA 233 divergence: Major trend changes

#### For Multi-Timeframe Analysis
1. **Check Long-term Bias** (EMA 233)
- Determines overall market direction

2. **Find Medium-term Entry** (EMA 144)
- Look for pullbacks in long-term trend

3. **Time Short-term Entry** (EMA 55)
- Enter when short-term aligns with longer timeframes

### Trading Strategies

#### Strategy 1: Triple Confirmation
- Wait for all three bias lines to be positive (or negative)
- Enter in direction of unanimous bias
- Exit when any line crosses zero
- Best for: Strong trending markets

#### Strategy 2: Divergence Trading
- Enable all divergence detection
- Take trades only when divergence appears
- Confirm with price structure
- Best for: Range-bound and reversal setups

#### Strategy 3: Zero Line Crossover
- Enable crossover labels
- Enter long on "突破" labels
- Enter short on "跌破" labels
- Use stop loss at recent swing points
- Best for: Trend following

#### Strategy 4: Extreme Reversion
- Wait for bias to reach extremes (>10% or <-10%)
- Enter counter-trend when bias reverses
- Exit at zero line
- Best for: Ranging markets

### Best Practices

1. **Combine with Price Action**
- Don't trade bias alone
- Confirm with support/resistance
- Look for candlestick patterns

2. **Use Multiple Timeframes**
- Check higher timeframe bias
- Trade in direction of larger trend
- Use lower timeframe for entry timing

3. **Manage Risk**
- Set stop losses beyond recent swings
- Don't fight extreme bias in strong trends
- Reduce position size at extremes

4. **Customize for Your Market**
- Volatile assets: Use wider ranges
- Stable assets: Use tighter ranges
- Adjust EMA periods for your timeframe

5. **Watch for False Signals**
- Multiple small divergences = Less reliable
- Divergences at extremes = More reliable
- Confirm with other indicators

### Indicator Combinations

**With Volume:**
- High bias + Low volume = Weak move
- High bias + High volume = Strong move

**With Moving Averages:**
- Check if price is above/below key EMAs
- Bias confirms EMA trend strength

**With RSI/MACD:**
- Multiple indicator divergence = Stronger signal
- Use bias for overbought/oversold confirmation

### Performance Tips

- Disable unused features for faster loading
- Use histogram for quick visual reference
- Enable background color for trend clarity
- Use divergence detection selectively

### Common Patterns

1. **Bias Expansion**: Bias increasing = Strong trend
2. **Bias Contraction**: Bias decreasing = Trend weakening
3. **Zero Line Bounce**: Price respects EMA as support/resistance
4. **Extreme Bias**: Over-extension, watch for reversal
5. **Divergence Cluster**: Multiple EMAs diverging = High probability reversal

### Alert Conditions

You can set alerts for:
- Bias crossing above/below zero
- Extreme bias levels
- Divergence detection
- All three bias lines aligned

---

## 中文说明文档

### 概述
Scout Regiment - Bias 是一个技术指标,用于测量当前价格与指数移动平均线(EMA)之间的偏离程度(乖离率)。它帮助交易者识别超买超卖状况、趋势强度,以及通过背离检测发现潜在的反转点。

### 什么是乖离率?
乖离率衡量价格偏离移动平均线的程度,以百分比表示:
- **正乖离**:价格高于EMA(可能超买)
- **负乖离**:价格低于EMA(可能超卖)
- **计算公式**:乖离率 = (价格 - EMA) / EMA × 100

### 核心功能

#### 1. **三重EMA乖离率线**
指标计算三条不同EMA的乖离率:
- **EMA 55 乖离率**(默认:绿色/红色,1像素线)
- 短期乖离测量
- 对价格变化反应快速
- 适合日内和波段交易

- **EMA 144 乖离率**(粉色,2像素线)
- 中期乖离测量
- 对价格波动反应平衡
- 最适合波段交易

- **EMA 233 乖离率**(白色,2像素线)
- 长期乖离测量
- 反应较慢,更稳定
- 适合仓位交易

**颜色编码:**
- 绿色:价格高于EMA(看涨)
- 红色:价格低于EMA(看跌)

#### 2. **视觉组件**

**柱状图显示**
- 以柱状图形式显示EMA 55乖离率,便于可视化
- 绿色柱:价格高于EMA 55
- 红色柱:价格低于EMA 55
- 可开关显示

**背景颜色**
- 浅绿色背景:看涨乖离(价格高于EMA 55)
- 浅红色背景:看跌乖离(价格低于EMA 55)
- 可选显示,图表更清爽

**零轴**
- 零点位置的白色横线
- 正负乖离的参考点
- 穿越表示趋势变化

**穿越标签**
- "突破":乖离率向上穿越零轴
- "跌破":乖离率向下穿越零轴
- 可启用/禁用以保持清晰

#### 3. **背离检测**
指标自动检测所有三条乖离率线的常规背离:

**看涨背离(黄色标签)**
- 价格创新低
- 乖离率创更高的低点
- 暗示潜在向上反转
- 标签:"55涨"、"144涨"、"233涨"

**看跌背离(蓝色标签)**
- 价格创新高
- 乖离率创更低的高点
- 暗示潜在向下反转
- 标签:"55跌"、"144跌"、"233跌"

**背离参数**(每个EMA可自定义):
- 左侧回溯:枢轴点左侧K线数(默认:5)
- 右侧回溯:枢轴点右侧K线数(默认:1)
- 最大回溯范围:枢轴点之间最大距离(默认:60)
- 最小回溯范围:枢轴点之间最小距离(默认:5)

### 配置设置

#### Bias设置
- **EMA周期**:自定义EMA 55、144和233的长度
- **价格源**:选择计算源(默认:收盘价)
- **启用/禁用**:独立切换每条乖离率线

#### 显示设置
- **显示柱状图**:切换柱状图显示
- **显示背景颜色**:切换背景着色
- **显示突破标签**:切换突破/跌破标签

#### 背离设置(按EMA)
- EMA 55、144和233背离的独立控制
- 可自定义回溯参数用于精确调整
- 可调整范围设置以适应不同市场状况

### 使用方法

#### 趋势交易
1. **识别趋势方向**
- 价格高于零 = 上升趋势
- 价格低于零 = 下降趋势

2. **多时间框架确认**
- EMA 55:短期趋势
- EMA 144:中期趋势
- EMA 233:长期趋势

3. **顺乖离方向交易**
- 三条线全部为正 = 强劲上升趋势
- 三条线全部为负 = 强劲下降趋势

#### 均值回归交易
1. **识别极值**
- 高正乖离(>5-10%)= 超买
- 高负乖离(<-5至-10%)= 超卖

2. **等待确认**
- 等待乖离率回归零轴
- 观察穿越标签

3. **在反转时进场**
- 极端负乖离开始上升时做多
- 极端正乖离开始下降时做空

#### 背离交易
1. **发现背离标签**
- 黄色标签 = 看涨背离(潜在买入)
- 蓝色标签 = 看跌背离(潜在卖出)

2. **用价格行为确认**
- 等待价格通过结构突破确认
- 观察支撑/阻力反应

3. **使用多个EMA**
- EMA 55背离:快速反转
- EMA 144背离:可靠信号
- EMA 233背离:重大趋势变化

#### 多时间框架分析
1. **检查长期乖离**(EMA 233)
- 确定整体市场方向

2. **寻找中期入场**(EMA 144)
- 在长期趋势中寻找回调

3. **把握短期入场时机**(EMA 55)
- 短期与长期时间框架一致时进场

### 交易策略

#### 策略1:三重确认
- 等待三条乖离率线全部为正(或负)
- 顺一致乖离方向入场
- 任一线穿越零轴时离场
- 适合:强趋势市场

#### 策略2:背离交易
- 启用所有背离检测
- 仅在出现背离时交易
- 用价格结构确认
- 适合:震荡和反转设置

#### 策略3:零轴穿越
- 启用穿越标签
- 在"突破"标签时做多
- 在"跌破"标签时做空
- 在近期波动点设置止损
- 适合:趋势跟随

#### 策略4:极值回归
- 等待乖离率达到极值(>10%或<-10%)
- 乖离率反转时逆趋势入场
- 在零轴离场
- 适合:震荡市场

### 最佳实践

1. **结合价格行为**
- 不要单独使用乖离率交易
- 用支撑/阻力确认
- 寻找K线形态

2. **使用多时间框架**
- 检查更高时间框架的乖离
- 顺大趋势方向交易
- 用低时间框架把握入场时机

3. **风险管理**
- 在近期波动之外设置止损
- 不要在强趋势中对抗极端乖离
- 在极值处减少仓位

4. **针对您的市场定制**
- 波动大的资产:使用更宽的范围
- 稳定的资产:使用更紧的范围
- 根据时间框架调整EMA周期

5. **警惕假信号**
- 多个小背离 = 可靠性较低
- 极值处的背离 = 更可靠
- 用其他指标确认

### 指标组合

**与成交量配合:**
- 高乖离 + 低成交量 = 弱势波动
- 高乖离 + 高成交量 = 强势波动

**与移动平均线配合:**
- 检查价格是否在关键EMA上方/下方
- 乖离率确认EMA趋势强度

**与RSI/MACD配合:**
- 多指标背离 = 更强信号
- 使用乖离率确认超买超卖

### 性能提示

- 禁用未使用的功能以加快加载
- 使用柱状图快速视觉参考
- 启用背景颜色以清晰显示趋势
- 有选择地使用背离检测

### 常见形态

1. **乖离扩张**:乖离率增大 = 强趋势
2. **乖离收缩**:乖离率减小 = 趋势减弱
3. **零轴反弹**:价格将EMA作为支撑/阻力
4. **极端乖离**:过度延伸,注意反转
5. **背离集群**:多个EMA背离 = 高概率反转

### 警报条件

您可以为以下情况设置警报:
- 乖离率向上/向下穿越零轴
- 极端乖离水平
- 背离检测
- 三条乖离率线对齐

---

## Technical Support
For questions or issues, please refer to the TradingView community or contact the indicator creator.

## 技术支持
如有问题,请参考TradingView社区或联系指标创建者。

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.