OPEN-SOURCE SCRIPT

Active PMI Support/Resistance Levels [EdgeTerminal]

149
The PMI Support & Resistance indicator revolutionizes traditional technical analysis by using Pointwise Mutual Information (PMI) - a statistical measure from information theory - to objectively identify support and resistance levels. Unlike conventional methods that rely on visual pattern recognition, this indicator provides mathematically rigorous, quantifiable evidence of price levels where significant market activity occurs.

- The Mathematical Foundation: Pointwise Mutual Information
Pointwise Mutual Information measures how much more likely two events are to occur together compared to if they were statistically independent. In our context:

  • Event A: Volume spikes occurring (high trading activity)
  • Event B: Price being at specific levels


The PMI formula calculates: PMI = log(P(A,B) / (P(A) × P(B)))

Where:
  • P(A,B) = Probability of volume spikes occurring at specific price levels
  • P(A) = Probability of volume spikes occurring anywhere
  • P(B) = Probability of price being at specific levels


High PMI scores indicate that volume spikes and certain price levels co-occur much more frequently than random chance would predict, revealing genuine support and resistance zones.

- Why PMI Outperforms Traditional Methods
Subjective interpretation: What one trader sees as significant, another might ignore
Confirmation bias: Tendency to see patterns that confirm existing beliefs
Inconsistent criteria: No standardized definition of "significant" volume or price action
Static analysis: Doesn't adapt to changing market conditions
No strength measurement: Can't quantify how "strong" a level truly is

PMI Advantages:
✅ Objective & Quantifiable: Mathematical proof of significance, not visual guesswork
✅ Statistical Rigor: Levels backed by information theory and probability
✅ Strength Scoring: PMI scores rank levels by statistical significance
✅ Adaptive: Automatically adjusts to different market volatility regimes
✅ Eliminates Bias: Computer-calculated, removing human interpretation errors
✅ Market Structure Aware: Reveals the underlying order flow concentrations

- How It Works
Data Processing Pipeline:
  1. Volume Analysis: Identifies volume spikes using configurable thresholds
  2. Price Binning: Divides price range into discrete levels for analysis
  3. Co-occurrence Calculation: Measures how often volume spikes happen at each price level
  4. PMI Computation: Calculates statistical significance for each price level
  5. Level Filtering: Shows only levels exceeding minimum PMI thresholds
  6. Dynamic Updates: Refreshes levels periodically while maintaining historical traces


Visual System:
  • Current Levels: Bright, thick lines with PMI scores - your actionable levels
  • Historical Traces: Faded previous levels showing market structure evolution
  • Strength Tiers: Line styles indicate PMI strength (solid/dashed/dotted)
  • Color Coding: Green for support, red for resistance
  • Info Table: Real-time display of strongest levels with scores



- Indicator Settings:

Core Parameters
Lookback Period (Default: 200)
Lower (50-100): More responsive to recent price action, catches short-term levels
Higher (300-500): Focuses on major historical levels, more stable but less responsive
Best for: Day trading (100-150), Swing trading (200-300), Position trading (400-500)

Volume Spike Threshold (Default: 1.5)
Lower (1.2-1.4): More sensitive, catches smaller volume increases, more levels detected
Higher (2.0-3.0): Only major volume surges count, fewer but stronger signals
Market dependent: High-volume stocks may need higher thresholds (2.0+), low-volume stocks lower (1.2-1.3)

Price Bins (Default: 50)
Lower (20-30): Broader price zones, less precise but captures wider areas
Higher (70-100): More granular levels, precise but may be overly specific
Volatility dependent: High volatility assets benefit from more bins (70+)

Minimum PMI Score (Default: 0.5)
Lower (0.2-0.4): Shows more levels including weaker ones, comprehensive view
Higher (1.0-2.0): Only statistically strong levels, cleaner chart
Progressive filtering: Start with 0.5, increase if too cluttered

Max Levels to Show (Default: 8)
Fewer (3-5): Clean chart focusing on strongest levels only
More (10-15): Comprehensive view but may clutter chart
Strategy dependent: Scalpers prefer fewer (3-5), swing traders more (8-12)

