INVITE-ONLY SCRIPT

Chan Theory MACD Divergence | CJZT

50
# Chan Theory MACD Divergence | CJZT

## Overview
This is the companion MACD subplot indicator for Chan Theory structural analysis. It visualizes MACD divergence directly on the histogram, making it easier to identify Type I buy/sell signals (divergence-based trend reversals). This indicator works in perfect sync with the main Chan Theory indicator to provide visual confirmation of divergence patterns.

**Why This Indicator?**
- **Visual Divergence Confirmation**: Displays divergence lines and labels directly on MACD histogram, eliminating guesswork
- **Multi-Level Divergence Detection**: Tracks divergence across pen-level, segment-level, and trend-level structures
- **Four Divergence Methods**: Amplitude, MACD Area, MACD Histogram, or combined - choose what works best for your strategy
- **Real-Time Alerts**: Get notified instantly when divergence patterns form across different structural levels
- **Perfect Sync**: Automatically synchronizes with the main indicator's structural analysis

**Key Features:**
- MACD histogram with divergence visualization
- Pen/Segment/Trend level divergence tracking
- Type I signal divergence confirmation
- Customizable divergence detection methods
- Multi-timeframe divergence alerts
- Clean, distraction-free subplot design

## What Makes This Indicator Original

This indicator is an original implementation designed specifically for Chan Theory divergence analysis with unique features not found in standard MACD indicators:

**1. Synchronized Structural Analysis**
Automatically synchronizes with the main Chan Theory indicator's pen/segment/trend structure using identical K-line containment processing and fractal detection, ensuring perfect alignment between main chart and MACD analysis.

**2. Multi-Level Divergence Visualization**
Unlike standard MACD indicators that only show the histogram, this indicator draws divergence lines connecting MACD peaks/troughs, labels divergence types (pen/segment/trend level), and tracks divergence across three structural levels.

**3. Four Distinct Divergence Detection Methods**
Provides flexibility with Amplitude, MACD Area, MACD Histogram (most visual), or Either Method - allowing traders to choose the most appropriate method for their strategy.

**4. Integrated Expected Signal System**
Shows anticipated divergence patterns before full confirmation, allowing traders to prepare for high-probability setups while awaiting formal confirmation.

**5. Companion Indicator Design**
Specifically designed to work seamlessly with "Chan Theory - Chanlun MAX | CJZT" main indicator, providing complete Chan Theory analysis when used together.

## Disclaimer

- This script is for technical analysis reference only
- Does not constitute investment advice or trading recommendations
- Divergence signals should be confirmed with price action
- Users should make independent trading decisions and manage their own risk
- Recommended for educational purposes and as a supplementary analysis tool


## Core Functions

### 1. MACD Divergence Visualization
Displays divergence relationships directly on the MACD histogram:
- **Pen Divergence**: Compare MACD between consecutive pens
- **Segment Divergence**: Identify divergence at segment completion
- **Trend Divergence**: Detect major trend exhaustion signals

### 2. Four Divergence Detection Methods
| Method | Description |
|--------|-------------|
| **Amplitude Divergence** | Compare price swing amplitude |
| **MACD Area Divergence** | Compare MACD histogram area sum |
| **MACD Histogram** | Compare peak histogram values (recommended) |
| **Either Method** | Trigger when any method shows divergence |

> **Pro Tip**: The MACD Histogram method is most intuitive when used with this subplot indicator, as you can visually see the histogram peak comparison.

### 3. Type I Signal Requirements
Configure when Type I signals can form:
- **Must Have Pivot**: Segment must contain at least one pivot zone
- **Pivot or 3+ Pens**: Segment has pivot OR contains 3+ pens
- **Pivot or 5+ Pens**: Segment has pivot OR contains 5+ pens

### 4. Alert System
Comprehensive divergence alerts:
- **Sub-level Divergence**: Pen-level divergence alerts
- **Main-level Divergence**: Segment-level divergence alerts
- **Big-level Divergence**: Trend-level divergence alerts
- **Multi-level Resonance**: Alerts when divergence aligns across levels

## Settings Reference

### Display Settings
| Setting | Description |
|---------|-------------|
| Fast Pen Mode | Allow pens without complete fractals |
| Pen Type | Classic/Optimized/4K/5K/Strict |
| Single Pen to Segment | Enable level upgrade features |

### Divergence Settings
| Setting | Description |
|---------|-------------|
| Divergence Method | Amplitude/MACD Area/Histogram/Either |
| Type I Pivot Requirement | Pivot or pen count requirements |
| Enable Divergence Check | Force divergence validation for Type I |

### Alert Settings
| Setting | Description |
|---------|-------------|
| Expected vs Confirmed | Alert on expected/confirmed/both signals |
| Show Expected Signals | Display anticipated divergence patterns |

## How to Use

### Setup
1. Add "Chan Theory - Chanlun MAX | CJZT" to your main chart
2. Add this "Chan Theory MACD Divergence | CJZT" indicator to a subplot
3. Both indicators will automatically synchronize their structural analysis

> **Important**: Both indicators have identical default settings. If you need to modify any configuration (such as pen type, single pen to segment conditions, etc.), make sure to apply the same changes to both the main chart and subplot indicators to maintain synchronized structural analysis.

