OPEN-SOURCE SCRIPT

Fractal Model [Free+] (T-Trades)

231
Fractal Model [Free+] - Higher Timeframe Analysis Tool

Advanced higher timeframe candle visualization with T-spot identification, sweep detection, and multi-timeframe price action analysis.

Introduction:

The Fractal Model is a Pine Script indicator that provides advanced higher timeframe (HTF) candle visualization and analysis. It identifies key price action patterns including T-spots, sweep signals, and imbalance zones to help traders understand market structure across multiple timeframes.

Description:

The Fractal Model analyzes price action by creating higher timeframe candles on your current chart, allowing you to see HTF structure without switching timeframes. It identifies specific price action patterns that often precede significant moves, including T-spot formations, sweep confirmations, and fair value gaps.

The indicator uses logarithmic midpoint calculations and pivot detection algorithms to identify high-probability entry and exit points. It automatically detects appropriate higher timeframes based on your current chart timeframe and provides real-time analysis of price action patterns.

Key Features:

  1. Higher Timeframe Candle Visualization: Automatically creates higher timeframe candles on your current chart, allowing you to see HTF structure without switching timeframes. Supports up to 6 different HTF levels with automatic timeframe detection.

  2. T-Spot Identification: Identifies T-spot formations using logarithmic midpoint calculations. T-spots mark areas where price is likely to form wicks based on specific price action patterns including sweep conditions and close position analysis.

  3. Sweep Detection: Detects when price sweeps previous highs or lows but closes on the opposite side, creating potential reversal zones. Includes both high sweeps and low sweeps with visual confirmation lines.

  4. Fair Value Gap (FVG) Detection: Identifies gaps between candle ranges where price didn't trade, creating potential support/resistance zones. Uses three-candle pattern analysis to detect imbalance areas.

  5. Volume Imbalance Detection: Identifies areas where price action shows volume imbalance between consecutive candles, indicating potential continuation or reversal zones.

  6. T-Spot Sweep Confirmation: Advanced confirmation system that requires pivot formation before T-spot touch, then close beyond the pivot level to confirm sweep signals.

  7. TTFM Labeling System: Dynamic labeling system that tracks setup validity with C2, C3, and C4 labels indicating different types of T-spot formations and their confirmation status.


How the Code Works:

1. Higher Timeframe Detection:
The indicator automatically determines appropriate HTF based on your current chart:
- 1m charts: 15m HTF
- 3m charts: 30m HTF
- 5m charts: 1h HTF
- 15m charts: 4h HTF
- 30m-1h charts: 1D HTF
- 4h-8h charts: 1W HTF
- 1D charts: 1M HTF

2. T-Spot Calculation Algorithm:
T-spots are identified using logarithmic midpoint calculations combined with pivot-based logic:
- Calculates log midpoint = exp((log(high) + log(low)) / 2) for wick analysis
- Identifies sweep conditions: high > prev_high AND close < prev_high (bearish) or low < prev_low AND close > prev_low (bullish)
- Creates T-spot zones based on close position relative to logarithmic midpoint
- **Core Logic**: All T-spot formations are based on pivot creation patterns where price sweeps previous levels but closes on the opposite side, creating potential reversal zones

3. Sweep Detection Logic:
The code detects sweeps using pivot analysis:
- Uses ta.pivothigh() and ta.pivotlow() with 1,2 parameters for pivot detection
- Confirms sweeps when: pivot forms before T-spot touch AND close breaks beyond pivot level
- Tracks pivot levels and bars for confirmation validation
- **Pivot-Based Foundation**: The entire system is built on pivot creation logic - T-spots form when price creates pivots by sweeping previous levels but closing opposite, indicating potential reversal points

4. Fair Value Gap Detection:
FVG identification uses three-candle pattern analysis:
- Candle1.l > Candle2.h AND min(Candle1.o, Candle1.c) > max(Candle2.o, Candle2.c) for bullish FVG
- Candle1.h < Candle2.l AND max(Candle1.o, Candle1.c) < min(Candle2.o, Candle2.c) for bearish FVG

5. Visual Rendering System:
Uses array-based object management:
- Clears and redraws all visual elements on each bar
- Manages HTF candles, T-spots, sweeps, and labels using separate arrays
- Implements cleanup logic to prevent memory overflow

6. Pivot-Based T-Spot Types:
The indicator identifies several T-spot patterns based on pivot creation:
- **Standard T-Spots**: Price sweeps previous high/low but closes opposite, creating pivot
- **Expansive T-Spots**: Previous candle sweeps, current candle expands and closes beyond sweep level
- **Pro-trend T-Spots**: Price sweeps logarithmic midpoint but closes beyond previous levels
- **Silver T-Spots**: Special T-spots during specific market hours (4th-5th candle of day)
- All patterns require pivot formation through sweep-and-close logic for validation

Usage Guidance:

  1. Add the Fractal Model indicator to your TradingView chart
  2. Configure HTF settings and T-spot bias preferences
  3. Adjust visual customization options to match your trading style
  4. Monitor T-spot formations and sweep confirmations for entry signals


Trading Applications:

T-Spot Trading:
- Look for T-spot formations on higher timeframes
- Wait for price to touch T-spot levels
- Enter on sweep confirmation with proper pivot validation
- Use T-spot levels as support/resistance zones

Sweep Trading:
- Identify sweep patterns where price breaks previous highs/lows but closes opposite
- Use sweep levels as potential reversal zones
- Combine with T-spot analysis for higher probability setups

Fair Value Gap Trading:
- Trade FVG fills as price returns to imbalance areas
- Use FVG levels as support/resistance zones
- Combine with higher timeframe structure for context

Technical Specifications:
- Compatible with Pine Script v6
- Non-repainting indicator
- Supports all timeframes with automatic HTF detection
- Memory-efficient array management
- Real-time T-spot and sweep detection
- Customizable visual elements and colors

Disclaimer:

This indicator is for educational and informational purposes only. Past performance does not guarantee future results. Always conduct your own research and risk management before making trading decisions.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.