OPEN-SOURCE SCRIPT

Retracement Lattice [JOAT]

395
JOAT Retracement Lattice [JOAT]

Introduction

JOAT Retracement Lattice is an open-source retracement and extension framework designed to turn a confirmed swing into a live working map.

It does more than place Fibonacci levels on a chart.

The script manages swing anchors, highlights the OTE pocket, overlays confirmed higher-timeframe retracement structure, shades premium and discount halves, and evaluates response quality inside the active pocket.

The problem it solves is inconsistency.

Manual retracement drawing is useful, but it can also become subjective very quickly.

Anchors are often moved emotionally.

Higher-timeframe confluence is ignored.

The midpoint is overlooked.

The response inside the retracement is treated as equivalent even when it is not.

Retracement Lattice standardizes the active swing and continuously updates the derived structure.

That creates a cleaner framework for pullback analysis, continuation planning, and location-based decision making.

snapshot

Core Concepts

1. Confirmed Swing Anchor Engine

The lattice begins with a confirmed swing.

Pivot logic and anchor-state management determine which high and low form the active range.

Pine Script®
pivotHigh = ta.pivothigh(high, pivotLen, pivotLen) pivotLow = ta.pivotlow(low, pivotLen, pivotLen)


2. Full Retracement Stack

The script calculates a broad set of retracement and extension levels rather than only the most common ones.

Pine Script®
fib236 = levelAt(0.236) fib382 = levelAt(0.382) fib500 = levelAt(0.500) fib618 = levelAt(0.618) fib705 = levelAt(0.705) fib786 = levelAt(0.786)


3. OTE Pocket Emphasis

The 0.618 to 0.786 region is emphasized as the main response pocket.

4. Higher-Timeframe Confluence

A confirmed higher-timeframe lattice is projected alongside the local one.

5. Premium and Discount Shading

The upper and lower halves of the swing are shaded relative to the midpoint.

6. Extension Objectives

The active swing also provides continuation targets beyond the range.

7. Response Qualification

The script evaluates whether price is reacting constructively inside the active pocket.

8. Chart-Edge Guidance

Labels and projected guide objects keep the live map readable near the right edge of the chart.

snapshot

Features

  • Confirmed anchor-state engine: stable swing selection using pivot confirmation
  • Expanded retracement stack: 0.236, 0.382, 0.500, 0.618, 0.705, and 0.786
  • OTE pocket emphasis: the main response zone is highlighted
  • Extension objectives: continuation levels project beyond the swing
  • Higher-timeframe confluence: confirmed HTF lattice is shown
  • Premium / discount shading: auction halves are visible at a glance
  • Response qualification: pocket interaction is graded instead of assumed
  • Object-managed edge labels: the current range stays readable
  • Dashboard: anchor direction, confluence, and pocket state are summarized


Input Parameters

Swing Anchor:

  • Swing Lookback
  • Pivot Length
  • Reverse Orientation
  • Volume-Validated Pivots
  • Volume Baseline
  • Volume Threshold


Higher Timeframe / Display:

  • Show Higher Timeframe Grid
  • Higher Timeframe
  • Show Classic Retracements
  • Show Minor Levels
  • Show OTE Band
  • Show Extensions
  • Show Dashboard
  • Confluence Tolerance
  • Shade Auction


How to Use This Indicator

Step 1: Identify the active swing anchor pair.

Step 2: Check whether price is trading in premium or discount relative to the midpoint.

Step 3: Focus on the OTE pocket when the broader structure supports it.

Step 4: Compare the local lattice to the confirmed higher-timeframe lattice.

Step 5: Use the extensions to organize continuation targets after response.

Indicator Limitations

  • Anchors settle only after pivot confirmation, which is intentional non-repainting behavior
  • Strong trends can continue without deep retracement into the pocket
  • Confluence improves context but does not force a reaction
  • Retracement tools provide structure, not certainty


Originality Statement

This script is original in how it turns a retracement tool into an active framework with anchor-state management, OTE response logic, premium-discount shading, higher-timeframe confluence, and extension objectives.

The components are unified around one job:

to make pullback location more structured and less subjective.

Disclaimer

This indicator is provided for educational and informational purposes only.

It is not financial advice.

Retracement and extension levels are analytical references and do not guarantee support, resistance, or target completion.

Use risk management and independent judgment at all times.

Best Use Cases

  • Structuring pullback analysis after a confirmed directional swing
  • Comparing local retracement behavior to confirmed higher-timeframe levels
  • Locating the OTE pocket inside a stable swing map
  • Planning continuation targets with extension levels


Interpretation Notes

The midpoint is important because it quickly reveals whether price is trading in the premium or discount half of the current auction.

The OTE pocket is most useful when the broader structural narrative already supports the same directional idea.

Higher-timeframe confluence should be treated as context improvement, not as a guarantee that the level must react.

Publication Notes

This script is intended to be published with a clean chart showing the active anchor, the highlighted OTE pocket, and the higher-timeframe overlap when it exists.

The chart example should make the active swing easy to understand.

Avoid clutter from unrelated studies or excessive drawings.

-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.