OPEN-SOURCE SCRIPT

Liquidity Structure & Sweeps [Visualized]

184
Liquidity Structure & Sweeps [Visualized] | 流动性结构与猎杀 [可视化版]
1. Design Philosophy & Logic

This indicator is designed based on Smart Money Concepts (SMC) and Market Microstructure principles. Unlike traditional indicators that rely on lagging averages or repainting fractals, this script focuses on "Objective Structure" and "Liquidity Grabs".

The core design philosophy rests on three pillars:

Zero Repainting (Real-time Integrity): We utilize a strict "Left-Side Confirmation" algorithm. A structure level is only stored in memory when the candle is fully closed (barstate.isconfirmed). This ensures that the historical signals you see are exactly what happened in real-time.

Institutional Memory (Visualized): Markets "remember" key levels. This script draws dashed lines extending from valid pivot points. These lines represent "resting liquidity" (Stop Orders). They remain on the chart until the price interacts with them.

Sweep vs. Breakout: Not all breaches are equal. We specifically look for "Sweeps" (Liquidity Grabs) — where price pierces a level but closes back inside. This is a classic sign of absorption and potential reversal, distinct from a structural breakout.

2. Key Features

Visualized Order Blocks: Automatically draws potential support (Green Dotted) and resistance (Red Dotted) lines based on fractal points.

Wick Detection: Filters out strong momentum breakouts. Signals are only generated when a specific "Wick Ratio" is met, indicating a rejection.

Clean Charts: Features a "Garbage Collection" mechanism. Once a level is swept, the line is removed, and a signal dot is placed. Old, untouched levels are automatically cycled out to prevent chart clutter.

3. How to Use

The Lines (Context):

Red Dotted Line: Buy-side Liquidity (Resistance). Expect potential shorts or breakouts here.

Green Dotted Line: Sell-side Liquidity (Support). Expect potential longs or breakdowns here.

The Signals (Action):

Red Dot (Bearish Sweep): Price spiked above a Resistance Line but closed below it. This suggests long stops were hunted, and bears are stepping in.

Green Dot (Bullish Sweep): Price spiked below a Support Line but closed above it. This suggests short stops were hunted, and bulls are stepping in.

Configuration:

Structure Length: Adjusts sensitivity. Higher values (e.g., 20-50) find major swing points; lower values (e.g., 5-10) find scalping setups.

Wick Filter %: The minimum size of the wick relative to the breakout. Increase this to filter for only the most dramatic rejections.

4. Developer Notes & Considerations

Why do lines disappear? In this logic, liquidity is treated as "Fuel". Once a level is swept (the stop orders are triggered), the fuel is consumed. Keeping the line would clutter the chart with invalid data.

Why is the dot small? The indicator is designed to be part of a toolchain, not a standalone signal. The minimalist design prevents visual interference with price action or other indicators.

1. 设计思路与核心逻辑

本指标基于 聪明钱概念 (SMC) 与 市场微观结构 原理设计。不同于依赖滞后均线或存在重绘问题的传统分形指标,本脚本专注于捕捉 “客观结构” 与 “流动性猎杀 (Liquidity Grabs)”。

核心设计哲学包含三大支柱:

零重绘 (Zero Repainting): 我们采用了严格的“左侧确认”算法。所有的结构位仅在K线完全收盘 (barstate.isconfirmed) 后才会被记录。这保证了您回测看到的信号与实盘完全一致,杜绝“未来函数”陷阱。

可视化的机构记忆: 市场是有记忆的。本脚本会从有效的波段高低点引出虚线。这些虚线代表了“沉睡的流动性”(止损盘聚集区)。它们会一直延伸,直到价格触碰它们。

区分“猎杀”与“突破”: 并不是所有的破位都是一样的。我们专注于识别“扫损(Sweep)”——即价格刺破了关键位,但收盘价收回了关键位内部。这是典型的吸筹或派发信号,与趋势延续的真突破有本质区别。

2. 主要功能

结构可视化: 自动基于分形点绘制潜在的支撑线(绿色虚线)和阻力线(红色虚线)。

插针检测: 过滤掉强势的实体突破。只有当价格出现明显的“长影线”拒绝行为时,才会触发信号。

图表自清洁: 内置“垃圾回收”机制。一旦某个关键位的流动性被猎杀(触发信号),该线条会被自动删除。过旧且未被触碰的线条也会被自动替换,保持图表整洁。

3. 使用指南

线条 (市场语境):

红色虚线: 买方流动性池(阻力位)。

绿色虚线: 卖方流动性池(支撑位)。

信号点 (交易动作):

红色圆点 (看跌猎杀): 价格刺破了红色阻力线,但收盘价回落到线下方。这暗示多头止损被触发,主力可能正在建立空单。

绿色圆点 (看涨猎杀): 价格刺破了绿色支撑线,但收盘价反弹到线上方。这暗示空头止损被触发,主力可能正在建立多单。

参数设置建议:

Structure Length (结构周期): 调整灵敏度。数值越大(如 20-50)锁定大级别波段;数值越小(如 5-10)适合短线剥头皮。

Wick Filter % (影线过滤): 设置影线占价格波动的最小比例。调大该数值可以只看最剧烈的反转信号。

4. 开发者注记与潜在考量

为什么线条会消失? 在本逻辑中,流动性被视为“燃料”。一旦发生猎杀(止损单成交),该位置的燃料即被消耗。移除线条是为了防止无效数据干扰判断。

为什么圆点设计得很小? 该指标旨在成为您交易工具链的一部分,而非唯一的决策依据。极简设计是为了避免干扰裸K形态或其他指标的观察。

===============================================================
这个脚本(我们称之为 Liq Structure Script)本质上是一个基于价格行为(Price Action)的结构猎杀探测器。

以下是详细的深度对比分析:

1. 如何使用? (实战操作手册)

不要把它当作“红灯停绿灯行”的傻瓜指标。把它当作一个**“战场地图”**。

第一阶段:观察结构 (The Setup)

图表上会自动画出 红色虚线(上方压力)和 绿色虚线(下方支撑)。

解读:告诉自己,“这里埋着很多人的止损单”。不要在这里盲目追涨杀跌。

第二阶段:等待猎杀 (The Trigger)

耐心等待价格冲向这些虚线。

关键动作:价格刺破虚线,然后迅速收回。

信号确认:虚线消失,留下一个 红点(顶部猎杀)或 绿点(底部猎杀)。

第三阶段:进场逻辑 (The Execution)

做空逻辑:出现红点 + K线留长上影线 → 说明多头试图突破失败,被主力“倒了一盆冷水”。此时可尝试做空,止损设在刚刚那个最高点上方一点点。

做多逻辑:出现绿点 + K线留长下影线 → 说明空头试图砸盘失败,被主力接住了。

传统爆量是“燃料”,Liq 脚本是“引爆点”。没有引爆点的爆量可能是空转;没有爆量的引爆点可能是假摔。Liq 脚本是一个免费、轻量级、基于K线逻辑的替代品。它不需要你买昂贵的数据服务,它利用的是“图表形态学”中的流动性共识。
结论:如何定位这个工具?

这个脚本不是“预测未来的水晶球”,而是一个**“高胜率区域提示器”**。

用它来找位置(哪里有陷阱?)。

用成交量来做确认(是不是真的有主力介入?)。

用宏观逻辑来定方向(现在该做多还是做空?)。

它是你交易工具链中负责**“微观入场时机(Timing)”**的那一环。

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.