Indicator

Goertzel Algorithm [LB]🔬 Concept
The Goertzel Algorithm, developed by Gerald Goertzel in 1958, is a digital signal processing technique that efficiently computes individual terms of the Discrete Fourier Transform (DFT). Unlike a full FFT which calculates all frequency bins, the Goertzel Algorithm targets a single predetermined frequency — making it the optimal tool for detecting the presence and power of a specific cycle period within a price series.
📐 Mathematical Foundation
The algorithm implements a second‑order recursive filter with a resonance at the target frequency. For a target period T , the normalized angular frequency is :
ω = 2π / T
The recurrence relation is applied to each sample x in the window :
Q = x + 2·cos(ω)·Q - Q
After processing N samples, the complex DFT coefficient is extracted without storing intermediate values :
Re = Q - Q ·cos(ω)
Im = Q ·sin(ω)
The output is the squared magnitude (power) of that frequency component :
Power = Re² + Im²
This approach requires only one multiply and two additions per sample, making it substantially lighter than a full FFT when monitoring a single cycle.
🎯 What Problem Does It Solve ?
Classic oscillators and moving averages operate blindly across all frequencies, mixing signal and noise. FFT‑based indicators attempt spectral analysis but compute hundreds of unnecessary frequency bins, wasting computational resources and introducing lag. The Goertzel Algorithm isolates the exact cycle period the trader wants to monitor, delivering pure frequency‑domain intelligence with minimal overhead.
📊 How To Interpret
Power rising and sustained at high levels → the target cycle period is strongly present in the price action ; the market is respecting the chosen rhythm.
Power declining toward zero → the target cycle has faded ; the market is no longer oscillating at that frequency.
Sharp power spike → the cycle has suddenly emerged ; potential entry signal when a known period (e.g., 20‑bar) becomes active.
Compare multiple instances with different periods → add the indicator twice with different target periods (e.g., 10 and 20 bars) to see which cycle dominates.
⚙️ Parameters
Target Period (bars) – the exact cycle length to detect ; typical values are 10, 20, 50, or any dominant cycle observed on the chart.
Analysis Window Length – number of bars over which the algorithm computes the power ; longer windows give more frequency resolution but slower response.
Source – price data used as input (close, HLC3, etc.).
📚 Reference
Goertzel G., "An Algorithm for the Evaluation of Finite Trigonometric Series", The American Mathematical Monthly, Vol. 65, No. 1, pp. 34‑35, January 1958.
Proakis J.G. & Manolakis D.G., "Digital Signal Processing : Principles, Algorithms, and Applications", Chapter 6 – Efficient Computation of the DFT, Prentice Hall, 1996. Indicator

Hilbert Bandwidth [LB]🔬 Concept
The Hilbert Bandwidth Index, derived from John Ehlers' analytic signal approach, measures the instantaneous stability of the dominant market cycle by computing the bandwidth — the absolute deviation between the raw instantaneous period and its smoothed counterpart. A narrow bandwidth indicates a clean, well-defined cycle suitable for trading.
📐 Mathematical Foundation
The price median is transformed via a 7‑coefficient FIR Hilbert Transform to extract the analytic signal's real and imaginary components :
real = 0.0962·P + 0.5769·P - 0.5769·P - 0.0962·P
imag = 0.0962·P + 0.5769·P - 0.5769·P - 0.0962·P
The instantaneous phase φ is obtained via the two‑argument arctangent of imag and real . After exponential smoothing, the phase difference Δφ between consecutive bars yields the instantaneous period :
T = 2π / |Δφ|
Finally, the bandwidth is defined as :
B = |T - EMA(T, L) |
where L is the period smoothing length. The result is expressed in bars.
🎯 What Problem Does It Solve ?
Traditional cycle indicators assume a persistent dominant cycle, producing unreliable signals during chaotic or transitional markets — the Hilbert Bandwidth quantifies cycle cleanliness in real time, allowing traders to filter out low‑quality cyclic signals and act only when the market exhibits a stable, tradeable rhythm.
📊 How To Interpret
Bandwidth below threshold (background colored) → the dominant cycle is narrow, well‑defined, and stable ; trend‑following and cycle‑based strategies have higher probability of success.
Bandwidth above threshold → the cycle is broad and unstable ; the market is either noisy or in transition ; avoid cycle‑dependent entries.
Bandwidth rapidly contracting → the market is shifting from chaos to order ; anticipate a breakout or the emergence of a clean trend.
⚙️ Parameters
Phase Smoothing – exponential smoothing length applied to the instantaneous phase (default 50) ; higher values stabilize the phase estimate but introduce lag.
Period Smoothing – EMA length applied to the instantaneous period (default 10) ; controls the responsiveness of the bandwidth calculation.
Narrow Band Threshold – the bandwidth value in bars below which the cycle is considered "clean" (default 3.0) ; the background is highlighted when bandwidth falls below this level.
📚 Reference
Ehlers J.F., "Rocket Science for Traders : Digital Signal Processing Applications", Chapter 7 – The Hilbert Transform, John Wiley & Sons, 2001.
Ehlers J.F., "Cycle Analytics for Traders", Chapter 9 – Bandwidth Measurement, John Wiley & Sons, 2014. Indicator

