OPEN-SOURCE SCRIPT
CSS Reversal - VA

This indicator identifies a price action reversal pattern known as CSS (Candle Stop Setup). Unlike standard 3-candle patterns, this logic is dynamic and "hunts" for the true peak or valley before confirming a shift in momentum.
Core Logic & Rules
The script follows a specific sequence of "Initiation, Waiting, and Triggering" to ensure it captures high-probability reversals:
1. Initiation (The Sweep): The process starts when a candle (the Pivot) sweeps the liquidity of the previous candle.
Bearish: Candle 2 makes a higher high than Candle 1.
Bullish: Candle 2 makes a lower low than Candle 1.
2. Identifying the Extreme: The script tracks the absolute highest high (for bearish) or lowest low (for bullish) during the setup. If a subsequent candle goes higher/lower without triggering a close, the "mark" moves to that new extreme candle.
3. The Waiting Room (Inside Bars): The setup remains active even if several candles follow that do not break out of the Pivot's range. The script can wait indefinitely (e.g., 3, 4, or 5+ candles) as long as the original extreme is not breached.
4. The Trigger (The Confirmation): A signal is only confirmed when a candle closes past the opposite side of the extreme candle's body.
Bearish Trigger: A candle closes below the Low of the highest candle.
Bullish Trigger: A candle closes above the High of the lowest candle.
5. Retrospective Marking: Once the trigger close occurs, the script automatically places a visual marker (arrow) on the actual extreme candle (the peak or valley), even if that candle occurred several bars ago.
Visual Indicators
Red Arrow (↓): Placed at the high of the highest candle in a confirmed bearish reversal.
Green Arrow (↑): Placed at the low of the lowest candle in a confirmed bullish reversal.
Use Cases
This script is designed for traders who look for Liquidity Sweeps and Market Structure Shifts. It filters out "fake" reversals where price merely wicks past a level without a solid closing confirmation, and it specifically accounts for "inside bar" periods where price consolidates before making its move.
Core Logic & Rules
The script follows a specific sequence of "Initiation, Waiting, and Triggering" to ensure it captures high-probability reversals:
1. Initiation (The Sweep): The process starts when a candle (the Pivot) sweeps the liquidity of the previous candle.
Bearish: Candle 2 makes a higher high than Candle 1.
Bullish: Candle 2 makes a lower low than Candle 1.
2. Identifying the Extreme: The script tracks the absolute highest high (for bearish) or lowest low (for bullish) during the setup. If a subsequent candle goes higher/lower without triggering a close, the "mark" moves to that new extreme candle.
3. The Waiting Room (Inside Bars): The setup remains active even if several candles follow that do not break out of the Pivot's range. The script can wait indefinitely (e.g., 3, 4, or 5+ candles) as long as the original extreme is not breached.
4. The Trigger (The Confirmation): A signal is only confirmed when a candle closes past the opposite side of the extreme candle's body.
Bearish Trigger: A candle closes below the Low of the highest candle.
Bullish Trigger: A candle closes above the High of the lowest candle.
5. Retrospective Marking: Once the trigger close occurs, the script automatically places a visual marker (arrow) on the actual extreme candle (the peak or valley), even if that candle occurred several bars ago.
Visual Indicators
Red Arrow (↓): Placed at the high of the highest candle in a confirmed bearish reversal.
Green Arrow (↑): Placed at the low of the lowest candle in a confirmed bullish reversal.
Use Cases
This script is designed for traders who look for Liquidity Sweeps and Market Structure Shifts. It filters out "fake" reversals where price merely wicks past a level without a solid closing confirmation, and it specifically accounts for "inside bar" periods where price consolidates before making its move.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
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ã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
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.