OPEN-SOURCE SCRIPT
SMC Post-Analysis Lab [PhenLabs]

📊 SMC Post-Analysis Lab [PhenLabs]
Version: PineScript™ v6
📌 Description
The SMC Post-Analysis Lab is a dedicated hindsight analysis tool built for traders who want to understand what really happened during any historical trading period. Unlike forward-looking indicators, this tool lets you scroll back through time and instantly receive algorithmic classification of market states using Smart Money Concepts methodology.

Whether you’re reviewing a losing trade, studying a successful session, or building your pattern recognition skills, this indicator provides immediate context. The expansion-aware algorithm processes price action within your selected window and outputs clear, actionable classifications ranging from Parabolic Expansion to Consolidation Inducements.
Stop relying on subjective post-trade analysis. Let the algorithm objectively tell you whether institutional players were accumulating, distributing, or running inducements during your trades.
🚀 Points of Innovation
🔧 Core Components
🔥 Key Features
🎨 Visualization
📖 Usage Guidelines
General Configuration
Sliding Window Settings
Date Range Settings
Visual Settings
SMC Parameters
✅ Best Use Cases
⚠️ Limitations
💡 What Makes This Unique
🔬 How It Works
1. Window Definition:
2. Data Collection:
3. State Classification:
4. Output Rendering:
Version: PineScript™ v6
📌 Description
The SMC Post-Analysis Lab is a dedicated hindsight analysis tool built for traders who want to understand what really happened during any historical trading period. Unlike forward-looking indicators, this tool lets you scroll back through time and instantly receive algorithmic classification of market states using Smart Money Concepts methodology.
Whether you’re reviewing a losing trade, studying a successful session, or building your pattern recognition skills, this indicator provides immediate context. The expansion-aware algorithm processes price action within your selected window and outputs clear, actionable classifications ranging from Parabolic Expansion to Consolidation Inducements.
Stop relying on subjective post-trade analysis. Let the algorithm objectively tell you whether institutional players were accumulating, distributing, or running inducements during your trades.
🚀 Points of Innovation
- First indicator specifically designed for SMC-based post-trade review rather than live signal generation
- Dual-mode analysis system allowing both dynamic scrollback and precise date selection
- Expansion-aware classification algorithm that weighs range position against net displacement
- Real-time efficiency metrics calculating directional quality of price movement
- Integrated visual FVG detection within the analysis window only
- Interactive table with clickable date range adjustment via chart interface
🔧 Core Components
- Pivot Detection Engine: Uses configurable pivot length to identify significant swing highs and lows for structure break detection
- Window Calculator: Determines active analysis zone based on either bar offset or timestamp boundaries
- Data Aggregator: Tracks window open, high, low, close and counts bullish/bearish structure break events
- State Classification Algorithm: Applies hierarchical logic to determine market state from six possible classifications
- Visual Renderer: Draws structure breaks, FVG boxes, and window highlighting within the active zone
🔥 Key Features
- Sliding Window Mode: Use the Scroll Back slider to dynamically move your analysis zone backwards through history bar-by-bar
- Date Range Mode: Select specific start and end timestamps for precise session or trade review
- Six Market State Classifications: Parabolic Expansion (Bull/Bear), Bullish/Bearish Order Flow, Accumulation/Distribution Reversal, and Consolidation/Inducement
- Range Position Percentile: See exactly where price closed relative to the window’s high-low range as a percentage
- Bull/Bear Event Counter: Quantified count of structure breaks in each direction during the analysis period
- Efficiency Calculation: Net move divided by total range reveals trending quality versus chop
🎨 Visualization
- Blue Window Highlight: Active analysis zone is clearly marked with blue background shading on the chart
- Structure Break Lines: Dashed lines appear at each bullish or bearish structure break within the window
- FVG Boxes: Fair Value Gaps automatically render as semi-transparent boxes in bullish or bearish colors
- Dashboard Table: Top-right positioned table displays State, Analysis description, and Metrics in real-time
- Color-Coded States: Each classification uses distinct coloring for immediate visual recognition
- Interactive Tip Row: Optional help text guides users on clicking the table to adjust date range
📖 Usage Guidelines
General Configuration
- Analysis Mode: Default is Sliding Window. Choose Date Range for specific timestamp analysis.
Sliding Window Settings
- Scroll Back (Bars): Default 0. Increase to move window backwards into history.
- Window Width (Bars): Default 100. Range 20-50 for scalping, 100+ for swing analysis.
Date Range Settings
- Start Date: Select the beginning timestamp for your analysis period.
- End Date: Select the ending timestamp for your analysis period.
Visual Settings
- Show Help Tip: Default true. Toggle to hide instructional row in dashboard.
- Bullish Color: Default teal. Customize for bullish elements.
- Bearish Color: Default red. Customize for bearish elements.
SMC Parameters
- Pivot Length: Default 5. Lower values (3-5) catch minor breaks. Higher values (10+) focus on major swings.
✅ Best Use Cases
- Post-trade review to understand why entries succeeded or failed
- Session analysis to identify institutional activity patterns
- Trade journaling with objective algorithmic classifications
- Pattern recognition training through historical scrollback
- Identifying whether stop hunts were inducements or legitimate breaks
- Comparing your real-time read versus what the algorithm detected
⚠️ Limitations
- Designed for historical analysis only, not live trade signals
- Classification accuracy depends on appropriate pivot length for the timeframe
- FVG detection uses simple gap logic without mitigation tracking
- State classification is based on window data only, not broader context
- Requires manual scrolling or date input to review different periods
💡 What Makes This Unique
- Purpose-Built for Review: Unlike most indicators focused on live signals, this is designed specifically for post-trade analysis
- Expansion-Aware Logic: Algorithm weighs both position in range AND directional efficiency for accurate state detection
- Interactive Date Control: Click the dashboard table to reveal draggable anchors for window adjustment directly on chart
🔬 How It Works
1. Window Definition:
- User selects either Sliding Window or Date Range mode
- System calculates which bars fall within the active analysis zone
- Active zone receives blue background highlighting
2. Data Collection:
- Algorithm captures window open, running high, running low, and current close
- Structure breaks are detected when price crosses above last pivot high or below last pivot low
- Bullish and bearish events are counted separately
3. State Classification:
- Range Position calculates where close sits as percentage of high-low range
- Efficiency calculates net move divided by total range
- Hierarchical logic applies priority rules from Parabolic states down to Consolidation
4. Output Rendering:
- Dashboard table updates with State title, Analysis description, and Metrics
- Visual elements render within window only to keep chart clean
- Colors reflect bullish, bearish, or neutral classification
💡 Note:
This indicator is intended for educational and review purposes. Use it to develop your understanding of Smart Money Concepts by analyzing what institutional order flow looked like during historical periods. Combine insights with your own analysis methodology for best results.
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.
TradingView Charting w/ Crypto Systems: phenlabs.com
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
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.
TradingView Charting w/ Crypto Systems: phenlabs.com
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
Join our growing community: discord.gg/phen
All content provided by PhenLabs is for informational & educational purposes only. Past performance does not guarantee future results.
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.