LINK Grid - Long IndicatorLINK Grid — Long Indicator
🔷 What it does:
This is a signal-only indicator that mirrors a price-grid long workflow on LINK / USDT between two fixed bounds. It tracks up to 36 independent virtual slots between a configurable High and Low — each slot fires a webhook-ready buy signal when price crosses down through it, and a paired sell signal when price subsequently crosses up through the slot immediately above. The indicator computes a running average entry, total deployed capital, and open PnL from the live slot ledger and renders all of it on the chart.
- Pre-computes 7–200 grid levels in Geometric (default) or Arithmetic spacing.
- Each slot is an independent ownership flag with its own buy/sell webhook payload.
- Avg entry is derived from fill-by-fill bookkeeping — total cost and total qty are updated on every event.
- Every event emits a webhook-ready JSON alert payload tagged with the specific grid slot.
🔷 Who is it for:
- Swing traders harvesting volatility on LINK in range-bound regimes.
- Bot operators looking for a chart-driven signal source that emits per-slot JSON ready for a DCA Bot configured for grid execution.
- Traders who want to monitor a virtual grid state — avg entry, owned slots, deployed capital, open PnL — directly on the chart without a backtest engine.
- Portfolio operators using a high-trade-count contributor alongside directional strategies.
🔷 How does it work:
Grid Construction: On script load, the indicator computes N price levels between the configured High and Low bounds. In Geometric mode (default), level k is at High × (Low/High)^(k/(N-1)), giving constant percent spacing — approximately 0.6% per step at default settings. In Arithmetic mode, levels are linearly spaced by absolute price.
Per-Slot State Machine: Each grid level is an independent slot tracked by a boolean ownership flag. When close price crosses down through an empty slot's level, the slot is marked owned, virtual cost-basis is added, and the BUY webhook payload is dispatched. When close price crosses up through the level immediately above an owned slot, the slot is marked free, virtual cost-basis is subtracted, and the SELL webhook payload is dispatched.
Honest Virtual Bookkeeping: Total cost and total qty are updated incrementally on each event, so the avg entry, deployed capital, and open PnL displayed in the status table reflect the actual broker-equivalent position state — no shortcuts from base entry, no synthetic averaging.
No Trailing, No Stop Loss: By design, each slot has a fixed exit (the level above). The indicator never trails the exit and never signals a slot-out for a loss — slots that fall below their entry stay owned until price comes back. This is the canonical grid-bot behavior.
🔷 Why it's unique:
- Per-Level Webhook Ledger: Every BUY and SELL emits a fully-formed JSON alert payload tagged with the specific grid slot ("Grid_BUY_L5" / "Grid_TP_L5"). The indicator can drive a DCA Bot configured for grid emulation without any glue layer.
- Fill-by-Fill Avg Entry: The orange avg-entry line is derived from running totals updated on every event — what you see is what the broker-equivalent position would actually have.
- Active Slot Highlighting: Owned grid levels are rendered with a thicker green stroke; empty slots stay dashed gray. Slot density and current loading are visible at a glance.
- Range Box & Bounds Labels: A semi-transparent box spans the configured High/Low range, and crisp HIGH/LOW labels mark the bounds — the grid topology is obvious without zooming.
- Calibrated for LINK 15m: Default bounds, level count, and step size are set against LINK's recent observed range — granular enough to catch frequent 15m round-trips, wide enough to avoid fee churn.
🔷 Considerations Before Using the Indicator:
Market Selection & Range Validity: Grid strategies are most profitable in range-bound, mean-reverting markets. On strong directional trends below the configured Low, slots will keep marking as owned as price falls and won't free until price reverses. The default High/Low (10.07 / 8.17) was set against LINK's recent observed range; update both whenever the regime changes.
Capital Deployment: The default Total Investment of 10,000 USDT is a virtual reference used for the avg-entry and open-PnL computation. The real sizing happens on the bot side — match the indicator's per-slot allocation to your bot's grid configuration to keep the avg-entry display honest.
Cross Detection Granularity: Crossings are detected on bar close, comparing the current close to the previous close. A bar that spikes through a level and returns within the same bar may be missed by design — this prevents over-signaling on intra-bar wicks.
Live vs Historical State: The virtual slot ledger is rebuilt from chart history each time the indicator is recompiled. If the indicator is added mid-deployment or the live bot diverges from the signal stream (manual interventions, partial fills), the indicator state may not match the live bot. Toggle the indicator off and on to reset.
No Stop Loss: There is no exit signal on adverse moves below the lowest grid level. Risk is structurally capped on the bot side by the bounded Total Investment configured at the bot. If a hard stop is required, layer it on the bot side.
Backtesting Note: This is an indicator, not a strategy. There is no built-in P&L tester. For performance metrics over a 3.5-month sample (~1,285 closed trades, 61.79% win rate, 9.96% max drawdown, profit factor 1.621, +14.82% net return), use the companion strategy version on identical parameters.
🔷 How to Use It:
🔸 Add the indicator to a LINK / USDT 15m chart.
🔸 Set the High and Low bounds to a range you expect LINK to respect.
🔸 Pick Geometric (default, recommended) or Arithmetic spacing.
🔸 Set Grid Levels (7–200) and the virtual Total Investment used for avg-entry computation.
🔸 In the DCA Bot Webhook group, paste your Bot ID, Email Token, and Pair (QUOTE_BASE format, e.g., USDT_LINK).
🔸 Create an alert on the indicator with "Any alert() function call". Paste the DCA Bot's webhook URL into the alert's Webhook field. Every grid-level buy and grid-level close will emit a dedicated JSON payload tagged with the slot index, so each level can be tracked independently downstream.
🔷 INDICATOR SETTINGS
High Price: Top of the grid. The highest level a slot can be created from.
Low Price: Bottom of the grid. The lowest level a slot can be created from.
Grid Levels: Number of price levels between High and Low (default 36, range 7–200).
Spacing Mode: Geometric (constant percent step) or Arithmetic (constant absolute step).
Total Investment (USDT): Virtual capital allocated across all slots. Used for the avg-entry and open-PnL computation only.
Bot ID / Email Token / Pair: Webhook fields injected into every alert payload.
Visualization: Toggle grid lines, range box, HIGH/LOW labels, avg entry plot, fill labels, signal triangles, status table.
Brand Watermark: Configurable text, position, size, and transparency.
👨🏻💻💭 We hope this tool helps enhance your trading. Your feedback is invaluable, so feel free to share any suggestions for improvements or new features you'd like to see implemented.
__
The information and publications within the 3Commas PulseWire account are not meant to be and do not constitute financial, investment, trading, or other types of advice or recommendations supplied or endorsed by 3Commas and any of the parties acting on behalf of 3Commas, including its employees, contractors, ambassadors, etc. Indicator

