OPEN-SOURCE SCRIPT

Harmonic Resonance Field [JOAT]

1 620
Harmonic Resonance Field

Introduction

The Harmonic Resonance Field is an open-source overlay indicator that combines dynamic range detection, Renko-style trend tracking, harmonic frequency analysis, and magnetic field visualization into a unified system for identifying consolidation zones, trend direction, and potential reversal points. It is designed for traders who want to understand where price is within its current range, how strong the prevailing trend is, and when conditions are ripe for a breakout or mean reversion.

Built with Pine Script v6, the indicator uses custom user-defined types for Renko state management, range detection, reversal signals, harmonic bands, magnetic fields, and resonance points.

สแนปชอต

Why This Indicator Exists

Range-bound markets account for a significant portion of trading time, yet most indicators are optimized for trending conditions. This indicator fills that gap by providing:

  • ADX-based range detection: Automatically identifies when the market is ranging versus trending using ADX with a configurable threshold, so traders know which strategy framework to apply
  • Multi-style band calculation: Offers four band calculation methods (ATR, Percentage, Standard Deviation, Harmonic) so traders can choose the volatility measure that best fits their instrument
  • Renko trend overlay: A smoothed Renko-style trend line that filters noise and shows the dominant direction without requiring a separate Renko chart
  • Harmonic frequency analysis: Uses sine-wave modulation to create bands that expand and contract with market rhythm, capturing cyclical behavior that static bands miss
  • Magnetic field visualization: Plots dynamic attraction/repulsion levels around the mean, helping traders visualize where price is likely to gravitate


Core Components Explained

1. Range Detection Engine

The indicator uses ADX to classify market conditions. When ADX falls below the configurable threshold (default 25), the market is classified as ranging, and the indicator highlights the range boundaries. When ADX rises above the threshold, the market is trending, and the indicator shifts focus to the Renko trend line and harmonic bands.

Pine Script®


During ranging conditions, the indicator calculates the highest high and lowest low over the range lookback period and draws a dynamic range box with upper, lower, and midline levels. This gives traders clear boundaries for mean reversion strategies.

2. Harmonic Band System

The band system supports four calculation styles:

  • ATR: Bands based on Average True Range multiplied by a configurable factor
  • Percentage: Bands at a fixed percentage distance from the mean
  • Standard Deviation: Bollinger-style bands using standard deviation
  • Harmonic: Bands modulated by a sine wave that creates rhythmic expansion and contraction


The harmonic mode is unique to this indicator. It calculates a phase and amplitude based on bar position and ATR, then modulates the band width with a sine function:

Pine Script®


This creates bands that breathe with the market's natural rhythm rather than remaining static or purely reactive.

Chart showing the Harmonic Resonance Field with harmonic bands expanding and contracting around price, Renko trend line, and range detection box during a consolidation period

3. Renko Trend Engine

Rather than requiring traders to switch to a Renko chart, this indicator calculates a Renko-style trend directly on the standard candlestick chart. The brick size can be set using ATR, a fixed percentage, or a static value. The Renko state is managed as a custom type that tracks the current level, direction, and brick boundaries.

When price moves by one brick size in the trend direction, the Renko level advances. When price reverses by the configurable reversal multiplier (default 2 bricks), the trend flips. The result is a stepped trend line overlaid on the chart that filters minor fluctuations and shows only significant directional changes.

4. Magnetic Field Visualization

The magnetic field creates a set of attraction levels around the mean price. These levels represent zones where price tends to gravitate based on the configurable field strength parameter. The field is calculated using the distance from the mean and the current ATR:

  • Strong attraction zone: Within 0.5x ATR of the mean — price tends to consolidate here
  • Moderate zone: 0.5x to 1.0x ATR from the mean — normal trading range
  • Weak zone: Beyond 1.0x ATR — price is extended and may revert


The magnetic field lines are drawn with gradient transparency, becoming more transparent as they move away from the mean, visually communicating the decreasing "pull" of the mean at greater distances.

5. Reversal and Resonance Detection

