gannSquareFixed

Draws a Gann Square (fixed) using two anchors. It locks time and price into a 1:1 grid from your points, so you can watch how price reacts at proportional time/price divisions (great for rhythm, pauses, continuations).

Syntax (one line)

gannSquareFixed(originPoint, targetPoint, styles?)

Parameters

originPoint (PricedData) · First anchor (time & price) where the square begins. Example: newPoint(time(80), high(80)). targetPoint (PricedData) · Second anchor that sets the square’s size and direction. Example: newPoint(time(20), low(20)). styles (GannSquareFixedStyleOverrides) · Visual setup and divisions:

  • fillBackground (boolean) · Fill the square’s background.

  • transparency (number) · Background transparency (0–100).

  • showLabels (boolean) · Show ratio labels on grid lines.

  • priceLevels (number[]) · Horizontal ratios (e.g., [0.125, 0.25, 0.5, 1]).

  • timeLevels (number[]) · Vertical ratios (e.g., [0.125, 0.25, 0.5, 1]).

  • grid (LinesLevels without coeff) · Default grid line look (linestyle, linewidth, color).

  • border (LinesLevels without coeff) · Box border line look (linestyle, linewidth, color).

Return Value

(string) · The drawing ID of the created Gann Square (handy if you’ll update/remove it later).

Example

Small demo: every 44 candles we drop a fixed Gann square from an older high toward a newer low, label a few simple divisions, and keep a soft background.

Tips

  • Start with simple divisions (1/8, 1/4, 1/2, 1). Less clutter = easier reads.

  • If your timeframe is fast, widen the span between anchors so the grid breathes.

  • Combine with a moving average or trend filter to focus on trending phases.

Warning

  • Don’t mix types: originPoint/targetPoint must be PricedData (time & price). Passing raw time() or high() directly will fail—wrap them with newPoint(...).

Good Practice

  • Keep all styles in a single const style so you can reuse across tests and ensure consistent backtests.

  • Align anchors with meaningful swings (e.g., rally base to recent high) so the time/price divisions match real market structure.

Last updated