LINK Grid Bot - Long StrategyLINK Grid Bot — Long Strategy
🔷 What it does:
This is a long-only price-grid strategy that harvests volatility on LINK / USDT through repeated round-trips on a pre-defined ladder of price levels between two fixed bounds. Each level is an independent slot: when price crosses down through a level, the strategy opens one slot; when price subsequently crosses up through the level immediately above, that slot is closed for a fixed round-trip profit. The grid is generated geometrically by default, so spacing adapts to the price scale.
- Up to 36 simultaneous long slots at default settings, each sized as a fixed fraction of the configured Total Investment.
- No trailing exit, no stop loss — each slot's exit is the level above its entry.
- Per-slot exposure is approximately 2.78% of equity at default settings, comfortably inside the 5–10% per-trade risk band.
- Every fill and close emits a webhook-ready JSON alert payload tagged with the specific grid slot.
🔷 Who is it for:
- Swing traders harvesting volatility on LINK in range-bound regimes.
- Bot operators looking for a chart-driven signal source with per-slot webhook JSON ready to drive a DCA Bot configured for grid execution.
- Traders running a portfolio of low-correlation strategies who want a high-trade-count contributor with bounded per-trade risk.
- Range traders who prefer mechanical execution over discretionary entries.
🔷 How does it work:
Grid Construction: On script load, the strategy computes N price levels between the configured High and Low bounds. In Geometric mode (default), level k is at High × (Low/High)^(k/(N-1)), giving constant percent spacing — approximately 0.6% per step at default settings. In Arithmetic mode, levels are linearly spaced by absolute price.
Per-Slot Logic: Each grid level is an independent slot tracked by a boolean ownership flag. When bar close moves price down through an empty slot's level, a long is opened at that level for one slot's worth of capital (Investment / N). When bar close moves price up through the level immediately above an owned slot, that slot is closed, locking the round-trip profit between the two adjacent levels.
No Trailing, No Stop Loss: By design, each slot has a fixed exit (the level above). The strategy never trails the exit and never stops a slot out for a loss — slots whose entry price is below current market simply wait until price comes back. This is the canonical grid-bot behavior.
Capital Bounds: Total deployed capital cannot exceed the configured Investment. When all 36 slots are filled, no new orders are opened until price rises and starts closing slots. This structural cap is the strategy's primary risk control.
🔷 Why it's unique:
- Per-Level Webhook Ledger: Every fill and close emits a fully-formed JSON alert payload tagged with the specific grid slot ("Grid_BUY_L5" / "Grid_TP_L5"). The strategy can drive a DCA Bot configured for grid emulation without any glue layer.
- Pre-Allocated State: All up to 200 slot ledgers live in fixed-size arrays, so state lookups are constant-time and the chart can render every active slot with no performance overhead.
- Honest Backtest Surface: The avg entry line plotted on the chart and the open PnL displayed in the status table both reflect the actual broker-equivalent position state — derived from fill-by-fill bookkeeping, not synthetic averaging.
- Calibrated for LINK 15m: Default bounds, level count, and step size are set against LINK's recent observed range. The 36-level geometric ladder gives roughly 0.6% per step — granular enough to catch frequent 15m round-trips, wide enough to avoid fee churn.
🔷 Considerations Before Using the Strategy:
Market Selection & Range Validity: Grid strategies are most profitable in range-bound, mean-reverting markets. On strong directional trends below the configured Low, slots will keep loading as price falls and won't close until price reverses. The default High/Low (10.07 / 8.17) was set against LINK's recent observed range; update both whenever the regime changes.
Capital Deployment & Drawdown: The default Investment of 10,000 USDT equals 100% of starting capital — high-conviction setting that assumes the configured range holds. Backtest produced a 9.96% maximum equity drawdown at default settings, right at the upper edge of PulseWire's typical 5–10% per-trade band. Per-slot risk remains low (~2.78% of equity), but if price collapses below the Low bound, aggregate unrealized loss can grow further. Scale the Investment input down to match the worst-case drawdown you are willing to absorb in a range-break scenario.
No Stop Loss Justification: There is no exit on adverse moves below the lowest grid level. The strategy's per-trade risk is structurally capped by the per-slot allocation (Investment / N levels) — at defaults that is 278 USDT per slot, well inside the conventional 5–10% per-trade band. The aggregate unrealized exposure is controlled separately via the Investment input.
Trade Volume & Fees: Grid bots on 15m generate a very high number of round-trips. The backtest produced 1,285 closed trades in 3.5 months — exceptional sample size, but also high cumulative fee load. The default commission (0.1% per trade) is calibrated for Binance / Bybit spot taker conditions; any mismatch with your exchange's actual fees will materially shift the results.
Demo Testing: Always demo-test before going live. Past results do not guarantee future performance, especially on a strategy whose profitability is bounded by the chosen High/Low range remaining valid.
🔷 STRATEGY PROPERTIES
Symbol: BINANCE:LINKUSDT (Spot) — strategy is portable to any LINK / USDT pair.
Timeframe: 15M
Test Period: February 11, 2026 — May 27, 2026 (~3.5 months).
Initial Capital: 10,000 USDT.
Total Investment: 10,000 USDT (100% of capital, high-conviction setting).
Order Size per Slot: Investment / 36 ≈ 278 USDT (~2.78% of equity).
Commission: 0.1% per trade.
Slippage: 3 ticks.
Margin for Long Positions: 100%.
Indicator Settings: Default Configuration.
Grid Bounds: High 10.07 / Low 8.17 (range −18.87%).
Grid Levels: 36 (Geometric spacing, ~0.6% per step).
Stop Loss: None — per-slot allocation is the structural risk cap.
Trailing: None.
Strategy: Long Only.
🔷 STRATEGY RESULTS
⚠️ Remember, past results do not guarantee future performance.
Net Profit: +1,482.00 USDT (+14.82%)
Max Equity Drawdown: 1,092.02 USDT (9.96%)
Total Closed Trades: 1,285
Percent Profitable: 61.79% (794 / 1,285)
Profit Factor: 1.621
🔷 How to Use It:
🔸 Adjust Settings: Open the strategy inputs and set the High and Low bounds to a range you expect LINK to respect. Pick Geometric for percent-spaced levels (default, recommended) or Arithmetic. Set Grid Levels (7–200) and Total Investment to match your risk profile.
🔸 Results Review: Run a full-period backtest and confirm Max Drawdown stays within your personal risk band. Validate that the trade count is high enough to be statistically meaningful (≥ 100 closed trades is a reasonable floor — at default settings the strategy typically generates several hundred to over a thousand round-trips per 3-month window on LINK 15m).
🔸 Create alerts to trigger the DCA Bot: Add one alert on the strategy using "Any alert() function call". Paste your DCA Bot's webhook URL into the alert's Webhook field, and fill the Bot ID, Email Token, and Pair inputs on the script. Every grid-level buy and grid-level close will emit a dedicated JSON payload tagged with the slot index, so each level can be tracked independently downstream.
🔷 INDICATOR SETTINGS
High Price: Top of the grid. The highest level a slot can be created from.
Low Price: Bottom of the grid. The lowest level a slot can be created from.
Grid Levels: Number of price levels between High and Low (default 36, range 7–200).
Spacing Mode: Geometric (constant percent step) or Arithmetic (constant absolute step).
Total Investment (USDT): Total capital allocated across all slots. Per-slot size = Investment / Grid Levels.
Bot ID / Email Token / Pair: Webhook fields injected into every alert payload.
Visualization: Toggle grid lines, range box, HIGH/LOW labels, avg entry plot, fill labels, status table.
Brand Watermark: Configurable text, position, size, and transparency.
👨🏻💻💭 We hope this tool helps enhance your trading. Your feedback is invaluable, so feel free to share any suggestions for improvements or new features you'd like to see implemented.
__
The information and publications within the 3Commas PulseWire account are not meant to be and do not constitute financial, investment, trading, or other types of advice or recommendations supplied or endorsed by 3Commas and any of the parties acting on behalf of 3Commas, including its employees, contractors, ambassadors, etc. Strategy

