OPEN-SOURCE SCRIPT
Permutation Entropy Complexity Oscillator

Permutation Entropy (PE) Complexity Oscillator
The Permutation Entropy Complexity Oscillator is a sophisticated market regime filter that measures the "order" vs. "chaos" of price action. Unlike traditional oscillators (RSI, MACD) that rely on price values, this indicator analyzes ordinal patterns (the relative "up-down" sequence of bars).
This makes it exceptionally robust against noise and extremely fast at detecting when a market transitions from a random state into a structured trend.
How it works:
The indicator calculates the Shannon Entropy of price motifs.
High Entropy (Red Zone): The market is in a state of maximum randomness (Chaos). Ordinal patterns occur with equal probability. This is a "No-Trade" zone for trend followers.
Low Entropy (Green Zone): The market is structured and predictable. A specific pattern (e.g., constant higher highs) is dominating. This indicates a strong trending regime.
Trading Edge & Usage:
This tool is designed to be a Regime Filter, not a directional signal generator.
Avoid the "Chop": When the line is Red (High Chaos), avoid trend-following entries. The market is in a "Random Walk" phase where fakeouts are highly likely.
Confirm the Trend: When the line is Green (Predictable), the market has high structural order. This is the time to look for entries using your favorite trend-following system.
Regime Shift Alert: A drop from the Red zone into the Neutral/Green zone often precedes a massive volatility breakout. It signals that "order" is returning to the market.
Key Features:
Noise Immunity: Since it only looks at the rank of prices, it isn't fooled by sudden "fat-finger" spikes or minor gaps.
Visual Clarity: The background and line color change dynamically based on the complexity of the current market state.
V6 Optimized: Built with the latest Pine Script v6 standards for maximum performance and stability.
Settings:
Complexity Lookback: The window size for pattern analysis (Default 100).
Noise/Predictable Thresholds: Adjustable levels to fine-tune the sensitivity to market chaos.
The Permutation Entropy Complexity Oscillator is a sophisticated market regime filter that measures the "order" vs. "chaos" of price action. Unlike traditional oscillators (RSI, MACD) that rely on price values, this indicator analyzes ordinal patterns (the relative "up-down" sequence of bars).
This makes it exceptionally robust against noise and extremely fast at detecting when a market transitions from a random state into a structured trend.
How it works:
The indicator calculates the Shannon Entropy of price motifs.
High Entropy (Red Zone): The market is in a state of maximum randomness (Chaos). Ordinal patterns occur with equal probability. This is a "No-Trade" zone for trend followers.
Low Entropy (Green Zone): The market is structured and predictable. A specific pattern (e.g., constant higher highs) is dominating. This indicates a strong trending regime.
Trading Edge & Usage:
This tool is designed to be a Regime Filter, not a directional signal generator.
Avoid the "Chop": When the line is Red (High Chaos), avoid trend-following entries. The market is in a "Random Walk" phase where fakeouts are highly likely.
Confirm the Trend: When the line is Green (Predictable), the market has high structural order. This is the time to look for entries using your favorite trend-following system.
Regime Shift Alert: A drop from the Red zone into the Neutral/Green zone often precedes a massive volatility breakout. It signals that "order" is returning to the market.
Key Features:
Noise Immunity: Since it only looks at the rank of prices, it isn't fooled by sudden "fat-finger" spikes or minor gaps.
Visual Clarity: The background and line color change dynamically based on the complexity of the current market state.
V6 Optimized: Built with the latest Pine Script v6 standards for maximum performance and stability.
Settings:
Complexity Lookback: The window size for pattern analysis (Default 100).
Noise/Predictable Thresholds: Adjustable levels to fine-tune the sensitivity to market chaos.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.