🫧 Smooth Texture — Low Entropy
Price evolves in ordered, repeating patterns. Causality is high, trends are durable, and momentum approaches are favoured.
The Pattern Texture Codex (PTC) is the TradingView Suite’s market-texture component: a complexity gauge that reads how price moves, rather than how far or how fast. It implements permutation entropy , a measure from dynamical-systems theory that quantifies whether price evolves in ordered, repeating patterns or in chaotic noise.
Standard technical analysis works in two dimensions: amplitude (how far price moves) and momentum (how fast). The Pattern Texture Codex adds a third — structure (how price moves). We call this reading market texture: Smooth texture (low entropy) marks ordered conditions where trends tend to be durable, whilst Rough texture (high entropy) marks chaotic conditions where moves are fragile.
Hover over components to see details. Lines indicate data flow between components.
A smooth uptrend and a choppy consolidation can share identical volatility yet have entirely different texture. Volatility measures the size of moves; texture measures their order. Permutation entropy captures this by analysing the sequence of price movements — the temporal micro-structure — not their distribution or magnitude.
The indicator maps every market moment onto a scale from 0 to 1:
🫧 Smooth Texture — Low Entropy
Price evolves in ordered, repeating patterns. Causality is high, trends are durable, and momentum approaches are favoured.
🌵 Rough Texture — High Entropy
Price evolves chaotically. The market is noisy, trends are fragile, and mean reversion or defensive sizing deserves priority.
Neutral Zone
Entropy sits between the two thresholds — typical market behaviour with no strong claim about structure in either direction.
Because the measure is built from rank orderings rather than raw values, it is scale-invariant — the same reading is comparable across instruments, timeframes, and price levels. That property is also the source of the indicator’s most important limitation, discussed honestly below.
Instead of analysing raw prices, permutation entropy converts each window of consecutive data points into an ordinal pattern — the relative ordering of those points. With embedding dimension D = 3 (three points per pattern), there are 3! = 6 possible patterns:
| Pattern | Ordering | Shape |
|---|---|---|
012 | first < second < third | Ascending |
210 | first > second > third | Descending |
102 | Middle value smallest | Valley |
| Remaining three | Mixed orderings | Peaks and partial rises or falls |
The indicator slides this window across the chart, counts how often each pattern appears over the lookback, and computes the Shannon entropy of that frequency distribution:
H = − Σ p(π) · ln p(π) / ln(D!)where p(π) is the observed probability of each ordinal pattern π, and dividing by ln(D!) normalises the result to the range 0–1:
H → 0: one pattern dominates — highly structured, predictable sequencing.H → 1: all patterns are equally likely — indistinguishable from randomness.The intuition is direct. In a clean uptrend, the ascending pattern keeps recurring and entropy falls. In choppy consolidation, every pattern appears in roughly equal measure and entropy climbs towards 1.
D points (spaced by the configured delay) as an ordinal pattern.N patterns in a sliding window.ln(D!) so the output always lives in the 0–1 range.Many indicators on TradingView carry the word “entropy” whilst measuring something else: Shannon entropy of price histograms (which captures value distribution but ignores temporal sequence), approximate entropy (which measures amplitude similarity at quadratic computational cost), or volatility metrics rebranded with entropy terminology. The Pattern Texture Codex provides true ordinal-pattern analysis — the sequence of movements, with a mathematically valid probability distribution underneath.
Computing each pattern from scratch requires sorting every embedding window. The Pattern Texture Codex instead exploits a structural insight from Unakafova and Keller (2013): successive ordinal patterns in overlapping windows share D − 1 data points, so the new pattern can be derived from the previous one with a single lookup in a precomputed transition table. This reduces the per-bar cost to O(D) work — at most 2D − 2 comparisons — via precomputed transition tables.
The tables come from the open-source PatternTransitionTables library, published as part of the GYTS open-source foundation:
Delay 1 and Dimension 3, 4, or 5.Dimension 2 and 6 fall back automatically to the standard from-scratch calculation.The settings panel moves from data source through the entropy engine, threshold logic, visual styling, and alerts. Start with the defaults, then adjust one group at a time.
| Setting | Default | Notes |
|---|---|---|
Source | close | Price series analysed for ordinal patterns. |
Smoothing critical period | 0 | Range 0–1000. Smooths the entropy line with a 2-pole Ultimate Smoother to reveal the underlying texture; 0 disables smoothing. |
Raw entropy can be jittery bar to bar. A modest smoothing period (for example 20–50) often clarifies the texture reading without materially delaying transitions; the smoothed value is clipped back into the 0–1 range so overshoot cannot produce impossible readings.
| Setting | Default | Notes |
|---|---|---|
Dimension | 4 | Range 2–6. Points per ordinal pattern — the embedding dimension D. |
Pattern Window (N) | 100 | Range 10–10000. Number of patterns used for entropy estimation. Hard minimum: D × 5. |
Delay | 1 | Range 1–10. Stride between the points in each pattern (the embedding delay τ). |
Lookup acceleration | true | Uses precomputed transition tables; active for Dimension 3–5 with Delay 1. |
Choosing the dimension. Each value of D trades sensitivity against statistical appetite:
Dimension | Possible patterns | Character |
|---|---|---|
2 | 2 | Binary up/down only — minimal, no lookup acceleration. |
3 | 6 | Fast and stable; good when history is limited. |
4 | 24 | Balanced; captures V-shaped reversals. Recommended default. |
5 | 120 | Sensitive; captures W- and M-shaped patterns, but noisier. |
6 | 720 | Maximum sensitivity; no lookup acceleration and may be slow. |
Sizing the window. The indicator enforces a hard minimum of D × 5 patterns and refuses to run below it, because entropy estimates from tiny samples are meaningless. The academic recommendation is stricter still: 5 × D! patterns (120 for D = 4, 600 for D = 5). Shorter windows above the hard minimum work in practice but reduce statistical reliability. Note that patterns overlap, so the total bars consumed is N + (D − 1) × Delay — for D = 4 with N = 100 and Delay 1, that is 103 bars.
Delay. The default of 1 suits nearly all financial series; increase it only for oversampled or otherwise exotic data.
Smooth and Rough detection are configured independently — each side has its own mode, and mixing modes is deliberate design, not a workaround. Four modes are available per side:
| Setting | Default | Notes |
|---|---|---|
🌵 Rough Threshold Mode | Disabled | Mode for the upper (Rough) threshold. |
🫧 Smooth Threshold Mode | Dynamic | Mode for the lower (Smooth) threshold. |
🌵 Rough Value (Static) | 0.9 | Range 0.1–1.0. Entropy above this value flags Rough texture (Static mode only). |
🫧 Smooth Value (Static) | 0.7 | Range 0.0–0.9. Entropy below this value flags Smooth texture (Static mode only). |
🌵 Std Dev Multiplier (Rough) | 2.0 | Range 0.5–5.0. Band width above the baseline (Dynamic mode). |
🫧 Std Dev Multiplier (Smooth) | 2.0 | Range 0.5–5.0. Band width below the baseline (Dynamic mode). |
Baseline Length (Dynamic) | 1000 | Period of the Super Smoother baseline for dynamic thresholds. |
Std Dev Length (Dynamic) | 1000 | Lookback for the standard-deviation estimate of the dynamic bands. |
Percentile Lookback | 1000 | Range 20–10000. History used for percentile thresholds. |
🌵 Rough Percentile | 90 | Range 50–100. For example 90 flags only the top 10% of entropy readings. |
🫧 Smooth Percentile | 10 | Range 0–50. For example 10 flags only the bottom 10%. |
Mode-specific settings are only active when their mode is selected — the panel greys out the rest, so an ignored input is never silently misleading. Dynamic thresholds are capped so the Rough band never exceeds 1.0 and the Smooth band never drops below 0.0.
| Setting | Default | Notes |
|---|---|---|
Palette | GYTS Purple | Colour scheme for the entropy line and texture fills. |
Colouring bars | true | Paints chart candles with the detected texture colour. |
Dark Mode | true | Adjusts colour intensity for dark chart backgrounds. |
Line Transparency | 0 | Range 0–100. Transparency of the entropy line. |
Fill Transparency | 25 | Range 0–100. Transparency of the texture-zone fills at their strongest. |
Indicator Name | (empty) | Custom on-chart label, useful when running several instances with different settings (for example “D=3, N=100” versus “D=5, N=500”). |
Repeat Name Every N Bars | 300 | Range 0–10000. Repeats the label through history; 0 shows it only on the most recent bar. |
The entropy line is coloured by percentile rank over recent history, so the full palette is always in use: warm tones for high entropy (Rough), cool tones for low entropy (Smooth). Zone fills intensify as entropy pushes deeper past a threshold — a faint fill means a marginal breach, a strong fill means conviction.
| Setting | Default | Notes |
|---|---|---|
Alert: Texture → Rough | true | Fires when texture transitions into Rough. |
Alert: Texture → Smooth | true | Fires when texture transitions into Smooth. |
Alerts trigger on confirmed bar close, on the transition into a texture state rather than on every bar within it. Two routes exist when creating the alert in TradingView:
The Pattern Texture Codex exports two hidden data streams. They do not clutter the chart, but any indicator on the same chart — GYTS or your own — can select them as an input source.
| Stream title | Meaning | Values |
|---|---|---|
🔗 STREAM PTC 🌵 Entropy (continuous) | Normalised permutation entropy | Float, 0–1 |
🔗 STREAM PTC 🌵 Entropy (ternary) | Texture state | +1 Rough, 0 Neutral, −1 Smooth |
The continuous stream can feed the Flux Composer as a signal or filter input through its threshold-based signal processing:
🔗 STREAM PTC 🌵 Entropy (continuous) as an external input source.The Market Regime Detector and the Pattern Texture Codex answer different questions, and the distinction matters:
A trending regime with Rough texture is a fragile trend; a cyclic regime with Smooth texture is an orderly oscillation. Use the ternary stream as a complexity filter alongside — not instead of — the regime context. The two readings together give a far more complete picture than either alone.
The four core applications, in increasing order of subtlety:
For interpretation, the absolute level carries meaning as well as the threshold crossings: readings below roughly 0.6 indicate strong pattern dominance, the 0.7–0.9 band is typical market behaviour, and values above 0.95 are effectively indistinguishable from randomness. Transitions matter most — entropy rising sharply after a prolonged smooth period is an early warning that the trend is losing structure, whilst entropy falling from elevated levels suggests a new trend may be establishing.
The GYTS Signal Sentinel’s first live strategy, Pattern Texture Codex Ignition, builds on exactly this playbook and is delivered in the GYTS Discord.
Window-length guidance. Shorter pattern windows react faster but estimate less reliably: 50–100 suits intraday regime detection, 100–200 is a balanced swing-trading range, and 200–500 provides stability for position trading or noisy instruments. The default of 100 sits at the responsive end of the balanced swing range; raise it towards 200–500 for greater stability on noisy instruments or longer horizons.
The Pattern Texture Codex measures exactly one thing — ordinal structure — and it is worth being precise about what that excludes:
D × 5 patterns and will refuse to run below it, but statistical comfort genuinely begins around 5 × D!.Coming Soon The Professional Edition is in development along two axes that address the honest limitations above: amplitude-aware entropy variants, which weigh patterns by the magnitude of the moves that form them, and statistical-significance filtering, which distinguishes genuine structure from sampling noise. Details will be published when the edition is released; the Community Edition remains fully open source and methodologically complete in its own right.
The entropy line does not appear on the left of the chart
na during ramp-up.N + (D − 1) × Delay — on instruments with short history, reduce Pattern Window (N) or Dimension.The indicator raises a configuration error
Pattern Window (N) is below the hard minimum of Dimension × 5. The error message states the required value; either increase the window or reduce the dimension.Likely causes and fixes
Smoothing critical period to 20–50.Std Dev Multiplier towards 2.5–3.0.Pattern Window (N) stabilises the estimate.Disabled rather than tolerating its noise.A threshold setting appears to do nothing
Dynamic or Percentile thresholds look wrong early in the chart
1000-bar lookbacks and need that much history to settle. On short histories, shorten Baseline Length (Dynamic), Std Dev Length (Dynamic), or Percentile Lookback — or use Static mode.Calculation feels slow
Dimension 6 has no lookup acceleration and evaluates 720 possible patterns; use Dimension 3–5 (where the transition tables apply) or reduce Pattern Window (N).Colours are hard to read
Dark Mode to your chart theme and reduce Fill Transparency if the zone fills are too faint.Colouring bars competes with other indicators that also paint candles — TradingView honours only one bar-colouring source at a time, so disable it here or there.The Pattern Texture Codex stands on published research and GYTS open-source libraries.
| Source | Reference |
|---|---|
| Bandt & Pompe | C. Bandt and B. Pompe, “Permutation Entropy: A Natural Complexity Measure for Time Series”, 2002, Physical Review Letters (DOI) |
| Unakafova & Keller | V. Unakafova and K. Keller, “Efficiently Measuring Complexity on the Basis of Real-World Data”, 2013, Entropy (DOI) |
| PatternTransitionTables | GYTS PatternTransitionTables Library — open-source precomputed ordinal-pattern transition tables (TradingView) |
| FiltersToolkit | GYTS FiltersToolkit Library — Ultimate Smoother and Super Smoother filters (documentation) |