Strategy

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Elliott Structure Pro RC [Gabremoku]Elliott Structure Pro RC is a market structure and wave-mapping overlay designed to detect candidate Elliott impulse patterns using pivot logic, ZigZag structure, validation rules, invalidation levels, and projected Fibonacci targets.
This script does not claim to produce definitive Elliott Wave counts. Instead, it scans recent pivot structure and highlights the most coherent bullish or bearish candidate sequence based on alternating swing logic, structural progression, and optional Elliott validation filters. That framing is important because Elliott Wave interpretation is inherently subjective, while the classic impulse model still relies on a few widely accepted structural rules.
What it shows
🔺 ZigZag market structure — the script builds a cleaned pivot path from swing highs and lows, filtering out smaller fluctuations to make structure easier to read. ZigZag-style logic is commonly used to reduce chart noise and highlight meaningful turning points.
🏷️ HH / HL / LH / LL tags — every pivot can be classified into higher high, higher low, lower high, or lower low structure, helping the user read trend progression directly from price swings.
🌊 Candidate Elliott 1–5 sequence — the script scans recent pivots and searches for the best bullish or bearish 5-wave impulse candidate.
❌ Invalidation tracking — once a candidate is found, the script projects an invalidation level and can flag when the structure has been broken.
🔤 Optional ABC correction — after a 5-wave sequence, the indicator can also look for a basic A-B-C corrective continuation.
📏 Fibonacci projections — projected target levels for Wave 3 and Wave 5 are plotted using configurable Fibonacci multipliers. Fibonacci extensions are commonly used in Elliott analysis to estimate probable Wave 3 and Wave 5 zones.
🪧 Dashboard — shows state, mode, pivot count, direction, validation strictness, ABC status, broken structure state, and target visibility.
Core logic
The script begins with pivot highs and pivot lows, then compresses them into a cleaner alternating sequence. From there, it builds a structural map and scans the most recent pivots to find a valid 6-point sequence that can represent a 5-wave bullish or bearish impulse candidate.
In practical terms, it combines:
market structure
ZigZag logic
Elliott candidate matching
rule-based validation
invalidation and target projection
That makes it useful as a structure-reading tool first, and an Elliott helper second.
Validation model
The script offers two operating styles:
Semplificato
Avanzato
In simplified mode, the indicator focuses more on structural coherence and swing progression. In advanced mode, it can apply stricter Elliott-style validation rules such as:
Wave 3 not shortest
Wave 4 no overlap with Wave 1 territory
invalid candidate marking when rules are not respected
Those rules align with widely cited core Elliott impulse rules. In standard impulse structures, Wave 3 may not be the shortest of Waves 1, 3, and 5, and Wave 4 should not overlap Wave 1 territory except in special formations such as certain diagonals.
Fibonacci targets
The indicator also projects two practical target references:
Wave 3 target
Wave 5 target
In Elliott analysis, Wave 3 is often projected using Fibonacci expansion of Wave 1, with 1.618 being one of the most common reference ratios, while Wave 5 is often estimated from prior impulse relationships or partial trend expansion logic.
Your script uses configurable multipliers, which is a good choice because different markets and timeframes can produce different expansion behaviors.
How to use
A practical workflow is:
Let the script identify the active pivot structure.
Check whether the chart is printing HH/HL or LH/LL logic.
Watch for a highlighted bullish or bearish 1–5 candidate.
Use the invalidation level to judge whether the count remains structurally valid.
Use projected Fib targets as reference zones, not guaranteed endpoints.
If enabled, monitor whether a simple ABC correction starts forming after the impulse.
This is best used as a decision-support overlay, especially for traders who already read market structure and want an automated way to visualize possible wave candidates.
Features
✅ Pivot-based market structure engine
✅ ZigZag overlay with configurable sensitivity
✅ HH / HL / LH / LL classification
✅ Candidate bullish and bearish Elliott impulse detection
✅ Simplified or advanced scan mode
✅ Optional strict Elliott validation
✅ Wave 3 not shortest filter
✅ Wave 4 overlap validation
✅ Broken-structure detection
✅ Invalidation level plotting
✅ Optional ABC correction detection
✅ Fibonacci Wave 3 / Wave 5 projections
✅ Dashboard and optional bar coloring
✅ Gradient-based swing visualization
Notes
This indicator is designed to identify candidate Elliott structures, not to replace discretionary wave analysis. Elliott interpretation is partly rule-based and partly interpretative, so projected counts and targets should always be confirmed with broader market context, price action, and risk management.
Author: Gabremoku
Pine Script v6 Indicator

Indicator

Indicator

Indicator

Bitcoin Compressing Power Law ChannelBitcoin Compressing Power Law Channel
Most Bitcoin power-law channels draw bands of a fixed width around a long-term trendline. This one is different: the channel width is not constant. It starts wide and compresses exponentially as Bitcoin matures, modeling the idea that long-term volatility around the trend tends to shrink over time. That decaying width is the core idea of this indicator.
Why a compressing channel
A standard power-law channel assumes the spread between its upper and lower bounds stays the same across Bitcoin's entire history. In practice, an asset's relative volatility tends to fall as it grows larger and more liquid. This indicator captures that by letting the channel narrow over time toward a configurable floor, so the bounds reflect a maturing market rather than a permanently fixed range.
How it works
The model assumes log(price) scales linearly with log(days since the genesis block), producing a fair-value trendline: logFair = intercept + slope * log10(days). A lower bound is offset below that line, and the upper bound is placed above the lower bound at a distance set by the channel width.
The width itself is the original part: width = minWidth + startWidth * exp(-decaySpeed * yearsSinceGenesis). Early in Bitcoin's history the exponential term is large and the channel is wide. As years pass, that term shrinks toward zero and the width converges to a minimum floor (minWidth). The result is a channel whose envelope tightens over time instead of staying fixed.
What it plots
Three lines in price space (upper, middle, lower) with a shaded fill between the upper and lower bounds. Optionally, a 200 SMA of the current timeframe and a 200 SMA from the weekly timeframe, each toggleable. The weekly SMA is requested from a higher timeframe with lookahead disabled, so it does not repaint using future data. A normalized "Decay Channel Oscillator" is exposed in the Data Window, showing where the current close sits within the channel on a 0 to 1 scale (0 = lower bound, 1 = upper bound).
Inputs
Every model parameter is adjustable: the genesis date, the power-law intercept and slope, the lower offset, the initial and minimum channel widths, and the decay speed that controls how fast the channel compresses. Colors for each line, the fill, and both SMAs are configurable.
How to use it
Apply it to a Bitcoin chart on a longer timeframe such as Daily or Weekly, where a power-law model is most meaningful. The middle line is the model's central estimate; the upper and lower lines describe the expected long-term range, narrowing as time goes on. The Data Window oscillator lets you read how stretched price is within the channel numerically.
Parameters and calibration
The default intercept and slope are starting values that approximate Bitcoin's historical power-law fit. They are not fixed truths. You should re-evaluate them and adjust them, along with the offset, widths, and decay speed, to suit your own analysis and the data range you are studying. Different calibrations will move the channel and change how aggressively it compresses.
Limitations and cautions
This is a model, not a prediction. The power-law relationship is an empirical observation that may break down at any time, and the decay parameters are assumptions, not facts. The compressing width is a hypothesis about volatility maturing over time; it may not hold. This indicator is built for Bitcoin and is not intended for other assets. Nothing here forecasts future prices, and the past behavior of the channel does not guarantee anything about how price will behave going forward.
The code is open-source under the Mozilla Public License 2.0. You are welcome to study it and build on it. Indicator

