OPEN-SOURCE SCRIPT

Fractal Market Geometry [JOAT]

109

Fractal Market Geometry [JOAT]

Overview
Fractal Market Geometry is an open-source overlay indicator that combines fractal analysis with harmonic pattern detection, Fibonacci retracements and extensions, Elliott Wave concepts, and Wyckoff phase identification. It provides traders with a geometric framework for understanding market structure and identifying potential reversal patterns with multi-factor signal confirmation.

What This Indicator Does
The indicator calculates and displays:

  • Fractal Detection - Identifies fractal highs and lows using Williams-style pivot analysis with configurable period
  • Fractal Dimension - Calculates market complexity using range-based dimension estimation
  • Harmonic Patterns - Detects Gartley, Butterfly, Bat, Crab, Shark, Cypher, and ABCD patterns using Fibonacci ratios
  • Fibonacci Retracements - Key levels at 38.2%, 50%, and 61.8%
  • Fibonacci Extensions - Projection level at 161.8%
  • Elliott Wave Count - Simplified wave counting based on pivot detection (1-5)
  • Wyckoff Phase - Volume-based phase identification (Accumulation, Markup, Distribution, Neutral)
  • Golden Spiral Levels - ATR-based support and resistance levels using phi (1.618) ratio
  • Trend Detection - EMA crossover trend identification (20/50 EMA)


How It Works

Fractal detection uses a configurable period to identify swing points:

Pine Script®
detectFractalHigh(simple int period) => bool result = true float centerVal = high[period] for i = 0 to period - 1 if high >= centerVal or high[period + i + 1] >= centerVal result := false break [result, centerVal]


Harmonic pattern detection uses Fibonacci ratio analysis between swing points. Each pattern has specific ratio requirements:
  • Gartley: AB 0.382-0.618, BC 0.382-0.886, CD 1.27-1.618
  • Butterfly: AB 0.382-0.5, BC 0.382-0.886, CD 1.618-2.24
  • Bat: AB 0.5-0.618, BC 1.13-1.618, CD 1.618-2.24
  • Crab: AB 0.382-0.618, BC 0.382-0.886, CD 2.24-3.618
  • Shark: AB 0.382-0.618, BC 1.13-1.618, CD 1.618-2.24
  • Cypher: AB 0.382-0.618, BC 1.13-1.414, CD 0.786-0.886


Wyckoff phase detection analyzes volume relative to price movement:

Pine Script®
wyckoffPhase(simple int period) => float avgVol = ta.sma(volume, period) float priceChg = ta.change(close, period) string phase = "NEUTRAL" if volume > avgVol * 1.5 and math.abs(priceChg) < close * 0.02 phase := "ACCUMULATION" else if volume > avgVol * 1.5 and math.abs(priceChg) > close * 0.05 phase := "MARKUP" else if volume < avgVol * 0.7 phase := "DISTRIBUTION" phase


Signal Generation
Signals use multi-factor confirmation for accuracy:
  • BUY Signal: Fractal low + Uptrend (EMA20 > EMA50) + RSI 30-55 + Bullish candle + Volume confirmation
  • SELL Signal: Fractal high + Downtrend (EMA20 < EMA50) + RSI 45-70 + Bearish candle + Volume confirmation
  • Pattern Detection: Label appears when harmonic pattern completes at current bar


Dashboard Panel (Top-Right)
  • Dimension - Fractal dimension value (market complexity measure)
  • Last High - Most recent fractal high price
  • Last Low - Most recent fractal low price
  • Pattern - Current harmonic pattern name or NONE
  • Elliott Wave - Current wave count (Wave 1-5) or OFF
  • Wyckoff - Current market phase or OFF
  • Trend - BULLISH, BEARISH, or NEUTRAL based on EMA crossover
  • Signal - BUY, SELL, or WAIT status


Visual Elements
  • Fractal Markers - Small triangles at fractal highs (down arrow) and lows (up arrow)
  • Geometry Lines - Dashed lines connecting the most recent fractal high and low
  • Fibonacci Levels - Clean horizontal lines at 38.2%, 50%, and 61.8% retracement levels
  • Fibonacci Extension - Horizontal line at 161.8% extension level
  • Golden Spiral Levels - Support and resistance lines based on ATR x 1.618
  • 3D Fractal Field - Optional depth layers around swing levels (OFF by default)
  • Harmonic Pattern Markers - Small diamond shapes when Crab, Shark, or Cypher patterns detected
  • Pattern Labels - Text label showing pattern name when detected
  • Signal Labels - BUY/SELL labels on confirmed multi-factor signals


Input Parameters
  • Fractal Period (default: 5) - Bars on each side for fractal detection
  • Geometry Depth (default: 3) - Complexity of geometric calculations
  • Pattern Sensitivity (default: 0.8) - Tolerance for pattern ratio matching
  • Show Fibonacci Levels (default: true) - Display retracement levels
  • Show Fibonacci Extensions (default: true) - Display extension level
  • Elliott Wave Detection (default: true) - Enable wave counting
  • Wyckoff Analysis (default: true) - Enable phase detection
  • Golden Spiral Levels (default: true) - Display spiral support/resistance
  • Show Fractal Points (default: true) - Display fractal markers
  • Show Geometry Lines (default: true) - Display connecting lines
  • Show Pattern Labels (default: true) - Display pattern name labels
  • Show 3D Fractal Field (default: false) - Display depth layers
  • Show Harmonic Patterns (default: true) - Display pattern markers
  • Show Buy/Sell Signals (default: true) - Display signal labels


Suggested Use Cases
  • Identify potential reversal zones using harmonic pattern completion
  • Use Fibonacci levels for entry, stop-loss, and target planning
  • Monitor Wyckoff phases for accumulation/distribution awareness
  • Track Elliott Wave counts for trend structure analysis
  • Use fractal dimension to gauge market complexity
  • Wait for multi-factor signal confirmation before entering trades


Timeframe Recommendations
Best on 1H to Daily charts. Lower timeframes produce more fractals but with less significance. Higher timeframes provide stronger levels and more reliable signals.

Limitations
  • Harmonic pattern detection uses simplified ratio ranges and may not match all textbook definitions
  • Elliott Wave counting is basic and does not include all wave rules
  • Wyckoff phase detection is volume-based approximation
  • Fractal dimension calculation is simplified
  • Signals require fractal confirmation which has inherent lag equal to the fractal period


Open-Source and Disclaimer
This script is published as open-source under the Mozilla Public License 2.0 for educational purposes. It does not constitute financial advice. Past performance does not guarantee future results. Always use proper risk management.

- Made with passion by officialjackofalltrades

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.