PINE LIBRARY
FootprintCore

ExperimentaL WIP
The FootprintCore library is a Pine Script v6 toolset designed for deep analysis of order flow and footprint data. It provides structured data types and functions to extract, normalize, and interpret footprint features to identify market breakouts and execution regimes.
Core Data Types
FPBar: Captures raw footprint metrics including volume (total, buy, sell), Delta, POC/Value Area levels, and imbalance stack counts.
FPNorm: Stores normalized versions of key features, primarily using Z-Scores and Percentile Ranks to compare current activity against historical lookbacks.
FPDerived: Holds high-level interpretations such as "Stack Dominance," "Bullish Acceptance," and "Auction Failures".
FPSignal & FPExec: Define trade triggers and execution states (e.g., passive, caution, or avoid) based on current volatility and liquidity.
How to Use the Library
1. Feature Extraction
Use extractBar() to convert a footprint object into a structured FPBar type. You must provide price context (close, high, low) and an ATR value for normalization.
Pine Script
fp_data = footprint.get()
bar_features = FootprintCore.extractBar(fp_data, prevPoc, close, high, low, ta.atr(14))
2. Normalization
Pass the FPBar into normalizeBar() to calculate Z-Scores and Ranks for features like Value Area width and Delta efficiency.
Pine Script
norm_features = FootprintCore.normalizeBar(bar_features, 20, 100)
3. Generating Signals
The breakoutSignal() function identifies high-probability trade setups. It checks for:
Bullish/Bearish Acceptance: Price breaking out of the Value Area with positive/negative Delta.
+1
Stack Dominance: Presence of imbalance stacks (e.g., more than 3 buy stacks).
Efficiency: Delta efficiency and range compression requirements.
+1
4. Execution Governance
Before placing a trade, use executionState() to assess the "stress" of the current market.
ExecMode.avoid: Triggered when slippage proxies or fragility scores (based on Z-Scores) are too high.
+1
noTrade: A boolean flag that becomes true if footprint data is missing or the market structure is unstable.
5. Diagnostic Reason Codes
For debugging or logging, reasonCodeBreakout() returns a machine-readable string (e.g., "ACC|STACK|EFF|") indicating which specific conditions were met for a signal.
Thư viện Pine
Theo đúng tinh thần TradingView, tác giả đã công bố mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác trong cộng đồng có thể tái sử dụng. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này cho mục đích cá nhân hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc tái sử dụng mã này trong các ấn phẩ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.
Thư viện Pine
Theo đúng tinh thần TradingView, tác giả đã công bố mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác trong cộng đồng có thể tái sử dụng. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này cho mục đích cá nhân hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc tái sử dụng mã này trong các ấn phẩ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.