KNN Market Regime Engine [Dots3Red]█ OVERVIEW
Most market regime tools work in a pretty simple way: we set a threshold and call it a day. ADX above 25? Trending. Below 20? Ranging.
But that threshold is basically just our assumption baked into code. It doesn’t adapt, it doesn’t learn, and it’s treated the same whether we’re looking at Bitcoin, EUR/USD, or any other market — even though they behave completely differently.
This script takes a different approach . It uses a K-Nearest Neighbors (KNN) machine learning algorithm to estimate the probability that the current market is in one of three regimes: Trending , Ranging , or Volatile Trend . Rather than comparing today's readings against a fixed number, it searches the past 700 bars for the moments that looked most like right now - and asks what the market did after each of those moments. The result is a live probability for each regime, not a hard categorical label.
The output is three things simultaneously:
a background color telling you the dominant regime
a dashboard showing live probability bars for all three states
change markers appearing only when the classifier is genuinely confident a shift has occurred.
█ THE FOUR REGIMES
🔵 TRENDING — price is moving directionally with efficiency. Momentum strategies belong here. Mean reversion strategies get punished here.
🟣 RANGING — price is oscillating between levels with no net directional movement. Mean reversion strategies and fade-the-extreme setups have edge here. Trend-following generates whipsaws.
🟡 VOLATILE TREND — price is trending and ATR has expanded sharply beyond its baseline. This captures earnings gaps, macro shocks, and post-breakout expansion. It is a distinct fourth state — not simply "a strong trend." Reduce size or trail very tightly.
⬛ UNCERTAIN — the dominant probability did not clear the minimum confidence threshold. The market's character is genuinely ambiguous. The best action is observation, not engagement.
█ HOW IT WORKS — THE FULL PIPELINE
Step 1 — Six features, measured every bar
Each bar is described by six measurements, each capturing a different dimension of market character:
• ADX — trend strength. Not direction — only how strongly price is committed to any direction.
• ATR ratio — current ATR divided by its own long-term average. Measures whether volatility is elevated or compressed relative to its own history.
• Choppiness Index — measures how much of the price movement was wasted going sideways. Near 100 = pure chop. Near 38 = perfectly directional.
• Bollinger Band width — how expanded or compressed the bands are relative to price. A compression often precedes volatile expansion.
• Normalized slope — linear regression slope over N bars, divided by ATR. A scale-free measure of directional momentum.
• Kaufman Efficiency Ratio — how directly did price move from A to B? If price traveled 100 points total but only net-moved 20, ER is 0.20. High ER = trending cleanly. Low ER = zigzagging.
Step 2 — Z-score normalization
ADX runs 0–100. ATR ratio runs 0.5–3.0. BB width might be 0.01–0.08 on forex. Using raw values in a distance calculation means the largest-scale feature dominates by sheer magnitude. All six features are standardized: z = (value − rolling mean) / rolling stdev . This puts every feature on equal footing — a reading of +2.0 means " two standard deviations above normal " on any feature. Critically, the mean and stdev are computed on prior bars only ( src offset), which eliminates look-ahead bias from the normalization step.
Step 3 — Labeling historical bars
For every historical bar, the script evaluates what happened over the following Forward Bars window:
• If the net price move exceeded Trend Threshold × average ATR over the window → labeled TRENDING (1)
• If the ATR ratio exceeded Volatility Threshold → labeled VOLATILE TREND (3)
• If trending AND volatile simultaneously → labeled VOLATILE TREND (3), because risk context takes priority
• Otherwise → labeled RANGING (2)
This label is only ever read at an offset of at least Forward Bars bars into the past, so the current bar carries no label — there is no look-ahead in the training data.
Step 4 — KNN search and Gaussian-weighted voting
On each bar, the algorithm scans the historical window (default 700 bars) and computes the Minkowski distance between today's six Z-scored features and every historical bar's six features. The K nearest matches are selected. Closer neighbors receive exponentially higher voting weight via a Gaussian kernel : w = exp(−d² / 2σ²) . This means a bar at distance 0.1 vastly outweighs one at distance 0.5. The votes produce three probabilities — P(trending), P(ranging), P(volatile trend) — that always sum to 1.
Step 5 — Three-stage noise filtering
A single KNN output can flicker bar to bar. Three filters eliminate this:
• Mode filter — selects the most common regime over the last smooth_len bars. Removes 1-3 bar flickers entirely.
• Confirmation filter — the smoothed regime must hold steady for confirm_bars consecutive bars before being accepted. Kills false starts.
• Signal gap — regime change markers only appear once per signal_gap bars minimum, and only when the dominant probability exceeds 65%. This eliminates cluttered charts entirely.
█ DESIGN DECISIONS — WHAT WAS INITIALLY, WHAT CHANGED AND WHY
From 3 regimes to 4
The first idea used three regimes with a simple override: if volatility was high, VOLATILE replaced TRENDING regardless of whether price was actually moving directionally. Testing on stocks showed this caused problems — an earnings-day spike during a clear uptrend was collapsing the trend signal entirely. We realized volatile trending markets are qualitatively different from volatile ranging markets. A fast trend during an OPEC announcement is not the same as a gap-down in a sideways consolidation. VOLATILE TREND became its own regime, and the distinction turned out to be the most practically useful change in the entire script.
From stride = fwd_bars to stride = 3
The early idea for the script we had sampled the training window with a stride equal to Forward Bars (30 by default). This gave roughly 23 training samples — barely enough for KNN to make a meaningful comparison. Reducing the stride to 3 gives approximately 230 samples. The regime classification became dramatically more stable and consistent, especially in quieter markets where the 23-sample version frequently returned UNCERTAIN. The trade-off is slightly more computation, which Pine handles comfortably within its limits.
From a single volatile threshold to a combined trend + volatile check
Originally we labeled VOLATILE based purely on ATR ratio exceeding a threshold. This correctly flagged high-volatility periods but was labeling slow low-ATR trends as RANGING instead of TRENDING during prolonged low-volatility bull markets. The label logic was reworked to check directionality and volatility independently and then combine them: a trending move is TRENDING unless ATR is also elevated, in which case it becomes VOLATILE TREND. This made the label logic honest about what the market was actually doing.
The Efficiency Ratio addition
The original five features (ADX, ATR ratio, Choppiness, BB width, Slope) left a gap: two markets can have identical ADX and slope but very different directional efficiency — one moves in a clean staircase, the other zigzags the same distance. Kaufman's Efficiency Ratio fills this gap. ER = 0.85 on a bar means 85% of all price movement went in the net direction. ER = 0.20 means price was thrashing around and barely net-moved. It proved particularly valuable for distinguishing true trending from noisy ranging in crypto and high-beta stocks.
The regime change marker clutter problem
Early testing produced charts covered in triangles, circles, and diamonds — a new marker on almost every regime flicker. Three parameters were added to solve this: the mode filter, the confirmation bars requirement, and the signal gap. Together they ensure a marker only appears when (a) the majority of recent bars agree on the new regime, (b) it has held for at least N bars, and (c) the KNN confidence is above 65%. The result is 2–6 meaningful markers per year on a daily chart rather than dozens of noisy ones.
█ WHAT YOU SEE ON THE CHART
Background color — the dominant confirmed regime, colored continuously. Cyan = Trending. Magenta = Ranging. Amber = Volatile Trend. No color = Uncertain.
Bar coloring — individual bars colored by the same regime. Toggle off if you prefer your own candle coloring scheme.
Regime change markers — small shapes at confirmed, high-confidence regime transitions only. ▲ below bar = shift to Trending. ● below bar = shift to Ranging. ◆ above bar = shift to Volatile Trend.
Dashboard (top right) — shows the confirmed regime label, confidence percentage, three probability meters (▰▰▰▱▱▱ format), and six live feature readings. The bottom row shows Raw → Smooth (e.g. "T → R") so you can see what the raw KNN output is before the filters process it — useful for understanding when the classifier is about to change state.
█ SETTINGS REFERENCE
🧠 KNN Engine
• K Neighbors — how many historical bars vote. Lower = faster reaction, higher = more stable. Default 25.
• Lookback Window — how many bars to search for neighbors. Larger = more training data. Default 700.
• Minkowski p — distance exponent. 1 = Manhattan (robust to outliers), 2 = Euclidean (standard). Default 2.
• Gaussian bandwidth — how steeply neighbor weight falls with distance. Lower = only the closest neighbors matter. Default 1.5.
• Minimum confidence — probability threshold below which the regime shows as UNCERTAIN. Default 0.45.
🏷️ Labeling
• Forward bars — how many bars ahead define a historical bar's regime label. Match your typical hold time. Default 30.
• Trend threshold — net move must exceed this × avg ATR to label TRENDING. Lower = more bars labeled trending. Default 1.2.
• Volatility threshold — ATR ratio must exceed this to label VOLATILE TREND. Higher = only extreme events qualify. Default 1.5.
📐 Features
• ADX Length — period for the directional movement index. Longer = smoother. Default 20.
• ATR Length — period for average true range. Default 14.
• ATR Baseline — SMA period for the ATR ratio denominator. Longer = more stable baseline. Default 100.
• Choppiness / BB / Slope lengths — feature calculation periods. All default to 20–30.
• Efficiency Ratio Length — Kaufman ER lookback. Default 30.
🧹 Filtering
• Regime Smoothing Lookback — mode filter window. Higher = fewer false regime changes. Default 11.
• Bars to confirm regime — consecutive bars required before a new regime is accepted. Default 4.
• Min bars between signals — minimum spacing between regime change markers. Default 20.
█ SETTINGS BY ASSET CLASS
📈 Large-cap stocks — daily (AMZN, AAPL, NVDA)
Stocks trend slowly over weeks to months, with sharp one-day volatility spikes on earnings. All feature lengths should be longer to resolve the slower regime pace.
• Forward bars: 20–30 | Trend threshold: 0.8–1.2 | Volatility threshold: 2.0–2.5
• ATR Baseline: 100 | ADX / Chop / Slope lengths: 20 | BB length: 30 | EffR: 30
• Smoothing: 11 | Confirm bars: 4–5 | Signal gap: 20
• Note: use 0.8 trend threshold for slow defensive stocks (JNJ, KO), 1.2 for high-beta tech (NVDA, TSLA)
₿ Crypto — daily (BTC, ETH, large caps)
Crypto regimes flip in days, not months. ATR is 3–7× higher than stocks. Shorter windows, lower thresholds, less smoothing.
• Forward bars: 10–14 | Trend threshold: 1.5–2.5 | Volatility threshold: 1.5–2.0
• ATR Baseline: 50–70 | All feature lengths: 14 | EffR: 14–20
• Smoothing: 5–7 | Confirm bars: 2–3 | Signal gap: 7–10
• Note: for altcoins use trend threshold 2.0–2.5; for BTC use 1.5–2.0
💱 Forex — daily (EUR/USD, GBP/USD, USD/JPY)
Forex trends are driven by central bank divergence and last months. Daily ATR is tiny (0.4–0.7% of price). Everything needs to be longer and slower.
• Forward bars: 30–45 | Trend threshold: 0.6–0.8 | Volatility threshold: 2.5–3.0
• ATR Baseline: 120–150 | ADX length: 20–25 | Slope / EffR: 40–50
• Smoothing: 15–21 | Confirm bars: 5–7 | Signal gap: 30–45
• Note: exotic pairs (USD/TRY, USD/ZAR) behave like crypto — use crypto settings instead
🛢️ Commodities — daily (Gold XAU, Oil WTI)
Gold is slow and stable like equities. Oil is fast and event-driven like crypto. Use different profiles.
• Gold: Forward bars 20, Trend 0.8, Vol 2.5, ATR Base 100, Smooth 11, Confirm 4, Gap 20
• Oil: Forward bars 15, Trend 1.2, Vol 2.0, ATR Base 70, Smooth 7, Confirm 2–3, Gap 10
• Note: OPEC events and geopolitical shocks will correctly fire VOLATILE TREND on oil — this is intended behavior
🌐 Indices — daily (SPX, NDX, DAX)
Indices are the most regime-stable asset class. They trend 65–75% of the time and have the cleanest feature signals of any asset.
• Forward bars: 20–30 | Trend threshold: 0.8–1.0 | Volatility threshold: 2.0–2.5
• ATR Baseline: 120 | ADX length: 20 | Smoothing: 11–15 | Confirm bars: 4–5 | Signal gap: 20–30
• Note: NDX is ~30% more volatile than SPX — use trend threshold 1.0 for NDX, 0.8 for SPX
EXAMPLE
█ HOW TO USE WITH OTHER INDICATORS
This script does not generate buy or sell signals. It tells you which type of strategy has edge right now . The intended workflow:
1 — Add your momentum or mean reversion indicator alongside this one.
2 — Only take momentum / trend-following entries when the background is cyan (TRENDING) .
3 — Only take mean reversion / fade entries when the background is magenta (RANGING) .
4 — Reduce position size or step aside entirely when the background is amber (VOLATILE TREND) .
5 — Do nothing when there is no background color — the regime is UNCERTAIN.
Used this way, the classifier acts as a strategy mode selector rather than a signal generator. It is the foundation of a multi-strategy system where the same chart hosts different logic depending on detected conditions.
█ LIMITATIONS
• KNN is a lazy learner — it reflects patterns in its training window. If the current market regime has no historical analog in the lookback window (e.g. a once-in-a-decade crash), the classifier will misclassify or return UNCERTAIN.
• The script requires a warm-up period equal to Lookback Window + Forward Bars bars before producing output. On instruments with limited history this may delay the first valid reading.
• Computation scales with window size and stride. Very large windows (2000+) may slow chart rendering on lower-end machines.
• The reversion probability reflects historical frequency, not a guarantee of future behavior. All market regimes can and do fail.
Human vs Machine 🧠vs 🤖
And most importantly, checking the chart with the HUMAN EYE is different from using the raw ML KNN method - something we agreed on checking the charts, as we, traders-developers, had different opinions of the market regime for an asset price. But the Script might yield results we can all agree upon.
█ DISCLAIMER
This indicator is a decision-support tool, not a trading system. It does not constitute financial advice. Past regime patterns do not guarantee future behavior. Always apply proper risk management.
Algorithm: K-Nearest Neighbors (KNN)
Distance metric: Minkowski Distance (p=2, Euclidean default)
Kernel: Gaussian (distance-weighted voting)
Normalization: Z-Score (look-ahead free)
Regimes: Trending | Ranging | Volatile Trend | Uncertain Indicator

