Illustrative Pattern Detector

Overview
This Pine Script v6 indicator visualizes a linear-regression channel and highlights potential consolidation zones using range, ATR, and volume criteria. It also computes an estimated up/down volume imbalance (derived from OHLC/volume, not tick-level order flow) to annotate zones with possible footprint markers. It’s intended for chart study and illustration.
How It Works
• Regression Channel: The midline uses ta.linreg over a user-selected lookback (default 100 bars). Upper/lower bands are ±(deviation × multiplier) using ta.stdev. Midline/bands can be colored by a simple trend heuristic (pivot highs/lows and recent slope).
• Consolidation Zones: A zone is “tight” when the price range over a window (default 20 bars) is small relative to ATR (multiplier 1.5) and the window’s average volume exceeds a longer lookback average (5× the box length, multiplier 1.5).
• Estimated Imbalance (Heuristic): Volume in each bar is apportioned to “up”/“down” using the bar’s position within its high-low range. The cumulative difference over the zone is compared to a threshold (default 2.0 × ATR × window). This is a proxy signal—not true bid/ask delta—and is used only to annotate zones that already meet the consolidation criteria.
Key Features
• Regression Channel: Midline with deviation bands; optional trend-based coloring.
• Consolidation Detection: Tight-range + elevated-volume zones using ATR and moving averages.
• Heuristic Footprint Markers: Optional labels when the estimated imbalance exceeds a user threshold.
• Customizable Visuals: Toggle channels, boxes, labels; choose colors and lookbacks.
What It Displays
The script overlays a regression channel and, when conditions are met, draws boxes around recent tight-range, higher-volume areas. If the heuristic imbalance exceeds the threshold, a label is added to the box for study purposes.
Originality
Built in Pine v6 using TradingView built-ins: ta.linreg, ta.stdev, ta.highest, ta.lowest, ta.atr, ta.sma.
Configuration Notes
Adjust channel lookback (default 100) and deviation multiplier (default 2.0). For zones, set the box length (default 20), ATR multiplier (1.5), volume multiplier (1.5), and imbalance threshold (2.0). Enable/disable labels and color modes as desired.
Important Notes
This indicator uses a heuristic approximation of imbalance from OHLC/volume and does not measure real order-flow or tick-by-tick delta. It is intended for educational/chart-illustration use only.
Legal Disclaimer
For informational and educational purposes only—not investment, financial, or trading advice. Past performance does not guarantee future results. Trading involves risk of loss. Provided “as is” without warranties. Consider consulting a qualified professional.
สคริปต์แบบเฉพาะผู้ได้รับเชิญเท่านั้น
เฉพาะผู้ใช้ที่ได้รับการอนุมัติจากผู้เขียนเท่านั้นที่สามารถเข้าถึงสคริปต์นี้ได้ คุณจะต้องร้องขอและได้รับอนุญาตก่อนจึงจะสามารถใช้งานได้ โดยปกติจะได้รับอนุญาตหลังจากชำระเงินแล้ว สำหรับรายละเอียดเพิ่มเติม ทำตามคำแนะนำของผู้เขียนด้านล่างหรือติดต่อ TradingScriptSolutions โดยตรง
TradingView ไม่แนะนำให้ชำระเงินหรือใช้สคริปต์ เว้นแต่ว่าคุณจะเชื่อถือผู้เขียนสคริปต์และเข้าใจวิธีการทำงานของมัน คุณยังอาจพบทางเลือกของโอเพนซอร์ส แบบฟรีในสคริปต์ชุมชนของเรา
คำแนะนำของผู้เขียน
คำจำกัดสิทธิ์ความรับผิดชอบ
สคริปต์แบบเฉพาะผู้ได้รับเชิญเท่านั้น
เฉพาะผู้ใช้ที่ได้รับการอนุมัติจากผู้เขียนเท่านั้นที่สามารถเข้าถึงสคริปต์นี้ได้ คุณจะต้องร้องขอและได้รับอนุญาตก่อนจึงจะสามารถใช้งานได้ โดยปกติจะได้รับอนุญาตหลังจากชำระเงินแล้ว สำหรับรายละเอียดเพิ่มเติม ทำตามคำแนะนำของผู้เขียนด้านล่างหรือติดต่อ TradingScriptSolutions โดยตรง
TradingView ไม่แนะนำให้ชำระเงินหรือใช้สคริปต์ เว้นแต่ว่าคุณจะเชื่อถือผู้เขียนสคริปต์และเข้าใจวิธีการทำงานของมัน คุณยังอาจพบทางเลือกของโอเพนซอร์ส แบบฟรีในสคริปต์ชุมชนของเรา