PROTECTED SOURCE SCRIPT
缠论 MACD 面积测量器

「缠论 MACD 量能面积」使用说明
一、指标定位
本指标不是传统意义的 MACD,而是专门为缠论笔 / 段背驰研究设计的“MACD 量能面积测量工具”:
重点不在多条 MACD 线、背景颜色,而在于:
单根柱子的量能大小
一整段区间内 MACD 量柱的总面积(总能量)
A / B 两段区间量能的可视化对比
建议把它理解为:
“用 MACD 直方图来度量一笔 / 一段的多空能量,并直观显示数值。”
二、推荐样式设置(强烈建议按此设置)
为了让图表尽量干净,只把注意力放在“面积”和“区间”上,
添加指标后,建议在『样式 / Style』中这样设置:
关闭所有线条:
取消勾选:
MACD 线(本级别)
信号线(本级别)
MACD 线(高级别)
信号线(高级别)
关闭 MACD 背景色:
取消勾选:
MACD 背景色(本级别)
MACD 背景色(高级别)
只保留以下内容:
直方图(本级别)
A/B 区间门柱线(左门 / 右门)
A/B 区间标签
对比区间门柱线与标签(如果你需要对比)
这样一来,下方子图会非常简单:
只有 MACD 量柱 + 区间框架 + 数字标签,完全为缠论背驰服务。
三、核心功能概览
MACD 直方图面积自动累加
指标会对选定区间内的 MACD 直方图逐根累加,得到一段的量能面积。
同时记录:
该区间柱子的数量
区间内 MACD 直方图的最大值 / 最小值
A 区间 & B 区间双区对比
通过输入栏设置:
A 区左门偏移 / 右门偏移(以当前 K 线为基准向左数)
B 区左门偏移 / 右门偏移
指标会在图表上画出:
两组“门框”竖线
A / B 各自的面积标签(显示在子图顶部或底部,避免挡住量柱)
面积模式(三种算法可切换)
在「面积模式」下拉框中可以切换三种逻辑:
① 带符号净合力
多头柱为正,空头柱为负,逐根累加。
适合想看“这一段最终多空谁占优”的场景。
② 绝对值总能量
对每一根 MACD 量柱取绝对值再累加。
反应的是真实释放的总能量,不关心方向。
标签会额外提示方向(多 / 空),能量数值本身统一用正数表示。
③ 同向柱求和(自动方向)
先判断区间整体方向:
若区间终点收盘 ≥ 起点收盘 → 判为上升段
若区间终点收盘 < 起点收盘 → 判为下降段
上升段:只统计 >0 的 MACD 柱 绝对值之和(多头主升能量)
下降段:只统计 <0 的 MACD 柱 绝对值之和(空头主跌能量)
这是最贴合缠论“同向力度比较”的模式。
四、参数说明(与缠论相关的部分)
只列对缠论最关键的那几类,其他颜色参数可按个人习惯自行调整。
缠论面积 – 区间设置
A 左门偏移 / A 右门偏移
以当前 K 线为 0 向左数 K 线。
例如:左门 150,右门 100
→ 代表“从当前向左第 150 根,到第 100 根之间”为 A 区。
B 左门偏移 / B 右门偏移
同理定义 B 区。
所有门柱位置是锁定在具体历史 K 线上,后面新增 K 线不会改变原来的区间;这是为了解决“过一段时间区间被整体挪动”的问题。
面积模式 / 面积使用绝对值
面积模式:在三种算法中切换(上文已说明)。
若想单纯比较“谁的空头量能更大 / 谁的多头量能更强”,
推荐使用:
“绝对值总能量” + 观察方向提示,或
“同向柱求和”模式。
标签显示与位置
可以在参数中选择:
是否显示 A 区 / B 区标签
标签在子图中的大致位置(顶部 / 底部)
脚本内部已做处理:
尽量把标签推到 MACD 量柱以外的区域,不挡住主要走势。
五、典型用法示例(缠论背驰)
判断同级别笔/段是否背驰
先用你的缠论划分出:
A 段:早期的一笔或一段(参考段)
B 段:后出现的一笔或一段(待判断是否背驰)
用门柱锁定 A/B 两段对应的 MACD 区间;
将“面积模式”调到:
同向柱求和 或 绝对值总能量;
对比 A、B 区间的能量数值:
B 段价格创新高 / 新低,而面积明显小于 A 段 → 结合结构,可作为背驰的重要证据之一;
若面积不减反增,则背驰信号弱或不存在。
上涨 vs 下跌,如何读数?
多头段:
区间整体向上 → 系统自动只统计上方绿柱。
数值越大,说明多头主升能量越足。
空头段:
区间整体向下 → 系统自动只统计下方红柱。
数值越大,说明空头主跌能量越足。
不论数值前面是否带符号,真正代表力度大小的是绝对值,脚本在标签里已有方向文字提示,避免出现“−8000 和 −9000 谁更大”这种混淆。
六、注意事项与建议
本指标只负责量能的度量与对比,
不直接给出买卖点信号,必须与:
你的缠论结构(中枢、笔、段、趋势)、
以及其他过滤条件(级别、位置、时间)
一起使用。
在低流动性、极端放量、或数据异常的标的上,MACD 本身会出现失真,
面积比较也可能失真,需要结合 K 线实际形态校对。
“Chan MACD Energy Area” – User Guide (English Version)
1. Indicator Purpose & Positioning
This script is not a traditional MACD.
It is designed specifically as a “MACD energy-area measuring tool” for studying divergence of Chan theory strokes / segments (笔 / 段).
The focus is not on multiple MACD lines or background colors, but on:
The energy of each individual histogram bar
The total MACD energy area over a selected price segment
A visual comparison of energy between Segment A and Segment B
You can think of it as:
“Using the MACD histogram to quantify the long/short energy of a stroke/segment, and display it with clear numerical values.”
2. Recommended Style Settings (strongly recommended)
To keep the chart clean and focus only on area and segments,
after adding the indicator, go to Style and configure it as follows:
Turn off all lines – uncheck:
MACD Line (Current timeframe)
Signal Line (Current timeframe)
MACD Line (Higher timeframe)
Signal Line (Higher timeframe)
Turn off MACD background fills – uncheck:
MACD Background (Current timeframe)
MACD Background (Higher timeframe)
Keep only the following items turned on:
Histogram (Current timeframe)
A/B segment gate lines (Left gate / Right gate)
A/B segment labels
Comparison segment gate lines and label (if you need comparison)
After this, the sub-pane becomes very simple:
Only MACD histogram + segment frames + numeric labels –
everything is serving Chan-style divergence analysis.
3. Core Function Overview
3.1 Automatic accumulation of MACD histogram area
The script accumulates the MACD histogram bar by bar within the selected segment to obtain the total energy area of that segment.
At the same time it records:
Number of histogram bars in the segment
Maximum / minimum value of the MACD histogram within that segment
3.2 Dual-segment comparison: Area A vs Area B
Through the inputs you can set:
A-segment left gate offset / right gate offset
(counted left from the current bar)
B-segment left gate offset / right gate offset
The indicator will draw on the chart:
Two pairs of vertical “gate” lines (for A and B)
An individual area label for A and B
(shown near the top or bottom of the sub-pane to avoid covering the histogram)
3.3 “Area Mode” – three switchable algorithms
In the “Area Mode” dropdown you can choose between three different logics:
(1) Signed Net Force
Positive bars (above zero) are treated as long energy,
Negative bars (below zero) are treated as short energy,
All bars are accumulated with their sign.
Suitable when you want to know:
“Over this whole segment, which side ultimately dominates – bulls or bears?”
(2) Absolute Total Energy
Take the absolute value of each MACD bar, then accumulate.
This reflects the total energy released, regardless of direction.
The label will additionally indicate direction (long / short),
The energy value itself is expressed as a positive number for consistency.
(3) Same-direction Sum (automatic direction detection)
First determine the overall direction of the segment:
If segment end close ≥ segment start close → treated as an up-segment
If segment end close < segment start close → treated as a down-segment
Then:
Up-segment → only accumulate MACD > 0 bars (absolute value),
i.e. main bullish driving energy
Down-segment → only accumulate MACD < 0 bars (absolute value),
i.e. main bearish driving energy
This mode is the closest to Chan theory’s “same-direction force comparison”.
4. Parameter Notes (Chan-related parts)
Only the parameters most relevant to Chan analysis are listed here.
Other color / style options can be customized freely.
4.1 Chan Area – Segment Settings
A Left Gate Offset / A Right Gate Offset
Offsets are defined as:
From the current bar = 0, count bars to the left.
Example:
Left gate = 150, Right gate = 100
→ This means Segment A is from
“150 bars left from the current bar” to “100 bars left from the current bar”.
B Left Gate Offset / B Right Gate Offset
Defined in the same way for Segment B.
All gate positions are locked to specific historical bars.
When new bars appear in the future, the original A/B segments do not move.
This is designed specifically to solve the issue where segments “slide forward in time” as more bars appear.
4.2 Area Mode / Use Absolute Value
Area Mode – switches between the three algorithms described above.
If you only care about:
“Which segment has stronger bearish energy, or which has stronger bullish energy?”
then the recommended modes are:
“Absolute Total Energy” (read the direction hint in the label), or
“Same-direction Sum” mode.
4.3 Label Display & Position
In the inputs you can configure:
Whether to display the A-segment label / B-segment label
Label position in the sub-pane: Top / Bottom / Auto
Inside the script there is additional handling:
It tries to push labels outside the MACD histogram area as much as possible,
so they don’t cover the main price/energy structure.
5. Typical Use Case – Chan-style Divergence
5.1 Determining whether two strokes/segments are divergent
First, using your own Chan framework, identify:
Segment A: the earlier stroke/segment (reference segment)
Segment B: the later stroke/segment (to be checked for divergence)
Then:
Use the gate lines to lock the corresponding MACD histogram segments for A and B.
Set Area Mode to:
“Same-direction Sum”, or
“Absolute Total Energy”.
Compare the energy values of A and B:
If Segment B makes a new high or new low in price,
but its energy area is clearly smaller than Segment A,
then, combined with structure, this can be treated as strong evidence of divergence.
If the area does not shrink (or even expands),
the divergence signal is weak or absent.
5.2 How to read values in uptrends vs downtrends
Bullish segment:
Segment direction is up → the script automatically counts only positive MACD bars (above zero).
The larger the value, the stronger the bullish driving energy.
Bearish segment:
Segment direction is down → the script automatically counts only negative MACD bars (below zero).
The larger the value (in absolute terms), the stronger the bearish driving energy.
Regardless of whether the raw value carries a minus sign,
what really represents the strength is its absolute magnitude.
The label already includes direction text to avoid confusion such as:
“Which is stronger, −8000 or −9000?”
The answer is: |−9000| > |−8000|,
but the label will explicitly tell you whether it is bullish or bearish energy.
6. Notes & Suggestions
This indicator only measures and compares energy,
it does not generate direct buy/sell signals.
It must be used together with:
Your own Chan structure analysis (centers, strokes, segments, trends), and
Other filters (timeframe, price location, timing, etc.).
On instruments with low liquidity, extreme spikes, or bad data,
MACD itself can become distorted.
In such cases, area comparison may also be distorted and should always be cross-checked against the actual candlestick structure.
一、指标定位
本指标不是传统意义的 MACD,而是专门为缠论笔 / 段背驰研究设计的“MACD 量能面积测量工具”:
重点不在多条 MACD 线、背景颜色,而在于:
单根柱子的量能大小
一整段区间内 MACD 量柱的总面积(总能量)
A / B 两段区间量能的可视化对比
建议把它理解为:
“用 MACD 直方图来度量一笔 / 一段的多空能量,并直观显示数值。”
二、推荐样式设置(强烈建议按此设置)
为了让图表尽量干净,只把注意力放在“面积”和“区间”上,
添加指标后,建议在『样式 / Style』中这样设置:
关闭所有线条:
取消勾选:
MACD 线(本级别)
信号线(本级别)
MACD 线(高级别)
信号线(高级别)
关闭 MACD 背景色:
取消勾选:
MACD 背景色(本级别)
MACD 背景色(高级别)
只保留以下内容:
直方图(本级别)
A/B 区间门柱线(左门 / 右门)
A/B 区间标签
对比区间门柱线与标签(如果你需要对比)
这样一来,下方子图会非常简单:
只有 MACD 量柱 + 区间框架 + 数字标签,完全为缠论背驰服务。
三、核心功能概览
MACD 直方图面积自动累加
指标会对选定区间内的 MACD 直方图逐根累加,得到一段的量能面积。
同时记录:
该区间柱子的数量
区间内 MACD 直方图的最大值 / 最小值
A 区间 & B 区间双区对比
通过输入栏设置:
A 区左门偏移 / 右门偏移(以当前 K 线为基准向左数)
B 区左门偏移 / 右门偏移
指标会在图表上画出:
两组“门框”竖线
A / B 各自的面积标签(显示在子图顶部或底部,避免挡住量柱)
面积模式(三种算法可切换)
在「面积模式」下拉框中可以切换三种逻辑:
① 带符号净合力
多头柱为正,空头柱为负,逐根累加。
适合想看“这一段最终多空谁占优”的场景。
② 绝对值总能量
对每一根 MACD 量柱取绝对值再累加。
反应的是真实释放的总能量,不关心方向。
标签会额外提示方向(多 / 空),能量数值本身统一用正数表示。
③ 同向柱求和(自动方向)
先判断区间整体方向:
若区间终点收盘 ≥ 起点收盘 → 判为上升段
若区间终点收盘 < 起点收盘 → 判为下降段
上升段:只统计 >0 的 MACD 柱 绝对值之和(多头主升能量)
下降段:只统计 <0 的 MACD 柱 绝对值之和(空头主跌能量)
这是最贴合缠论“同向力度比较”的模式。
四、参数说明(与缠论相关的部分)
只列对缠论最关键的那几类,其他颜色参数可按个人习惯自行调整。
缠论面积 – 区间设置
A 左门偏移 / A 右门偏移
以当前 K 线为 0 向左数 K 线。
例如:左门 150,右门 100
→ 代表“从当前向左第 150 根,到第 100 根之间”为 A 区。
B 左门偏移 / B 右门偏移
同理定义 B 区。
所有门柱位置是锁定在具体历史 K 线上,后面新增 K 线不会改变原来的区间;这是为了解决“过一段时间区间被整体挪动”的问题。
面积模式 / 面积使用绝对值
面积模式:在三种算法中切换(上文已说明)。
若想单纯比较“谁的空头量能更大 / 谁的多头量能更强”,
推荐使用:
“绝对值总能量” + 观察方向提示,或
“同向柱求和”模式。
标签显示与位置
可以在参数中选择:
是否显示 A 区 / B 区标签
标签在子图中的大致位置(顶部 / 底部)
脚本内部已做处理:
尽量把标签推到 MACD 量柱以外的区域,不挡住主要走势。
五、典型用法示例(缠论背驰)
判断同级别笔/段是否背驰
先用你的缠论划分出:
A 段:早期的一笔或一段(参考段)
B 段:后出现的一笔或一段(待判断是否背驰)
用门柱锁定 A/B 两段对应的 MACD 区间;
将“面积模式”调到:
同向柱求和 或 绝对值总能量;
对比 A、B 区间的能量数值:
B 段价格创新高 / 新低,而面积明显小于 A 段 → 结合结构,可作为背驰的重要证据之一;
若面积不减反增,则背驰信号弱或不存在。
上涨 vs 下跌,如何读数?
多头段:
区间整体向上 → 系统自动只统计上方绿柱。
数值越大,说明多头主升能量越足。
空头段:
区间整体向下 → 系统自动只统计下方红柱。
数值越大,说明空头主跌能量越足。
不论数值前面是否带符号,真正代表力度大小的是绝对值,脚本在标签里已有方向文字提示,避免出现“−8000 和 −9000 谁更大”这种混淆。
六、注意事项与建议
本指标只负责量能的度量与对比,
不直接给出买卖点信号,必须与:
你的缠论结构(中枢、笔、段、趋势)、
以及其他过滤条件(级别、位置、时间)
一起使用。
在低流动性、极端放量、或数据异常的标的上,MACD 本身会出现失真,
面积比较也可能失真,需要结合 K 线实际形态校对。
“Chan MACD Energy Area” – User Guide (English Version)
1. Indicator Purpose & Positioning
This script is not a traditional MACD.
It is designed specifically as a “MACD energy-area measuring tool” for studying divergence of Chan theory strokes / segments (笔 / 段).
The focus is not on multiple MACD lines or background colors, but on:
The energy of each individual histogram bar
The total MACD energy area over a selected price segment
A visual comparison of energy between Segment A and Segment B
You can think of it as:
“Using the MACD histogram to quantify the long/short energy of a stroke/segment, and display it with clear numerical values.”
2. Recommended Style Settings (strongly recommended)
To keep the chart clean and focus only on area and segments,
after adding the indicator, go to Style and configure it as follows:
Turn off all lines – uncheck:
MACD Line (Current timeframe)
Signal Line (Current timeframe)
MACD Line (Higher timeframe)
Signal Line (Higher timeframe)
Turn off MACD background fills – uncheck:
MACD Background (Current timeframe)
MACD Background (Higher timeframe)
Keep only the following items turned on:
Histogram (Current timeframe)
A/B segment gate lines (Left gate / Right gate)
A/B segment labels
Comparison segment gate lines and label (if you need comparison)
After this, the sub-pane becomes very simple:
Only MACD histogram + segment frames + numeric labels –
everything is serving Chan-style divergence analysis.
3. Core Function Overview
3.1 Automatic accumulation of MACD histogram area
The script accumulates the MACD histogram bar by bar within the selected segment to obtain the total energy area of that segment.
At the same time it records:
Number of histogram bars in the segment
Maximum / minimum value of the MACD histogram within that segment
3.2 Dual-segment comparison: Area A vs Area B
Through the inputs you can set:
A-segment left gate offset / right gate offset
(counted left from the current bar)
B-segment left gate offset / right gate offset
The indicator will draw on the chart:
Two pairs of vertical “gate” lines (for A and B)
An individual area label for A and B
(shown near the top or bottom of the sub-pane to avoid covering the histogram)
3.3 “Area Mode” – three switchable algorithms
In the “Area Mode” dropdown you can choose between three different logics:
(1) Signed Net Force
Positive bars (above zero) are treated as long energy,
Negative bars (below zero) are treated as short energy,
All bars are accumulated with their sign.
Suitable when you want to know:
“Over this whole segment, which side ultimately dominates – bulls or bears?”
(2) Absolute Total Energy
Take the absolute value of each MACD bar, then accumulate.
This reflects the total energy released, regardless of direction.
The label will additionally indicate direction (long / short),
The energy value itself is expressed as a positive number for consistency.
(3) Same-direction Sum (automatic direction detection)
First determine the overall direction of the segment:
If segment end close ≥ segment start close → treated as an up-segment
If segment end close < segment start close → treated as a down-segment
Then:
Up-segment → only accumulate MACD > 0 bars (absolute value),
i.e. main bullish driving energy
Down-segment → only accumulate MACD < 0 bars (absolute value),
i.e. main bearish driving energy
This mode is the closest to Chan theory’s “same-direction force comparison”.
4. Parameter Notes (Chan-related parts)
Only the parameters most relevant to Chan analysis are listed here.
Other color / style options can be customized freely.
4.1 Chan Area – Segment Settings
A Left Gate Offset / A Right Gate Offset
Offsets are defined as:
From the current bar = 0, count bars to the left.
Example:
Left gate = 150, Right gate = 100
→ This means Segment A is from
“150 bars left from the current bar” to “100 bars left from the current bar”.
B Left Gate Offset / B Right Gate Offset
Defined in the same way for Segment B.
All gate positions are locked to specific historical bars.
When new bars appear in the future, the original A/B segments do not move.
This is designed specifically to solve the issue where segments “slide forward in time” as more bars appear.
4.2 Area Mode / Use Absolute Value
Area Mode – switches between the three algorithms described above.
If you only care about:
“Which segment has stronger bearish energy, or which has stronger bullish energy?”
then the recommended modes are:
“Absolute Total Energy” (read the direction hint in the label), or
“Same-direction Sum” mode.
4.3 Label Display & Position
In the inputs you can configure:
Whether to display the A-segment label / B-segment label
Label position in the sub-pane: Top / Bottom / Auto
Inside the script there is additional handling:
It tries to push labels outside the MACD histogram area as much as possible,
so they don’t cover the main price/energy structure.
5. Typical Use Case – Chan-style Divergence
5.1 Determining whether two strokes/segments are divergent
First, using your own Chan framework, identify:
Segment A: the earlier stroke/segment (reference segment)
Segment B: the later stroke/segment (to be checked for divergence)
Then:
Use the gate lines to lock the corresponding MACD histogram segments for A and B.
Set Area Mode to:
“Same-direction Sum”, or
“Absolute Total Energy”.
Compare the energy values of A and B:
If Segment B makes a new high or new low in price,
but its energy area is clearly smaller than Segment A,
then, combined with structure, this can be treated as strong evidence of divergence.
If the area does not shrink (or even expands),
the divergence signal is weak or absent.
5.2 How to read values in uptrends vs downtrends
Bullish segment:
Segment direction is up → the script automatically counts only positive MACD bars (above zero).
The larger the value, the stronger the bullish driving energy.
Bearish segment:
Segment direction is down → the script automatically counts only negative MACD bars (below zero).
The larger the value (in absolute terms), the stronger the bearish driving energy.
Regardless of whether the raw value carries a minus sign,
what really represents the strength is its absolute magnitude.
The label already includes direction text to avoid confusion such as:
“Which is stronger, −8000 or −9000?”
The answer is: |−9000| > |−8000|,
but the label will explicitly tell you whether it is bullish or bearish energy.
6. Notes & Suggestions
This indicator only measures and compares energy,
it does not generate direct buy/sell signals.
It must be used together with:
Your own Chan structure analysis (centers, strokes, segments, trends), and
Other filters (timeframe, price location, timing, etc.).
On instruments with low liquidity, extreme spikes, or bad data,
MACD itself can become distorted.
In such cases, area comparison may also be distorted and should always be cross-checked against the actual candlestick structure.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.