Cheatcode ATR GridOverview
This indicator projects a dynamic ATR-based price grid onto the chart. It calculates Average True Range from the visible bar range rather than a fixed lookback, so the grid adapts naturally as you zoom in and out. The anchor price is quantized to the nearest "snap unit," which eliminates constant micro-repositioning and keeps the grid stable while still following meaningful price moves.
How It Works
The indicator maintains a rolling buffer of True Range values (up to 500 bars). On each new bar, it slices only the bars currently visible on screen and averages their True Range values to produce a viewport-aware ATR. The anchor price is then rounded to the nearest multiple of Snap Boundary × ATR, and grid lines are projected above and below at intervals of ATR Step Multiplier × ATR.
An ATR arrow annotation is drawn to the right of price, spanning exactly one grid step, with its current value labeled — so the size of each band is always visible at a glance.
Inputs
Grid Levels — Number of ATR bands above and below the anchor (1–10). Default: 3.
ATR Step Multiplier — Spacing between bands as a multiple of ATR. Default: 1.0.
Snap Boundary (ATR×) — How large a price move must be before the grid re-anchors. Lower values = more reactive; higher values = more stable. Default: 1.0.
Lock to Confirmed Close — When enabled, both the anchor price and ATR update only on confirmed closed bars. The live candle is excluded entirely, making the grid completely static until the next bar opens. Default: off.
Show Anchor Line — Toggle visibility of the center anchor line. Default: on.
Line Color / Width / Style — Full control over the visual appearance of all grid lines.
Use Cases
Identifying potential reaction zones based on ATR-proportional spacing
Structuring take-profit or stop-loss targets at consistent volatility intervals
Spotting compression or expansion by observing price behavior relative to band width
Scalping or swing setups where quantized price levels add context to entries
Notes
Works on all timeframes and all instruments
All drawings are rendered exclusively on the last bar for performance efficiency
The viewport ATR updates in real time as you pan or zoom the chart
The indicator is overlay-only and does not repaint confirmed levels when "Lock to Confirmed Close" is enabled
Penunjuk Pine Script®






















