⚪ Data Decomposition (Sifting): The indicator “sifts” through historical price data to detect natural oscillations within it. Each oscillation (or IMF) highlights a unique rhythm in price behavior, from rapid fluctuations to broader, slower trends.
⚪ Adaptive Signal Reconstruction: The EMD Oscillator allows traders to select specific IMFs for a custom signal reconstruction. This reconstructed signal provides a composite view of market behavior, showing both short-term cycles and long-term trends based on which IMFs are included.
⚪ Normalization: To make the oscillator easy to interpret, the reconstructed signal is scaled between -1 and 1. This normalization lets traders quickly spot overbought and oversold conditions, as well as trend direction, without worrying about the raw magnitude of price changes.
⚪ Intrinsic Mode Functions (IMFs)
IMFs are extracted from the data and act as the building blocks of this indicator. Each IMF is a unique oscillation within the price data, similar to how a band might be divided into treble, mid, and bass frequencies. In the EMD Oscillator:
- Higher-Frequency IMFs: Represent short-term market “noise” and quick fluctuations.
- Lower-Frequency IMFs: Capture broader market trends, showing more stable and long-term patterns.
⚪ Sifting Process: The Heart of EMD
The sifting process isolates each IMF by repeatedly separating and refining the data. Think of this as filtering water through finer and finer mesh sieves until only the clearest parts remain. Mathematically, it involves:
- Extrema Detection: Finding all peaks and troughs (local maxima and minima) in the data.
- Envelope Calculation: Smoothing these peaks and troughs into upper and lower envelopes using cubic spline interpolation (a method for creating smooth curves between data points).
- Mean Removal: Calculating the average between these envelopes and subtracting it from the data to isolate one IMF. This process repeats until the IMF criteria are met, resulting in a clean oscillation without trend influences.
⚪ Spline Interpolation
The cubic spline interpolation is an advanced mathematical technique that allows smooth curves between points, which is essential for creating the upper and lower envelopes around each IMF. This interpolation solves a tridiagonal matrix (a specialized mathematical problem) to ensure that the envelopes align smoothly with the data’s natural oscillations.
To give a relatable example: imagine drawing a smooth line that passes through each peak and trough of a mountain range on a map. Spline interpolation ensures that line is as smooth and close to reality as possible. Achieving this in Pine Script is technically demanding and demonstrates a high level of mathematical coding.
⚪ Amplitude Normalization
To make the oscillator more readable, the final signal is scaled by its maximum amplitude. This amplitude normalization brings the oscillator into a range of -1 to 1, creating consistent signals regardless of price level or volatility.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.