PROTECTED SOURCE SCRIPT

BanShen MACD Ultimate[SpeculationLab]

714
This is the Public Edition of the BanShen MACD system — a fully integrated, multi-signal technical analysis toolkit built entirely from scratch.
It combines several advanced modules to help traders identify key entry/exit zones and assess trend momentum in real time.

✅ Core Modules Included:
MACD Divergence Detection
(Supports both basic and consecutive peak detection)
ATR-Based Dynamic Stop Loss Finder
Vegas Tunnel Trend Filter
Engulfing Pattern Recognition
RSI Divergence Signal Module
OBV Divergence Signal Module
FVG (Fair Value Gap) Auto Detection
Smart Signal Table (multi-module summary)
Custom Watermark for chart branding

⭕️ MACD Divergence Detection
To achieve higher accuracy, three key conditions are used:

The peaks and troughs must be clearly shaped.
The two divergence points should show a significant difference.
The divergence must be consecutive, with no interruptions.
The peak size factor filters out weak signals — by default, the peak must exceed 0.1× the histogram’s standard deviation.

The peak size ratio defines the minimum size difference between two peaks. Divergences with insufficient contrast are automatically filtered.

The noise threshold can be adjusted to ignore minor histogram fluctuations. This setting varies by instrument and defaults to 0 (no filtering).

If two or more consecutive divergences occur, this may indicate a strong mid- to long-term setup. These signals are rare but often high-probability. When enabled, a small arrow will mark the signal on the chart.

⭕️ ATR-Based Dynamic Stop Loss Finder
Assists in visualizing adaptive stop-loss levels.
All parameters, including colors, are fully customizable.

⭕️ Vegas Tunnel Trend Filter
A trend filter built with five EMAs (default: 12 / 144 / 169 / 576 / 676).
EMA12 is hidden by default.
All lengths are adjustable, and each line can be shown or hidden individually.
Even beyond Vegas-style strategies, this tool is highly flexible and versatile.

⭕️ Engulfing Pattern Recognition
A bullish engulfing is triggered when a bullish candle closes at or above the previous candle’s high.
A green cross appears below the bar, and the resonance panel lights up multiple signals.

You can change the detection condition from high to close for a looser rule.

A bearish engulfing occurs when the current close is at or below the previous low.
You can also switch the comparison to the previous open for broader detection.

⭕️ RSI & OBV Divergences
Both follow similar logic to MACD divergence.
However, since they are subchart indicators, only one module can be active at a time to avoid visual conflicts.

⭕️ Fair Value Gap (FVG)
FVGs form when price moves sharply in one direction, leaving a visible gap.
Price often returns to these gaps to retest or fill them.
This behavior creates potential entry opportunities near the gap area.

✅ Final Thoughts
This tool is highly modular and customizable.
Traders can selectively activate the modules that best suit their strategy and charting preferences.

**Disclaimer:**
This script is for educational and informational purposes only.
It does not constitute financial advice. Use at your own risk.


这是 BanShen MACD 系统的公开版本 —— 一个完全从零构建的多信号技术分析工具集。
它集成了多个高级模块,帮助交易者实时识别关键的进出场区域和趋势动能。

✅ 核心模块包括:
MACD 背离识别
(支持基本背离与连续背离识别)
基于 ATR 的动态止损定位工具
Vegas 隧道趋势过滤器
吞没形态识别模块
RSI 背离信号模块
OBV 背离信号模块
FVG(公允价值缺口)自动识别与绘制
智能信号面板(多模块信号汇总)
自定义图表水印(用于品牌标识)
⭕️ MACD 背离识别
为了获得更高的识别准确率,系统基于以下三点进行筛选:

波峰与波谷的形状必须清晰明确;
构成背离的两个点之间必须存在明显的高度差;
背离必须是连续的,中间不能被其它峰值干扰。
参数 peak size factor 用于过滤强度不足的波峰,默认要求峰值大于 MACD 柱状图标准差的 0.1 倍。

参数 peak size ratio 限定两个波峰之间的最小比例差,小于该阈值的背离会被自动过滤。

如你希望忽略柱状图中较小的杂音,可以通过 noise threshold 调节,该值基于柱状图的实际高度,适配不同交易品种。默认值为 0,表示不过滤任何杂音。

若出现两次或以上的连续背离,可能代表强烈的中长线机会。此类信号虽少见,但胜率通常较高。当此模式被触发时,图表上会出现小箭头标记。

⭕️ 基于 ATR 的动态止损定位工具
该工具用于辅助显示自适应的止损位置。
所有参数,包括颜色,都可以根据个人偏好自由调整。

⭕️ Vegas 隧道趋势过滤器
本模块由五条可自定义的 EMA 均线组成(默认值为 12 / 144 / 169 / 576 / 676)。
其中 EMA12 默认隐藏。

你可以自由调节每条均线的长度,并控制是否显示。
即使你不使用 Vegas 策略,这个模块也具备非常强的通用性和灵活性。

⭕️ 吞没形态识别
看涨吞没形态:当前阳线的收盘价高于或等于前一根阴线的最高价时成立。
触发后,K线下方会显示绿色叉号,且共振面板会点亮多个信号提示。

你可以将判断条件从“前高”切换为“前收盘”,以放宽判断标准。

看跌吞没:当前收盘价低于或等于前一根阳线的最低价。
同样可选择用“前开盘价”作为参考,以获得更宽松的识别范围。

⭕️ RSI 与 OBV 背离识别
其逻辑与 MACD 背离相似。
但由于 RSI、OBV、MACD 都属于副图指标,不能同时显示,否则会因坐标冲突而显示异常。
因此你只能在三者中选择一个启用。

⭕️ FVG(公允价值缺口)
当价格剧烈朝一个方向冲刺时,K线上会留下一个明显缺口(FVG)。
价格通常会回踩该区域进行测试或补回。
这个行为可以为我们提供潜在的入场机会。

✅ 最后说明
该指标模块化程度高,可高度自定义。
你可以根据自己的策略与偏好,自由启用适合的功能模块。

免责声明:
本脚本仅用于教育和信息参考目的,不构成任何投资建议。
交易存在风险,使用本工具前请自行评估,风险自负。


Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.