PROTECTED SOURCE SCRIPT

Institutional Cycle Intelligence System

30
Institutional Cycle Intelligence System: Architecture, Algorithms, and Application:
Abstract
The Institutional Cycle Intelligence System (ICIS) version 2.0 is a sophisticated Pine Script indicator designed to bridge the gap between retail technical analysis and quantitative hedge fund methodologies. Unlike standard oscillators (RSI, MACD) that rely on fixed lookback periods, ICIS utilizes Digital Signal Processing (DSP) and spectral analysis to dynamically identify, extract, and synthesize market cycles. This document details the system’s specialty, the mathematical underpinnings of its seven algorithms, and a strategic guide for its application in trading.

Part 1: The Specialty & Philosophy
1.1 The Problem with Static Indicators
Traditional technical indicators suffer from a fatal flaw: Stationarity Assumption. A 14-period RSI assumes the market’s "rhythm" is consistently relevant to 14 bars. However, financial markets are non-stationary; cycle lengths expand and contract based on volatility, liquidity, and macroeconomic events. A market might be oscillating on a 10-day cycle one month and shift to a 24-day cycle the next. Static indicators fail to adapt to these phase shifts, leading to false signals.

1.2 The ICIS Solution: Adaptive Spectral Analysis
The ICIS allows traders to visualize the market not as a linear trend, but as a composite of waves (frequencies). Its specialty lies in its "Ensemble Approach." Rather than relying on a single mathematical model, ICIS runs seven distinct advanced cycle detection algorithms simultaneously.

1.3 The "Intelligent" Consensus Engine
The core innovation of this script is the Intelligent Mode. It does not simply average the outputs of the seven models. Instead, it employs an adaptive weighting mechanism:

Normalization: It converts the raw output of each model into a standardized Z-score (standard deviation units) to ensure apples-to-apples comparison.
Scoring: It calculates a "Consistency Score" for each model. If a model is producing erratic, noisy signals, its weight is reduced. If a model detects a high-amplitude, clean sine wave, its weight is increased.
Synthesis: It fuses these weighted inputs into a single "Composite Signal" that represents the highest probability cycle currently driving price action.
Part 2: Algorithmic Deep Dive
The ICIS incorporates seven distinct methodologies drawn from physics, engineering, and econometrics. Understanding these algorithms is key to trusting the signals.

2.1 Ehlers Bandpass + Hilbert Transform
Origin: Digital Signal Processing (DSP).
The Logic: This model acts like a radio tuner. It filters out low-frequency trends and high-frequency noise, isolating a specific bandwidth of market data.
The Mechanism:
Bandpass Filter: Allows only frequencies within the user-defined cycle ranges (Short, Medium, Long) to pass through.
Hilbert Transform: A mathematical operation that shifts the signal by 90 degrees to create an analytic signal. This allows for the precise calculation of the instantaneous phase (where we are in the wave) and amplitude (how strong the wave is).
Strength: Excellent for identifying clean, sine-wave-like market behavior in ranging markets.
2.2 MESA Adaptive Cycle (Maximum Entropy Spectral Analysis)
Origin: Geophysical oil exploration.
The Logic: MESA provides high-resolution frequency estimation even when the data sample is short (a common limitation in trading).
The Mechanism: It uses a "Homodyne Discriminator." It measures the phase change of price relative to itself over time. By calculating the rate of phase change, it derives the dominant cycle period.
Strength: Highly responsive to rapid changes in market cycle length. It adapts faster than Fourier-based methods.
2.3 Autocorrelation Periodogram
Origin: Statistical Time Series Analysis.
The Logic: Markets often rhyme. Autocorrelation measures the similarity of the price series to a lagged version of itself.
The Mechanism: The script runs a loop testing lags from 5 to 150 bars. If price today correlates highly with price 20 days ago, it identifies a 20-day cycle.
Strength: The most robust method for confirming that a cycle actually exists physically, rather than being a mathematical artifact.
2.4 Empirical Mode Decomposition (EMD)
Origin: The Hilbert-Huang Transform (NASA).
The Logic: Markets are non-linear and non-stationary. EMD does not force data into sine waves (like Fourier). instead, it treats price like a rope made of different strands.
The Mechanism:
Sifting: It identifies local highs and lows to create upper and lower envelopes.
Mean Extraction: It subtracts the mean of these envelopes from the data to extract an "Intrinsic Mode Function" (IMF).
Residuals: It repeats this process to separate high-frequency noise (Short Cycle) from medium variations and long-term trends.
Strength: The "Holy Grail" of adaptive analysis. It handles trend reversals and sudden volatility spikes better than any linear filter.
2.5 Goertzel Power Spectrum
Origin: Telecommunications (used in decoding touch-tone phone sounds).
The Logic: A highly optimized version of the Discrete Fourier Transform (DFT). It scans specific frequencies to see which one has the most "Power" (Energy).
The Mechanism: The script calculates the Goertzel energy for various periods. The period with the highest energy is deemed the "Dominant Cycle" and is used to drive the oscillator.
Strength: Extremely precise at identifying the exact length of the current cycle (e.g., distinguishing between a 20-day and a 22-day cycle).
2.6 Singular Spectrum Analysis (SSA)
Origin: Meteorology and climatology.
The Logic: SSA decomposes a time series into principal components: Trend, Oscillatory (Cycle), and Noise.
The Mechanism: While a full SSA requires heavy matrix algebra (difficult in Pine Script), this implementation simulates SSA using weighted lag windows to separate eigen-components. It reconstructs the time series using only the oscillatory components.
Strength: Unrivaled noise reduction. It produces the smoothest "zero-lag" oscillators in the system.
2.7 Wavelet Multi-Resolution Analysis
Origin: Quantum Physics and Image Compression.
The Logic: Standard Fourier analysis loses time information (it tells you a frequency exists, but not when). Wavelets analyze both Frequency and Time simultaneously.
The Mechanism: The script passes price through a cascade of high-pass and low-pass filters (Haar-like decomposition).
Detail Coefficients: Capture high-frequency noise and short cycles.
Approximation Coefficients: Capture the underlying trend and long cycles.
Strength: Excellent for identifying "regime changes" where the market shifts from trending to ranging.
Part 3: Using the Code & Interface
3.1 Input Parameters
Model Selection: Defaults to "Intelligent" (recommended). You can switch to individual models (e.g., "EMD") to isolate their specific view.
Cycle Period Ranges:
Short (5-20): Captures swing trading noise and rapid reversals.
Medium (20-50): The primary swing cycle (often aligns with monthly flows).
Long (50-150): The structural trend cycle.
Advanced Settings:
Bandwidth (0.3): Controls how "wide" the filter is. Lower values = cleaner but lagging; Higher values = noisier but faster.
Signal Threshold (0.5): The level the oscillator must breach to be considered a "Strong" signal.
3.2 Visual Components
The Oscillators (Main Chart):
Red Line (Short): The fast heartbeat of the market.
Teal Line (Medium): The tradeable swing.
Blue Line (Long): The tidal direction.
Purple Line (Composite): The weighted average of all cycles. This is your primary trigger.
The Info Table: Displays the current exact period (in bars), phase (in degrees), and trend direction for all three cycle tiers. It also shows the "Confluence Score" (how many cycles agree).
Background Color: Changes dynamically based on cycle alignment.
Green: Bullish Confluence (2 or 3 cycles pointing up).
Red: Bearish Confluence (2 or 3 cycles pointing down).
Part 4: Trading Strategy & Application
The ICIS is designed to identify Turning Points and Trend Continuations.

