OPEN-SOURCE SCRIPT
更新済 Grid System + Gann Diamond

This Pine Script v6 indicator, titled "Grid System + Gann Diamond", is a customizable geometric overlay tool heavily inspired by W.D. Gann's principles — particularly price-time squaring, diagonal angle projections (Gann-style angles), and grid-based subdivisions within a defined range.It identifies a historical lookback range (from a user-defined anchor time to the present) and calculates:
High (HH), Low (LL), and Midpoint of that range
A central vertical line at the time midpoint (t/2)
Main horizontal levels (top/mid/bottom)
Diagonal lines (upper/lower) radiating from the midpoint, creating a diamond-like geometric structure
Forward projections (rays) of key diagonals beyond the current bar
Optional interior grid (equal spacing or Fibonacci ratios)
Propagated/additional diagonals from midpoints, endpoints, or quarter points (¼ & ¾) along the horizontals
Current-bar vertical connections (high → mid, low → mid)
The result visually resembles a "Gann Diamond" (or extended Gann square/angle fan concept) — a geometric framework where price and time relationships are highlighted to reveal potential support/resistance, trend strength, or reversal zones when price interacts with the lines.
Key features include:
Anchor point selection (drag the time input)
Option to only draw on the last bar (cleaner chart)
Toggle for forward rays, full projected box, interior grid, quarter diagonals, etc.
Custom colors, widths, and line styles
Main Use Cases in Trading:
Geometric Support / Resistance Identification
The horizontal levels + grid lines act as static S/R zones.
Propagated diagonals and forward projections serve as dynamic future S/R lines (price often reacts when touching or crossing them).
Gann-style Angle / Trend Analysis
The main diagonals (and their forward extensions) represent Gann-like angles.
Traders watch whether price stays above/below certain diagonals to gauge trend strength (similar to classic 1×1, 2×1 angle behavior).
Range / Cycle Projection & Exhaustion Zones
The diamond/box structure helps visualize when price and time may be "squaring out" (a core Gann concept).
Useful near the right edge or projected forward area to anticipate potential reversals or acceleration.
Confluence Tool
Combine with price action, volume, other indicators (e.g. Fibonacci, pivot points, supply/demand zones).
Reactions at grid lines + diagonal crossings + quarter points often give higher-probability setups.
Swing / Range Trading Context
Very helpful on higher timeframes (4H–Daily–Weekly) to frame the larger structure after a clear swing high/low.
The anchor time can be set to major pivots, news events, cycle starts, etc.
High (HH), Low (LL), and Midpoint of that range
A central vertical line at the time midpoint (t/2)
Main horizontal levels (top/mid/bottom)
Diagonal lines (upper/lower) radiating from the midpoint, creating a diamond-like geometric structure
Forward projections (rays) of key diagonals beyond the current bar
Optional interior grid (equal spacing or Fibonacci ratios)
Propagated/additional diagonals from midpoints, endpoints, or quarter points (¼ & ¾) along the horizontals
Current-bar vertical connections (high → mid, low → mid)
The result visually resembles a "Gann Diamond" (or extended Gann square/angle fan concept) — a geometric framework where price and time relationships are highlighted to reveal potential support/resistance, trend strength, or reversal zones when price interacts with the lines.
Key features include:
Anchor point selection (drag the time input)
Option to only draw on the last bar (cleaner chart)
Toggle for forward rays, full projected box, interior grid, quarter diagonals, etc.
Custom colors, widths, and line styles
Main Use Cases in Trading:
Geometric Support / Resistance Identification
The horizontal levels + grid lines act as static S/R zones.
Propagated diagonals and forward projections serve as dynamic future S/R lines (price often reacts when touching or crossing them).
Gann-style Angle / Trend Analysis
The main diagonals (and their forward extensions) represent Gann-like angles.
Traders watch whether price stays above/below certain diagonals to gauge trend strength (similar to classic 1×1, 2×1 angle behavior).
Range / Cycle Projection & Exhaustion Zones
The diamond/box structure helps visualize when price and time may be "squaring out" (a core Gann concept).
Useful near the right edge or projected forward area to anticipate potential reversals or acceleration.
Confluence Tool
Combine with price action, volume, other indicators (e.g. Fibonacci, pivot points, supply/demand zones).
Reactions at grid lines + diagonal crossings + quarter points often give higher-probability setups.
Swing / Range Trading Context
Very helpful on higher timeframes (4H–Daily–Weekly) to frame the larger structure after a clear swing high/low.
The anchor time can be set to major pivots, news events, cycle starts, etc.
リリースノート
fixed some messy code that caused lines to duplicate....リリースノート
fixed arrays... still had some lines doubling over time. should be good now.リリースノート
reconfigured for 2 choices - random and fixed. Fixed mode divides the range using the high/low of a user selectable in bars lookback period or using Random mode uses a draggable anchor-defined range. This then prints and locks the diamond grid until either the time range is reselected or new highs/lows are hit. If new highs/lows are hit the time range will hold but the vertical will readjust. Pricing will now travel through the grid which I feel is more optimum.リリースノート
added a few lines of code to prevent any double printing of lines...オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。