OPEN-SOURCE SCRIPT

LTF Distribution Analyzer

99
█ OVERVIEW

LTF Distribution Analyzer reveals the hidden price distribution and order flow within each candle by sampling lower timeframe data. It visualizes where prices concentrated, how volume was distributed between buyers and sellers, and identifies divergences between price action and actual market participation.

Unlike traditional candlesticks showing only OHLC, this indicator exposes the statistical structure of price movement using quartile-based visualization combined with delta analysis.

ekran görüntüsü

█ CONCEPTS

The indicator is built on two core concepts:

1 — Statistical Price Distribution
Each candle contains many lower timeframe bars. By analyzing these bars, we calculate:
• Q1 (25th percentile) - 25% of prices traded below this level
• Q3 (75th percentile) - 75% of prices traded below this level
• Median - The middle price value
• IQR (Interquartile Range) - The Q3-Q1 spread containing 50% of all prices

2 — Volume Delta Analysis
Delta measures buying vs selling pressure:
• Delta = Buy Volume − Sell Volume
• Positive delta = More aggressive buying
• Negative delta = More aggressive selling
• Delta Ratio normalizes this as a percentage


█ HOW IT WORKS

The indicator fetches lower timeframe data using request.security_lower_tf() and processes it to create a statistical summary:

Step 1: Timeframe Calculation
• Auto mode: Chart timeframe ÷ Auto Divisor = LTF
• Example: 1H chart ÷ 1000 = ~3.6 second sampling
• Manual mode: User-specified timeframe

Step 2: Data Collection
• Collects all close prices from LTF bars within current candle
• Aggregates volume by candle direction (bullish/bearish)

Step 3: Statistical Analysis
• Calculates quartiles (Q1, Q3), median, and boundaries
• Identifies outliers using 1.5× and 3× IQR fences
• Finds Volume POC (price with highest volume)

Step 4: Delta Calculation
• Sums buy volume (from bullish LTF bars)
• Sums sell volume (from bearish LTF bars)
• Computes delta ratio for color determination


█ VISUAL ELEMENTS

┌─────────────────────────────────────────┐
│ ▲ Extreme outlier (3× IQR) │
│ △ Mild outlier (1.5× IQR) │
│ ─ Upper whisker cap │
│ ┊ Whisker line (dashed) │
│ ▄ IQR Box (Q1 to Q3 range) │
│ ━ Volume POC (highest volume) │
│ ● Median (green=bull, red=bear) │
│ ┊ Whisker line (dashed) │
│ ─ Lower whisker cap │
│ ▽ Mild outlier │
│ ▼ Extreme outlier │
└─────────────────────────────────────────┘


█ COLOR SYSTEM

Colors indicate the relationship between candle direction and order flow:

🟢 TEAL (Positive Flow)
Bullish candle + Positive delta
→ Strong buying confirmation
→ Trend continuation signal

🔴 RED (Negative Flow)
Bearish candle + Negative delta
→ Strong selling confirmation
→ Trend continuation signal

🟠 ORANGE (Mixed Signal A)
Bullish candle + Negative delta
→ Price up but sellers dominated
→ Potential weakness/reversal warning

🔵 BLUE (Mixed Signal B)
Bearish candle + Positive delta
→ Price down but buyers dominated
→ Potential accumulation/reversal signal


█ SETTINGS

Timeframe Settings
• LTF Mode — Auto or Manual selection
• Manual Timeframe — Specific LTF when in Manual mode
• Auto Divisor — Higher = finer granularity (default: 1000)
• Allow Sub-Minute — Requires Premium subscription

Visual Style
• Positive/Negative Flow colors — Customize the 4 flow colors
• Box Transparency — Opacity of the quartile box (0-100%)

Statistics Display
• Show Statistics Panel — Toggle on-chart stats table
• Show Timeframe Badge — Toggle LTF indicator badge
• Panel Position — Choose corner placement
• Panel Size — Text size selection


█ HOW TO USE

1. Divergence Detection
Look for color mismatches:
• Orange bars in uptrend = weakness, potential reversal
• Blue bars in downtrend = strength, potential reversal
• Multiple consecutive divergent bars strengthen signal
• Wait for confirmation before entry

2. Volume POC Trading
• POC marks where most volume traded
• POC clusters at similar levels = strong S/R zone
• Price often returns to POC before continuing
• Use POC for entry/exit targeting

3. Trend Confirmation
• Consecutive teal = strong uptrend
• Consecutive red = strong downtrend
• Median position shows intrabar momentum
• Wide boxes indicate high volatility

4. Outlier Analysis
• Extreme markers (▲▼) often mark stop hunts
• Consider fading extremes at key levels
• Mild markers (△▽) = areas to watch


█ RECOMMENDED SETTINGS

For different chart timeframes:

│ Chart TF │ Auto Divisor │ Resulting LTF │
├──────────┼──────────────┼───────────────┤
│ 15M │ 1500 │ ~1M │
│ 1H │ 1000 │ ~3-4s │
│ 4H │ 600 │ ~24s │
│ Daily │ 500 │ ~2-3M │

Tip: Check the TF badge to confirm active sampling timeframe.


█ BEST PRACTICES

Do:
✓ Use "Bars" chart style for cleanest display
✓ Combine with support/resistance analysis
✓ Wait for confirmation bars
✓ Note POC clusters across multiple bars
✓ Adjust divisor based on your timeframe

Avoid:
✗ Trading single bar signals alone
✗ Using during low volume periods
✗ Trading immediately after news releases
✗ Ignoring overall market context


█ LIMITATIONS

• Requires adequate market liquidity for reliable signals
• Sub-minute timeframes need Premium subscription
• Historical data depth depends on TradingView's data availability
• Delta calculation assumes volume direction matches candle direction


█ NOTES

This indicator works best on liquid markets (forex majors, major indices, popular stocks/crypto) where volume data is meaningful.

The gray dotted vertical line marks where LTF data becomes available - bars before this line won't display the indicator.

For questions or suggestions, leave a comment below.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.