Historical Tracking Settings
Update Frequency (Default: 20 bars)
Lower (5-10): More frequent updates, captures rapid market changes
Higher (50-100): Less frequent updates, focuses on major structural shifts
Timeframe scaling: 1-minute charts need lower frequency (5-10), daily charts higher (50+)

Show Historical Levels (Default: True)
Enables the "breadcrumb trail" effect showing evolution of support/resistance
Disable for cleaner charts focusing only on current levels

Max Historical Marks (Default: 50)
Lower (20-30): Less memory usage, shorter history
Higher (100-200): Longer historical context but more resource intensive

Fade Strength (Default: 0.8)
Lower (0.5-0.6): Historical levels more visible
Higher (0.9-0.95): Historical levels very subtle

Visual Settings
Support/Resistance Colors: Choose colors that contrast well with your chart theme Line Width: Thicker lines (3-4) for better visibility on busy charts Show PMI Scores: Toggle labels showing statistical strength Label Size: Adjust based on screen resolution and chart zoom level

- Most Effective Usage Strategies

For Day Trading:
Setup: Lookback 100-150, Volume Threshold 1.8-2.2, Update Frequency 10-15
Use PMI levels as bounce/rejection points for scalp entries
Higher PMI scores (>1.5) offer better probability setups
Watch for volume spike confirmations at levels

For Swing Trading:
Setup: Lookback 200-300, Volume Threshold 1.5-2.0, Update Frequency 20-30
Enter on pullbacks to high PMI support levels
Target next resistance level with PMI score >1.0
Hold through minor levels, exit at major PMI levels

For Position Trading:
Setup: Lookback 400-500, Volume Threshold 2.0+, Update Frequency 50+
Focus on PMI scores >2.0 for major structural levels
Use for portfolio entry/exit decisions
Combine with fundamental analysis for timing

- Trading Applications:

Entry Strategies:
PMI Bounce Trades
Price approaches high PMI support level (>1.0)
Wait for volume spike confirmation (orange triangles)
Enter long on bullish price action at the level
Stop loss just below the PMI level
Target: Next PMI resistance level

PMI Breakout Trades
Price consolidates near high PMI level
Volume increases (watch for orange triangles)
Enter on decisive break with volume
Previous resistance becomes new support
Target: Next major PMI level

PMI Rejection Trades
Price approaches PMI resistance with momentum
Watch for rejection signals and volume spikes
Enter short on failure to break through
Stop above the PMI level
Target: Next PMI support level

Risk Management:
Stop Loss Placement
Place stops 0.1-0.5% beyond PMI levels (adjust for volatility)
Higher PMI scores warrant tighter stops
Use ATR-based stops for volatile assets

Position Sizing
Larger positions at PMI levels >2.0 (highest conviction)
Smaller positions at PMI levels 0.5-1.0 (lower conviction)
Scale out at multiple PMI targets

- Key Warning Signs & What to Watch For

Red Flags:
🚨 Very Low PMI Scores (<0.3): Weak statistical significance, avoid trading
🚨 No Volume Confirmation: PMI level without recent volume spikes may be stale
🚨 Overcrowded Levels: Too many levels close together suggests poor parameter tuning
🚨 Outdated Levels: Historical traces are reference only, not tradeable

Optimization Tips:
✅ Regular Recalibration: Adjust parameters monthly based on market regime changes
✅ Volume Context: Always check for recent volume activity at PMI levels
✅ Multiple Timeframes: Confirm PMI levels across different timeframes
✅ Market Conditions: Higher thresholds during high volatility periods

Interpreting PMI Scores
PMI Score Ranges:
  • 0.5-1.0: Moderate statistical significance, proceed with caution
  • 1.0-1.5: Good significance, reliable for most trading strategies
  • 1.5-2.0: Strong significance, high-confidence trade setups
  • 2.0+: Very strong significance, institutional-grade levels


Historical Context: The historical trace system shows how support and resistance evolve over time. When current levels align with multiple historical traces, it indicates persistent market memory at those prices, significantly increasing the level's reliability.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.