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.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.