Indicator

SMT Divergence Multi-TF# Smart Money Technique (SMT) — Multi-Timeframe, Multi-Asset Divergence Tracker
**Map every SMT divergence across timeframes and correlated assets — without losing your chart to clutter.**
Smart Money Technique (SMT) divergences are one of the cleanest tools in the ICT toolkit: when two correlated assets fail to confirm the same swing, the divergence reveals that liquidity is being engineered on one side of the move. This indicator detects SMT divergences across up to three comparison assets simultaneously, across eight timeframes, and renders them with smart label handling that keeps the chart readable even when divergences stack.
## Features
**Multi-asset comparison** — track up to 3 comparison assets at once, each independently toggleable. Defaults to MNQ/MES/MYM but accepts any correlated pair (e-minis, micros, equity index ETFs, sector or FX correlations).
**Eight timeframes** — 1m, 3m, 5m, 15m, 30m, 1h, 4h, and Daily, each toggleable independently. Higher timeframes render with thicker dashed lines for instant TF identification at a glance.
**Wick-to-wick line rendering** — divergence lines anchor precisely at the swing wicks, not approximations. Uses bar-time anchoring so lines stay accurate across all timeframes without drifting.
**Smart label collision handling** — when multiple SMTs stack at the same swing point (e.g. 5m + 15m + 30m confluence), labels are automatically offset vertically using ATR-scaled spacing. No overlapping text, no garbled stacks. Smallest timeframe sits closest to the wick; higher timeframes layer outward as visual confluence indicators.
**Clean ticker labels** — strips exchange prefixes and contract suffixes automatically, so `CME_MINI:MNQ1!` displays as just `MNQ`. Each label shows asset and timeframe (e.g. `MNQ · 15m`).
**Configurable colors and styles** — every comparison asset has its own line color. Bullish and bearish SMTs can share a color or split independently for additional visual distinction.
**Per-asset, per-timeframe alerts** — bullish and bearish alert conditions for every combination, so you can route signals by setup quality rather than getting pinged on every minor swing.
**Non-repainting** — uses confirmed pivots and lookahead-off security calls. What prints in real time is what stays.
## Built For
ICT, Quarterly Theory, and Wyckoff traders who want SMT confluence visualized across timeframes and assets simultaneously. Particularly valuable when scanning for high-conviction setups where a single swing point shows divergence across multiple correlated indices and timeframes — the kind of confluence that doesn't survive on charts littered with overlapping text and misaligned lines.
## Settings
- Up to 3 configurable comparison assets (symbol, color, enable per asset)
- 8 independent timeframe toggles
- Pivot strength and cross-asset matching tolerance
- Label stacking: ATR multiplier, max stack height, time tolerance
- Line management: per-TF line limits and style customization
- Ticker cleanup toggle for clean displayed names Indicator