4.1 The "Phasing" Concept
Understanding Phase is crucial. The script calculates phase in degrees (0° to 360°):

0° - 90° (Accumulation): The cycle has bottomed and is accelerating upward. Best time to enter.
90° - 180° (Markup): The cycle is mature but still rising. Hold positions.
180° - 270° (Distribution): The cycle has topped and is accelerating downward. Best time to short/sell.
270° - 360° (Decline): The cycle is mature in its downtrend. Hold shorts or cash.
4.2 Trade Setups
Setup A: The "Triple Confluence" Entry (Trend Following)
This is the safest signal, indicating all distinct time horizons are aligned.

Condition: The Short, Medium, and Long cycle lines are ALL sloping upwards.
Visual: Background turns bright Green.
Trigger: The Composite (Purple) line crosses above the Signal Threshold (+0.5).
Exit: When the Short Cycle (Red) crosses below the Medium Cycle (Teal).
Setup B: The "Cycle Bottom" (Reversal)
This catches the absolute low of a move.

Condition: The Long Cycle (Blue) is trending UP (Trend support).
Trigger: The Composite line is deeply negative (below -0.8) and crosses back ABOVE zero.
Validation: Wait for the "Cycle Bottom" circle marker to appear on the chart.
Stop Loss: Below the recent swing low.
Setup C: The "Divergence" Play (Advanced)
Condition: Price makes a Lower Low.
Indicator: The Composite Oscillator makes a Higher Low.
Logic: Momentum on the cyclical level is shifting bullish despite price action.
Execution: Enter on the first candle where the Composite line turns green (slopes up).
4.3 Interpreting the Information Table
The table is your dashboard.

Period: If the "Medium Period" is drastically changing (e.g., jumping from 20 to 50), the market is in a chaotic transition. Reduce position size.
Strength: Shows the cycle amplitude. If Strength < 20%, the market is chopping/sideways. Do not trade trend strategies. If Strength > 60%, the cycle is dominant; use aggressive targets.
Part 5: Optimization & Best Practices
5.1 Timeframes
While the math works on any timeframe, ICIS is computationally heavy and optimized for:

4H / 1D: Best for Swing Trading. The cycle periods (20-40 bars) align well with monthly/quarterly flows.
15m / 1H: Good for Intraday, but requires adjusting the "Short Cycle" inputs to be more sensitive (e.g., Min 5, Max 15).
5.2 Handling "Repainting" vs. "Recalculation"
This script uses max_bars_back and causal filters where possible. However, EMD and SSA are inherently adaptive.

Fact: The Phase calculation uses the Hilbert Transform, which requires a few bars of future data to be perfectly precise (theoretical limit).
Mitigation: The script uses a causal approximation of the Hilbert Transform (nz(src[2]) etc.) to minimize repainting.
Rule: Do not trade on the current forming bar. Wait for the bar to close to confirm the cycle direction.
5.3 Combining with Price Action
ICIS tells you the Time (When to trade), but Price Action tells you the Level (Where to trade).

Use ICIS to time the entry.
Use Support/Resistance or Supply/Demand zones to place the order.
Example: Price hits a Demand Zone + ICIS signals "Cycle Bottom" + Confluence turns Green = High Probability Trade.
Conclusion
The Institutional Cycle Intelligence System version 2.0 represents a paradigm shift from lagging indicators to predictive cycle modeling. By intelligently fusing seven different mathematical models, it cancels out the weaknesses of individual algorithms (like EMD's end-effect issues or Fourier's spectral leakage).

Summary of Workflow:

Check the Table: Is Cycle Strength high? Are cycles aligned?
Check the Background: Is it Green (Bullish) or Red (Bearish)?
Wait for the Composite Trigger: Cross of Zero or Cross of Threshold.
Execute: With defined risk based on market structure.
This tool provides the retail trader with the "X-Ray vision" into market structure typically reserved for quantitative trading desks.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.