The indicator generates two types of signals:

  • Reversal signals: Triggered when price reaches the outer bands with momentum showing signs of exhaustion (RSI-based or rate-of-change based). These are plotted as directional markers on the chart.
  • Resonance signals: Triggered when multiple conditions align — price at a band extreme, ranging market detected, and volume above average. Resonance points represent higher-conviction mean reversion opportunities.


Visual Elements

  • Harmonic Bands: Upper and lower bands with gradient fill between them
  • Renko Trend Line: Stepped line showing the dominant trend direction
  • Range Box: Dynamic box highlighting the current consolidation range
  • Magnetic Field Lines: Gradient-colored attraction levels around the mean
  • Reversal Markers: Directional signals at potential turning points
  • Resonance Points: High-confluence mean reversion signals
  • Candle Coloring: Optional trend-based candle coloring
  • Dashboard: Displays trend direction, range status, band width, Renko state, and resonance count


Input Parameters

Range Detection:
  • Range Lookback (default 50)
  • ADX Length (default 14) and ADX Threshold (default 25)


Band Settings:
  • Band Style: ATR, Percentage, Standard Dev, or Harmonic
  • Band Length (default 20) and Band Multiplier (default 2.0)


Renko Settings:
  • Brick Size Style: ATR, Percentage, or Static
  • Brick Size (default 1.0) and Reversal Multiplier (default 2)


Magnetic Field:
  • Field Strength (0.1-2.0, default 1.0)


Visual Settings:
  • Show Candle Coloring, Gradient Fill, Dashboard, Glow Effects, Pulse Effects


สแนปชอต

How to Use This Indicator

Step 1: Check the dashboard for the current market regime. If the market is ranging, focus on the range box boundaries and magnetic field levels for mean reversion setups.

Step 2: In trending conditions, follow the Renko trend line. Stay with the trend as long as the Renko direction holds. A Renko reversal (direction flip) is a significant event that suggests the trend may be changing.

Step 3: Watch for price reaching the outer harmonic bands. In ranging markets, these represent potential reversal zones. In trending markets, they may indicate overextension.

Step 4: Look for resonance signals. These combine multiple conditions (band extreme + ranging + volume) and represent the highest-conviction mean reversion setups.

Step 5: Use the magnetic field levels as dynamic support and resistance. Price tends to gravitate toward the strong attraction zone near the mean.

Close-up showing reversal markers at band extremes with resonance signals highlighted during a ranging market, with the magnetic field gradient visible around the mean

Indicator Limitations

  • ADX-based range detection has an inherent lag. The transition from trending to ranging (and vice versa) is identified after it has already begun.
  • Harmonic bands use a fixed-frequency sine wave. Real market cycles are not perfectly periodic, so the harmonic modulation is an approximation.
  • Renko trend calculations on a candlestick chart are a simulation. They will not match a true Renko chart exactly due to differences in bar construction.
  • Reversal signals at band extremes do not guarantee reversals. In strong trends, price can ride the outer band for extended periods.
  • The magnetic field visualization is a conceptual tool for understanding mean reversion tendency, not a precise prediction of where price will go.
  • Performance may be affected on very low timeframes with many visual elements enabled. Consider reducing visual effects on sub-minute charts.


Originality Statement

This indicator is original in its synthesis of range detection, harmonic frequency analysis, and magnetic field visualization. While individual components (ADX range detection, Renko trends, Bollinger-style bands) are established concepts, this indicator is justified because:

  • The harmonic band mode introduces sine-wave modulation to create bands that rhythmically expand and contract, a method not found in standard band indicators
  • The magnetic field visualization provides a novel way to represent mean reversion tendency using gradient-based attraction zones
  • Combining Renko trend tracking with ADX range detection on a standard chart gives traders both trend-following and mean-reversion frameworks simultaneously
  • Resonance detection creates a multi-factor confluence signal by combining band position, range status, and volume conditions
  • The four-style band system (ATR, Percentage, StdDev, Harmonic) allows traders to adapt the indicator to different instruments and market conditions


Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. Range detection and band analysis are tools for understanding market structure, not guarantees of future price movement. Always use proper risk management. The author is not responsible for any losses incurred from using this indicator.

-Made with passion by officialjackofalltrades

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน