OPEN-SOURCE SCRIPT

Structure Deviation Ledger [JOAT]

566
Structure Deviation Ledger [JOAT]

Introduction

Structure Deviation Ledger is an open-source structure-tracking overlay designed to monitor how price behaves around a stepped volatility corridor and pivot-derived structure rails. It combines pivot rail continuation, a stateful stepped midpoint, inner and outer ATR corridors, frozen breakout rails, right-edge structural labels, and an optional TP/SL scaffold when confirmed structural displacement occurs.

The purpose of the script is to answer a practical question: is price still behaving inside accepted structure, or has it displaced far enough to qualify as a meaningful structural event? By scoring deviation relative to a stepped corridor and confirmed pivot rails, the indicator provides a cleaner framework for continuation and failure analysis than simple moving-average crossovers.

snapshot

Core Concepts

1. Pivot-Derived Structure Rails

Confirmed pivot highs and lows are connected into forward rails. These rails act as the nearest structural references for continuation or failure.

2. Stepped ATR Corridor

The script maintains a stepped midpoint derived from a smoothed basis and ATR logic. The midpoint only reanchors when price stretches far enough to justify a structural adjustment.

3. Confirmed Structural Breaks

A structural break is only promoted when price closes beyond the relevant active rail and also pushes outside the inner corridor. This confirmation rule is designed to reduce weak intrabar noise.

4. Frozen Break Rails

When a fresh break is confirmed, the script freezes a breakout rail and a related context box so the chart retains forward reference after the initial event.

5. Execution Scaffold

On fresh structural expansion or structural pressure events, the indicator can build an informational TP/SL ladder using ATR-based stop distance and configurable R multiples.

Features

  • Pivot structure rails: Forward-projected high and low rails derived from confirmed pivots
  • Stepped structure midpoint: State-aware corridor center that does not update every bar like a normal average
  • Inner and outer ATR corridors: Layered bands for contained vs displaced price behavior
  • Fresh break detection: Confirmed-bar breakout logic for upside and downside structural events
  • Frozen break rails and zones: Persistent post-break context on the chart
  • Right-edge labels: Live labels for midpoint, inner levels, and active rail reference
  • Optional TP/SL ladder: Entry, stop, TP1, TP2, TP3 with risk/reward fill
  • Top-right dashboard: Displays current structural state, deviation, corridor levels, and rail count


How to Use This Indicator

Step 1: Read whether price is inside the corridor or displacing beyond it.

Step 2: Compare price to the active high or low rail. These are the nearest structure references.

Step 3: When a fresh confirmed break appears, use the frozen rail and optional ladder as a planning map, not as a guarantee.

Step 4: If price returns back through the corridor after a break, treat that as a sign of failed displacement.

Indicator Limitations

  • Pivot rails are naturally delayed because pivots require confirmed bars on both sides
  • Stepped corridors intentionally lag during transitions in order to avoid unstable shifting
  • A dense market with many pivots can still generate frequent rail updates
  • The TP/SL ladder is informational only and does not place orders


Originality Statement

Structure Deviation Ledger is original in the way it merges pivot-derived structural rails, a stepped ATR corridor, frozen breakout context, and execution scaffolding into a single open-source structure overlay. Its goal is to provide a reusable institutional structure map rather than a simplified breakout marker.

Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice. Structural breaks and corridor deviations are derived from historical price action and do not guarantee future movement. Always use appropriate risk controls.

-Made with passion by jackofalltrades

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.