SAO RUBIQ Regime v2# SAO · RUBIQ — Regime Visualizer (v2)
**by SNP420 · Jarvis Claudos · Finexus s.r.o.**
*Pine Script v6 · Build 2026-05-26*
---
## What is it
A research-grade market regime overlay that classifies every confirmed
bar into one of **five regimes** and paints the chart accordingly.
Born out of a simple insight:
> *"The right algorithm in the wrong phase of the market still fails —
> even when it is 100% correct under ideal conditions."*
This is the central thesis of the **SAO · RUBIQ** project: every
strategy lives or dies inside a specific regime × timeframe cell.
Without active regime perception, every trading system is necessarily
under-performing on the bars it was not designed for. This indicator
makes those cells visible.
## What's new in v2
v2 throws out the v1 AND-stack of ADX / BB-width / drift cutoffs and
replaces it with four orthogonal signals that vote together:
- **Fractal pivots** (3-bar centered) labeled **HH / LH / HL / LL**
- **Trend state machine** with **re-anchoring**:
UP / DOWN / RANGE / REVERSAL_UP / REVERSAL_DOWN
- **Multi-TF RSI** on M30 / H1 / H4 / D1 / W1 with per-TF thresholds
and a **≥3 of 5 agreement** rule
- **S/R level clustering** (±0.3 ATR tolerance) with **double-bounce**
reversal flag that persists for 10 bars
Measured improvements over v1.1 on EUR/USD M30, 2024-2025 (24,863 bars):
| Metric | v1.1 calibrated | v2 |
| ----------------------- | --------------- | ----------- |
| Confident coverage | 44.87% | **53.96%** |
| Transitions (less whipsaw) | 1,567 | **855** |
| BULL_CALM Sharpe (h=5) | +0.085 | **+0.271** |
| BEAR_CALM direction | +0.04 ⚠ (wrong)| **−0.19 ✅** |
| Shuffle F-stat (h=5) | 0.0027 | **0.0068** |
| Strategy diagonal score | 1 / 5 | **2 / 5** |
All validated by 1000-iter shuffle Monte Carlo (p < 0.001) and a
strategy × regime P&L matrix.
## The five regimes
| Regime | Meaning |
| ------------- | -------------------------------------------------------- |
| **BULL_CALM** | Trend UP + ≥3 of 5 RSI TFs agree bullish |
| **BEAR_CALM** | Trend DOWN + ≥3 of 5 RSI TFs agree bearish |
| **RANGE** | Mixed last pivots (no clean HH+HL or LH+LL) |
| **CHOPPY** | Trend UP/DOWN without RSI agreement, or active reversal |
| **STRESS** | Volatility spike: rv20_norm > 2 OR atr_z > 2 |
| *UNCERTAIN* | Fallback — pre-warmup or no labels yet (no box drawn) |
Priority order (highest wins): **STRESS > BULL > BEAR > CHOPPY > RANGE.**
## How it works
For every confirmed bar the indicator:
1. Computes ATR(14), realized vol (20), z-scored ATR — used by stress
detection and S/R cluster tolerance.
2. Requests RSI(14) on five timeframes via `request.security`
(M30 / H1 / H4 / D1 / W1) and counts bull / bear agreements.
3. Detects fractal pivots with `ta.pivothigh / pivotlow(3, 3)` and
labels each as HH / LH / HL / LL versus the previous same-type
pivot.
4. Adds each pivot to a greedy S/R level cluster (±0.3 ATR). On the
second touch within 500 bars it fires a **double-bounce reversal**
flag (type H → REVERSAL_DOWN, type L → REVERSAL_UP) that persists
for 10 bars.
5. Maintains a trend state machine: **UP** when last H=HH and last L=HL,
**DOWN** when last H=LH and last L=LL, **RANGE** otherwise.
6. Combines trend × RSI × stress into the final label, then applies
a hysteresis smoother (`min_run = 5 bars`) so single-bar flips
never get committed.
## Visualization (FX-Sessions-style)
- **Dashed segment box** per confirmed regime run, sized to that
segment's high/low.
- **Background tint** — semi-transparent regime color over the span.
- **Bar color** (off by default) — paints OHLC bars with regime color.
- **Segment label** anchored to the top of each box.
- **Pivot markers** — HH / LH / HL / LL drawn at every confirmed pivot
with bull/bear tint.
- **Reversal arrows** — ▲ green at support double-bounces, ▼ red at
resistance double-bounces.
- **Info table** (top-right) — current state, trend, last H and L labels,
RSI per TF, bull/bear agree counts, rv20_norm, atr_z.
- **Stats table** (bottom-right) — N bars and % share per regime across
the visible history.
UNCERTAIN bars deliberately render no box and no tint (clean chart).
## Settings worth knowing
- **Hysteresis min_run** (5) — bars of consistent raw state before
commit. Bigger = less flicker, more boundary lag.
- **Pivot left/right** (3) — fractal pivot window. Smaller catches
more pivots but more noise.
- **Per-TF RSI thresholds** — defaults are 65/35 (M30), 62/38 (H1),
60/40 (H4), 55/45 (D1), 50/50 (W1). Overridable per pair / TF.
- **RSI agree min** (3) — TFs that must agree to qualify as
BULL_CALM / BEAR_CALM. Lower = more sensitive.
- **S/R cluster tolerance** (0.3 × ATR) — width of an S/R level zone.
- **S/R max age** (500 bars) — oldest first-touch still eligible for
double-bounce reversal.
- **Reversal persistence** (10 bars) — how long after the second touch
the REVERSAL state stays active.
- **Max active S/R levels** (200) — FIFO ceiling on level memory.
- **All six regime colors + reversal arrow colors** — fully overridable.
## Sanity-check expectation (EUR/USD M30, 2 years)
If the v2 baseline distribution holds on your data window:
| State | Share |
| --------- | ------ |
| BULL_CALM | ~2.6% |
| BEAR_CALM | ~1.8% |
| RANGE | ~2.4% |
| CHOPPY | ~38.7% |
| STRESS | ~8.4% |
| UNCERTAIN | ~46.0% |
v2 deliberately has stricter BULL / BEAR (needs trend state + 3-of-5
RSI agreement) and a wider CHOPPY (catches trend bars without RSI
agreement + all active reversals). Cleaner regime blocks, better
direction mapping.
## Honest limitations — please read
- **Tuned to EUR/USD M30 vol scale.** Features and rules are
TF-agnostic in math, but the thresholds were calibrated on M30.
On H1 / D1 / crypto / equities the distribution will be approximate
unless you re-tune.
- **v2 direction mapping is improved but not perfect.** Diagonal
score = 2 / 5 (vs 1 / 5 in v1.1). BULL_CALM and BEAR_CALM now point
the right way; RANGE drifts slightly up; CHOPPY and STRESS still
show counter-intuitive mean-reversion edge. **Treat the indicator
as a labeled regime overlay for research, not a stand-alone
trade-direction signal.**
- **Streaming lags exist.** Pivot detection lag ≈ 3 bars,
hysteresis commit lag ≈ `min_run − 1` bars, multi-TF RSI uses
`lookahead=barmerge.lookahead_off` so higher-TF RSI updates only on
higher-TF bar close.
- **S/R level memory capped at 200 (FIFO).** The Python reference
keeps levels unbounded; on very long charts you may see different
bounce decisions than the offline version near the cap.
## Alerts
Seven alert conditions ship in:
- Regime → STRESS
- Regime → BULL_CALM
- Regime → BEAR_CALM
- Regime → RANGE
- Regime → CHOPPY
- Double-bounce UP (support held, second touch)
- Double-bounce DOWN (resistance held, second touch)
Regime alerts fire on transition (state differs from previous bar).
Double-bounce alerts fire at the second-touch bar of any cluster.
## Credits & attribution
- **Visual style** inspired by *FX Market Sessions* by **boitoki**
(Mozilla Public License 2.0). The segment-box-per-run pattern is
borrowed from that script; all classifier logic, feature math,
pivot state machine and S/R clustering is original to SAO · RUBIQ.
- **RUBIQ thesis** — *Rubik's-cube model of the market*: the right
algorithm in the wrong market phase still fails. Distilled from
100+ failed variants across the SAO portfolio.
- **Built by** SNP420 · Jarvis Claudos · Finexus s.r.o.
## License
Same as the parent SAO_RUBIQ project. Use freely, modify freely,
attribute when republishing.
---
*"Trh je proměnlivé prostředí. RUBIQ je centrální nervová soustava,
která to řeší pro všechny SAO strategie."*
— SNP420
Indicator

Indicator