### Reading Divergence
- **Divergence Lines**: Connect MACD peaks/troughs showing divergence
- **Divergence Labels**: Display divergence type and strength
- **Color Coding**: Visual distinction between bullish/bearish divergence

### Best Practices
- Use MACD Histogram method for clearest visual confirmation
- Watch for multi-level divergence resonance for strongest signals
- Combine with main indicator's Type I signals for entry confirmation
- Set alerts for your preferred divergence detection method

## Notes
- This script is designed to work with Chan Theory - Chanlun MAX | CJZT
- For technical analysis reference only
- Does not constitute investment advice
- Users should make independent trading decisions

---

# 概述
本指标是缠论结构分析的配套MACD副图指标。它直接在MACD柱状图上可视化背驰关系,使识别一类买卖点(基于背驰的趋势反转)变得更加容易。本指标与主图缠论指标完美同步,提供背驰形态的视觉确认。

**为什么选择本指标?**
- **可视化背驰确认**:直接在MACD柱状图上显示背驰线和标签,消除猜测
- **多级别背驰检测**:跟踪笔级别、线段级别和趋势级别的背驰
- **四种背驰方法**:振幅、MACD面积、MACD柱体或组合 - 选择最适合您策略的方法
- **实时警报**:当不同结构级别形成背驰形态时立即获得通知
- **完美同步**:自动与主指标的结构分析同步

**核心功能:**
- 带背驰可视化的MACD柱状图
- 笔/线段/趋势级别背驰跟踪
- 一类信号背驰确认
- 可自定义背驰检测方法
- 多周期背驰警报
- 简洁、无干扰的副图设计

## 核心功能

### 1. MACD背驰可视化
直接在MACD柱状图上显示背驰关系:
- **笔背驰**:比较连续笔之间的MACD
- **线段背驰**:识别线段完成时的背驰
- **趋势背驰**:检测主要趋势衰竭信号

### 2. 四种背驰检测方法
| 方式 | 说明 |
|------|------|
| **振幅背驰** | 比较价格振幅 |
| **MACD面积背驰** | 比较MACD柱状图面积总和 |
| **MACD柱体** | 比较柱状图峰值(推荐) |
| **任一方式** | 任一方法显示背驰时触发 |

> **使用技巧**:MACD柱体方式配合本副图指标使用最直观,因为您可以直观地看到柱状图峰值比较。

### 3. 一类信号要求
配置一类信号形成条件:
- **必须有中枢**:线段必须包含至少一个中枢
- **有中枢或3笔以上**:线段有中枢或包含3笔以上
- **有中枢或5笔以上**:线段有中枢或包含5笔以上

### 4. 警报系统
全面的背驰警报:
- **次级别背驰**:笔级别背驰警报
- **本级别背驰**:线段级别背驰警报
- **大级别背驰**:趋势级别背驰警报
- **多级别共振**:跨级别背驰对齐时警报

## 设置参考

### 显示设置
| 设置项 | 说明 |
|--------|------|
| 急速成笔 | 允许无完整分型成笔 |
| 笔的类型 | 老笔/新笔/4K/5K/严笔 |
| 单笔成段 | 启用级别升级功能 |

### 背驰设置
| 设置项 | 说明 |
|--------|------|
| 背驰判断方式 | 振幅/MACD面积/柱体/任一 |
| 一类中枢要求 | 中枢或笔数要求 |
| 启用背驰检查 | 强制一类背驰验证 |

### 警报设置
| 设置项 | 说明 |
|--------|------|
| 预期与确认 | 预期/确认/全部信号警报 |
| 显示预期信号 | 显示预期背驰形态 |

## 使用方法

### 设置步骤
1. 在主图添加 "Chan Theory - Chanlun MAX | CJZT"
2. 在副图添加本 "Chan Theory MACD Divergence | CJZT" 指标
3. 两个指标将自动同步其结构分析

> **重要提示**:两个指标的默认设置已保持一致。如果您需要修改配置(如笔的类型、单笔成段条件等),请确保在主图和副图指标中同时进行相同的修改,以保持结构分析的同步。

### 读取背驰
- **背驰线**:连接显示背驰的MACD峰值/谷值
- **背驰标签**:显示背驰类型和强度
- **颜色编码**:视觉区分多头/空头背驰

### 最佳实践
- 使用MACD柱体方式获得最清晰的视觉确认
- 关注多级别背驰共振以获得最强信号
- 结合主指标的一类信号进行入场确认
- 为您偏好的背驰检测方法设置警报

## 原创性声明

本指标是专为缠论背驰分析设计的原创实现,具有标准MACD指标所没有的独特功能:

**1. 结构同步分析**
与主图缠论指标自动同步,使用相同的K线包含处理和分型识别逻辑

**2. 多级别背驰可视化**
在MACD柱状图上绘制背驰线、标签,跟踪笔/线段/趋势三个级别的背驰

**3. 四种背驰检测方法**
提供振幅、MACD面积、MACD柱体、任一方式四种选择

**4. 预期信号系统**
在完全确认前显示预期背驰形态,提前准备交易

**5. 配套指标设计**
专门设计用于配合主图缠论指标,两者结合实现完整分析

## 免责声明

- 本脚本仅供技术分析参考
- 不构成投资建议或交易推荐
- 背驰信号应结合价格行为确认
- 用户应自行做出交易决策并管理风险
- 建议用于教育目的和作为辅助分析工具

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.