Vesper Structure Ledger: Open-Source Pine Script for Market Structure
A comprehensive open-source indicator for Pine v6 that automates market structure mapping using KAMA, BOS/CHoCH logic, and liquidity sweeps. It provides algorithmic traders with modular code for identifying trend efficiency, price pivots, and supply/demand zones.
Strategy Decoder Editorial · · 4 min read
Key takeaways
- Vesper Structure Ledger is an open-source Pine v6 indicator designed to automate the identification and visualization of market structure.
- It integrates an adaptive KAMA trend core, pivot-based Break of Structure (BOS) and Change of Character (CHoCH) events, and liquidity sweep detection.
- The tool helps distinguish trend continuation from potential reversals, providing context through BOS counts and marking important liquidity zones.
- It offers features like dynamic demand/supply zones, premium/discount mapping, and a dashboard for a comprehensive view of market dynamics.
- Users can leverage this indicator for refining entry/exit points, validating structural hypotheses, and enhancing algorithmic strategy development on TradingView.
Market structure analysis is a cornerstone of many trading strategies, yet its manual application can be subjective and time-consuming. For algorithmic and quantitative traders, the consistency and speed of automated structure identification are invaluable. In this context, an open-source indicator named Vesper Structure Ledger, developed by officialjackofalltrades and available on TradingView, offers a comprehensive solution for deciphering market dynamics.
This Pine v6-based tool aims to simplify market structure interpretation by integrating several key analytical components into a cohesive framework. Its design focuses on providing clear, automated insights without the visual clutter often associated with multiple overlapping indicators, making it particularly useful for automated systems that rely on precise structural signals.
The Core Mechanics of Vesper Structure Ledger
The Vesper Structure Ledger is built upon several fundamental concepts that contribute to its robust market structure mapping capabilities:
Adaptive KAMA Trend Core
Central to the indicator's trend analysis is the Kaufman's Adaptive Moving Average (KAMA) engine. KAMA is known for its ability to adjust its smoothing period based on market efficiency. When price movements are strong and directional (efficient), KAMA responds more quickly, providing timely trend signals. Conversely, during choppy or sideways markets, it slows down, effectively filtering out noise and reducing false signals or 'whipsaws'. This adaptive nature is crucial for algos seeking to align with prevailing market conditions.
Pivot Structure Memory and Events
The indicator establishes structural references by identifying and storing confirmed pivot highs and lows. These pivots act as crucial boundaries, and their penetration triggers significant market events. The logic here is straightforward: a confirmed close beyond these structural rails leads to either a Break of Structure (BOS) or a Change of Character (CHoCH).
Distinguishing BOS from CHoCH
One of the most important differentiations made by Vesper Structure Ledger is between BOS and CHoCH events:
- Break of Structure (BOS): This confirms the continuation of the existing structural trend. For example, in an uptrend, a higher high following a pull-back would be a BOS, signaling sustained bullish momentum.
- Change of Character (CHoCH): This event marks a break against the prevailing structural direction, often serving as an early alert for a potential trend reversal or significant shift in market sentiment. The indicator also incorporates a 'BOS-count gating' feature, which means that a certain number of BOS events might occur before a CHoCH is given more weight, suggesting that true reversals need to overcome established momentum.
Liquidity Sweeps and Equal Levels
For algorithmic traders, understanding liquidity is paramount. The Vesper Structure Ledger identifies two key liquidity patterns:
- Liquidity Sweeps: These occur when price briefly moves beyond a significant swing level (often a previous high or low) but then closes back within its prior range. This 'wick-and-reclaim' action can indicate the trapping of participants who traded the break, potentially leading to a sharp reversal or move in the opposite direction.
- Equal High/Low Probes: These highlight instances where price approaches and tests similar liquidity levels multiple times, suggesting areas where significant orders might be resting, or where market participants are actively defending/attacking a price point.
Demand/Supply Zones and Managed Structure Map
The indicator generates demand and supply zones based on qualified structural signals. These zones are not meant as automatic trade triggers but as contextual references for potential support or resistance. Alongside these, a managed visual box provides entry, invalidation, and target levels, aiding in the planning and contextualization of trades. Right-side structural rails also dynamically label key levels such as KAMA, swing highs/lows, and equilibrium points.
Practical Application for Algo Traders
For those developing quantitative trading strategies, the Vesper Structure Ledger offers a multi-faceted approach to market analysis:
1. Trend Context Integration: The adaptive KAMA line can serve as a robust filter for strategies, ensuring trades are initiated in alignment with the prevailing trend, or providing clear signals when the trend is shifting or consolidating. 2. Automated Structure Identification: The precise detection of BOS and CHoCH events can be directly integrated into trading algorithms. BOS signals can reinforce trend-following strategies, while CHoCH can trigger reversal strategies or risk management adjustments. 3. Liquidity-Driven Insights: Automating the detection of liquidity sweeps and equal levels allows algorithms to anticipate potential price reactions around these zones, which can be critical for optimizing entry and exit points, or for identifying stop-hunt scenarios. 4. Dynamic Zone Generation: The automatically plotted demand and supply zones can be incorporated into algorithms for dynamic target setting, identifying potential areas for profit-taking, or determining support/resistance levels for re-entry. 5. Dashboard for State Management: The top-right dashboard, displaying information like trend, KAMA slope, BOS count, and sweep status, provides a concise summary of the market's current structural state. This can be fed into a strategy's decision-making logic for comprehensive context.
Why it matters for algo traders
The Vesper Structure Ledger is a significant open-source contribution for algorithmic and quantitative traders primarily because it externalizes complex market structure analysis into a quantifiable and automatable format. Instead of relying on discretionary visual interpretation, algo traders can programmatically access signals for trend changes, continuation, and liquidity dynamics. This allows for more robust backtesting of strategies built around market structure principles, enabling the rapid development and refinement of rule-based systems. It helps in defining clear objective conditions for trade initiation, management, and exit, reducing ambiguity and enhancing the consistency of automated trading operations. The modularity of its features means that specific components, such as KAMA trend filtering or liquidity sweep detection, can be selectively integrated into various algorithmic frameworks, promoting flexibility in strategy design.
Tags: pine-script, market-structure, technical-indicators, liquidity-sweeps, open-source-trading
Based on reporting by news.google.com.