QM Range (DAFE)Quasimodo Range Engine
A Systematic Framework for Liquidity, Structure, and Range Analysis
A Mechanical Approach to Decoding Market Microstructure and Order Flow.
🎓 THEORETICAL FOUNDATION
The Quasimodo Range Engine (QM-R) is a comprehensive analytical framework designed to map market structure by tracking the flow of liquidity. It is built on the premise that markets frequently engineer liquidity through temporary sweeps of established pivot points, trapping breakout participants before initiating a reversal that breaks local structure.
This specific sequence—a liquidity sweep followed by a structural failure—is classically known as the Quasimodo (QM) pattern. However, the QM-R engine goes beyond simply identifying isolated patterns. It utilizes these patterns as the foundational building blocks to define active trading ranges, track structural shifts (BOS/CHoCH), and project fading Supply and Demand zones.
Architectural Pillars
Pillar 1: 3-Candle Fractal (3CF) Liquidity Mapping
The engine continuously scans for 3-Candle Fractals to identify strict, algorithmic swing highs and lows. It projects horizontal "Liquidity Lines" forward in time from these pivots. These lines represent resting liquidity pools. When price intersects these lines, the engine monitors the reaction to determine if it is a genuine breakout or a liquidity sweep.
Pillar 2: Mechanical Quasimodo Detection
A QM pattern is registered only when a strict sequence of events occurs within a user-defined validity window (QM Break Lookback):
The Sweep: Price must cross a previously established 3CF Liquidity Line.
The Rejection: Price must reverse, closing back within the previous structure.
The Break: Price must then impulsively break the opposing fractal pivot that originated the sweep.
When this sequence completes, the engine draws the QM zone, labels the pattern, and plots a "Trap Vector" showing the mechanics of the sweep-and-break.
Pillar 3: Automated Equilibrium Range Formation
A single QM pattern is a localized event; two opposing QM patterns define a market regime. When a Bullish QM and a Bearish QM form within a specific proximity to each other (Max QM1-QM2 Gap), the engine links them. It establishes the high and low of this sequence as an active Equilibrium Range (ERL/ERH), framing the current consolidated price action.
Pillar 4: Structural Resolution (BOS / CHoCH)
Once a range is established, the engine monitors its boundaries. A confirmed candle close outside the Equilibrium Range signifies a structural resolution.
Break of Structure (BOS): A break in the direction of the dominant macro trend.
Change of Character (CHoCH): A break opposing the established range context.
Upon resolution, the active range is dissolved, and the broken boundary leaves behind a Ghost Line —a historical memory of broken structure that often serves as future, flipped support/resistance.
Pillar 5: Reactive Supply & Demand Origination
Immediately following a BOS or CHoCH, the engine traces back a user-defined number of bars (SD Formation Lookback) to locate the origin candle of the impulsive move. It automatically draws a Supply or Demand zone from this origin. Crucially, these zones feature a degradation mechanic: they fade in opacity with each subsequent price touch, visually representing the consumption of resting orders until they are completely invalidated.
Pillar 6: Footprint Delta Integration & Trap Validation
To validate the "liquidity sweep" phase of the QM pattern, the engine integrates real order flow. If Footprint data is enabled, it analyzes the tick-level delta during the exact candle that swept the pivot.
If a Bullish QM features heavy negative delta (selling) during the downward sweep, it confirms that sellers were successfully trapped.
If Footprint data is unavailable, the engine automatically deploys a sophisticated OHLCV synthetic delta fallback to estimate the intrabar pressure.
Pillar 7: Integrated Trade Evaluation Engine
The script includes an internal statistical engine that evaluates the hypothetical performance of every detected QM pattern based on user-defined Risk/Reward parameters (SL Ticks / TP Ticks). It calculates whether historical setups achieved the minimum required R:R, feeding this data into the dashboard to provide an objective win-rate metric for the current asset and timeframe.
🔧 COMPREHENSIVE INPUT SYSTEM
🔍 Detection Engine
QM Break Lookback: The maximum allowable bars between a liquidity sweep and the subsequent structural break. Prevents identifying drawn-out, unrelated price action as a QM.
Max QM1-QM2 Gap: The maximum bar distance between opposing QM patterns to form a valid Equilibrium Range.
SD Formation Lookback: How far back the engine searches to find the origin candle for a Supply/Demand zone after a structural break.
👣 Real Orderflow (Footprint)
Enable Real Footprint Delta: Toggles the use of PulseWire Premium tick-level data for precise trap validation and dashboard metrics.
Ticks per Row / Value Area %: Granularity controls for the background footprint processing.
📐 Trade Evaluation (SL/TP)
Stop Loss / Take Profit (Ticks): The parameters used by the internal statistical engine to back-test the historical success rate of detected QM patterns.
Min R:R Ratio: The threshold required for the dashboard to classify a historical pattern as "Profitable."
⚡ Performance Settings
Max History Limits: Memory management controls (Max 3CF, Max QM, Max Zones) to ensure the indicator runs smoothly on deep charts without exceeding Pine Script limits.
* Zone Touch Limit: The exact number of times price can tap a Supply/Demand zone before it is permanently deleted from the chart.
🎨 Display Options
Granular toggles for every visual element: 3CF Markers, Liquidity Lines, QM Patterns, Range Boundaries, BOS/CHoCH Lines, Ghost Lines, and Fading SD Zones.
📊 ANALYTICS DASHBOARD
The script features a highly detailed, non-intrusive HUD (Heads-Up Display) that provides a real-time statistical overview of the market structure.
Macro Context (RCM Integration): Displays the current market regime (Pro-Trend, Counter-Trend, Neutral) and Structural Integrity via the imported Ricci Curvature Machine (RCM) library.
Footprint Data: Displays the live, tick-level Buy Volume, Sell Volume, Delta, Point of Control (POC), and Value Area (VAH/VAL) for the current developing bar.
QM Metrics & Range State: Tracks whether an Equilibrium Range is currently active. Displays the total count of Bullish and Bearish QMs, calculating their exact percentage weighting in the current market.
Structural Statistics: Maintains a running tally of Trapped Volume occurrences, Total Bull BOS, Total Bear CHoCH, Active SD Zones, and active Ghost Lines.
Performance Evaluation: Outputs the percentage of historical QM patterns that successfully achieved the user's defined Risk:Reward ratio, alongside the average delta recorded during those setups.
Narrative Footer: A dynamically updating text panel that translates the raw data into a readable market narrative (e.g., "Heavy directional dominance," "Order flow balanced").
🎨 VISUAL SYSTEM
The Quasimodo Range Engine is fundamentally a visual tool. Every line, box, and label drawn on the chart is a direct representation of the engine's analytical process. It is designed to tell a clear, objective story of how liquidity is being engineered and how market structure is evolving in response. Understanding these visual components is key to leveraging the engine's full analytical power.
Liquidity Mapping: 3CF Pivots & Lines
This is the foundational layer of the entire system.
3CF Markers (○): A small, colored circle marks every confirmed 3-Candle Fractal pivot. These are the raw, objective swing points that the engine identifies as potential liquidity pools.
Liquidity Lines (Dotted): A dotted horizontal line is projected forward in time from every 3CF Marker. This line represents the precise price level of untapped liquidity. The line continues to extend until price trades through it, at which point it stops, providing a clean visual confirmation that the liquidity at that level has been "swept" or "taken."
The Quasimodo Pattern: A Complete Visual Narrative
When a full QM pattern is confirmed, the engine draws a composite visual to provide a complete summary of the event.
The QM Zone (Box): A colored box highlights the entire price range of the QM pattern, from its origin pivot to the structural break. The color indicates its nature (Bullish or Bearish) and is brighter if a "trap" was detected, signaling higher conviction.
Sweep & Break Lines: Two horizontal lines provide the core narrative. The dashed line marks the liquidity level that was swept, while the solid, thicker line marks the structural level that was subsequently broken. This visually dissects the two key events of the pattern.
The Trap Vector (Arrow): A colored arrow connects the point of the liquidity sweep to the point of the structural break. This powerful visual illustrates the "trap-and-reverse" motion, graphically representing the path of the institutional move.
The QM Label: Provides critical context at a glance, identifying the pattern as "Bullish QM" or "Bearish QM" and, through its RCM integration, classifying it as "Pro-Trend," "Counter-Trend," or "Neutral."
Range Demarcation: Equilibrium Range (ERL/ERH)
When two opposing QM patterns form a valid range, the engine clearly demarcates it.
Swing Point Markers (⭕): Large, hollow circles are placed on the absolute highest high and lowest low of the price action that formed the range, marking the outer boundaries of the entire consolidation structure.
ERL/ERH Labels: "ERL" (Equilibrium Range Low/High) labels mark the specific structural break levels from the two QM patterns that define the range. These are the precise boundaries to monitor for a BOS or CHoCH.
Structural Resolution: BOS, CHoCH & Ghost Lines
This visual layer tracks the outcome of range-bound price action.
BOS/CHoCH Lines & Labels: When a range boundary is broken, a thick, solid line (green for Bullish BOS, red for Bearish CHoCH) is drawn at the broken level, accompanied by a clear label. This provides an un-missable confirmation that the market has shifted from balance to imbalance.
Ghost Lines (Faded, Dashed): After a BOS or CHoCH occurs, the broken structural line does not disappear. It remains on the chart as a faded "Ghost Line." This represents the market's memory of that broken structure, as these levels frequently act as future support/resistance flip zones.
Reactive Supply & Demand: Fading Zones
Following a structural break, the engine automatically draws the zone that originated the move.
Supply & Demand Boxes: A red box is drawn for a Supply zone (origin of a down-move) and a green box for a Demand zone (origin of an up-move).
Fading Mechanic: This is a critical visual feature. Each time price touches a zone, the box's opacity increases (it becomes more transparent). This visually represents the consumption of orders within the zone. After a user-defined number of touches (Zone Touch Limit), the zone is considered fully mitigated and is automatically removed from the chart.
The Analytics Dashboards
To keep the chart clean, the bulk of the data is presented in two distinct dashboard panels.
The Main Dashboard: Provides a comprehensive quantitative breakdown of all engine metrics, from real-time footprint data to the statistical performance of historical QM patterns.
The Trend Narrative Panel: This qualitative panel translates the complex data from the engine and its integrated RCM library into simple, human-readable sentences, providing an instant summary of the market's condition regarding Regime, Kinetics, Structure, and Order Flow.
⚖️ RESPONSIBLE USAGE & LIMITATIONS
Analysis, Not Execution: This engine is a descriptive analytical framework designed to map market structure. It is not an automated trading strategy. The drawn QM patterns are historical and structural observations, not guaranteed buy/sell signals.
Trade Evaluation is Hypothetical: The "Profitable QMs" metric displayed on the dashboard is a basic, rigid statistical evaluation based on fixed tick inputs. It does not account for slippage, commissions, spread, or dynamic trade management. It is designed to measure the general effectiveness of the pattern on a specific asset, not to simulate a live trading PnL.
Data Requirements: The Footprint functionality requires access to tick data (typically a Premium subscription). Without this, the script functions entirely normally using its built-in mathematical OHLCV synthetic delta approximation, but will lack exact tick precision for the "Trap Absorbed" metric.
🔮 CONCLUSION
The Quasimodo Range Engine brings a rigorous, mechanical approach to structural market analysis. By tracking the exact sequence of liquidity sweeps, structural breaks, and the subsequent formulation of trading ranges, it removes subjectivity from chart reading. It allows analysts to view price action as a continuous cycle of liquidity engineering, range expansion, and supply/demand mitigation, providing a deeply contextualized map of market behavior.
— Dskyz, Trade with insight. Trade with anticipation. (Don't follow the trend, be the trend) Indicator

Indicator

BTC Average Daily Returns by DayAverage Daily Returns by Day
A clean weekday performance dashboard that shows the average daily return for each day of the week using a selectable lookback period.
The script uses daily data internally, so it stays consistent across chart timeframes while letting you view the stats directly on your chart as either a table or a centered top bar.
Features
Weekday average returns
1W, 2W, 1M, 3M, 6M, 1Y lookbacks
Table or top bar display
Current-day bias signal built into the UI
Optional heatmap, best/worst day highlight, and sample count
Custom colors and preset themes
How to use
Use it to quickly see whether a market has recently shown stronger or weaker performance on specific weekdays. It works best as a context tool alongside price action, structure, volatility, and broader market conditions.
Important
This indicator is descriptive, not predictive. Weekday tendencies can shift, especially on shorter lookbacks, so it should not be used as a standalone signal.
Indicator

Indicator

KernelLens🟦 KernelLens is a professional kernel regression library for Pine Script v6, providing eight mathematically rigorous Nadaraya–Watson estimators, a three-mode filter layer, a unified string dispatcher, and a suite of trading utilities — all built from the ground up on correct non-parametric statistics. Unlike existing Pine smoothing libraries — which inherit a decade-old loop-bound bug that silently reduces every kernel window to a handful of bars, regardless of the bandwidth parameter — KernelLens is built with auditable math, NA-safe iteration, input validation at every entry point, and academic references cited inline next to the formulas they describe.
The library integrates eight independent kernel families — Rational Quadratic, Gaussian, Periodic, Locally Periodic, Epanechnikov, Tricube, Triangular, and Cosine — behind a consistent API, with every raw estimator wrapped in a filter layer (None / Smooth / Zero Lag), a unified dispatcher for dropdown-driven kernel selection, and five utility exports covering slope detection, trend state, crossover signaling, residual confidence bands, and Silverman's rule-of-thumb bandwidth recommendation. Every public function validates its inputs, raises descriptive runtime errors on misuse, and returns `na` only when there is genuinely no data — never as a silent fallback.
🟦 MATHEMATICAL FOUNDATION
**The Nadaraya–Watson Estimator**
Given a source series `y_t` and a symmetric kernel `K` with scale parameter `ℓ` (the "bandwidth"), the Nadaraya–Watson estimator of the regression function `m(x) = E ` evaluated at the current bar is:
```
Σᵢ K(dᵢ / ℓ) · y_{t−i}
ŷ(t) = ───────────────────────
Σᵢ K(dᵢ / ℓ)
```
where `dᵢ` is the bar-distance from the kernel center and the sum runs over a finite window determined by the effective support of `K`.
The estimator is a locally weighted average: bars close to the kernel center contribute heavily, distant bars contribute proportionally less, and bars outside the support contribute nothing. It is asymptotically unbiased up to `O(ℓ²)` for twice-differentiable `m`, with variance of order `(n·ℓ)⁻¹` — the classical bias–variance trade-off that defines all non-parametric smoothers.
**Why Kernel Regression Beats Rolling Means**
A simple moving average gives every bar in the window the same weight. Kernel regression gives each bar a weight that decays smoothly with distance, producing:
- **Smoother output** — no step artifacts when bars enter / leave the window
- **Better bias control** — the peak of the kernel sits exactly on the point being estimated
- **Kernel-specific behavior** — compact-support kernels eliminate tail contamination entirely; Rational Quadratic's `α` parameter exposes multi-scale mixing; Periodic kernels resonate with known cycle lengths
The math has been the academic standard for non-parametric regression since Nadaraya (1964) and Watson (1964). KernelLens brings it to Pine Script v6 in its correct, bug-free form.
🟦 THE EIGHT KERNELS
All eight kernels implement the Nadaraya–Watson weighting scheme. They differ in support (compact versus infinite), smoothness (how many times differentiable), and how weight decays with distance.
| # | Kernel | Formula | Support | Smoothness | Character |
|---|---|---|---|---|---|
| 1 | **Rational Quadratic** | `(1 + d² / (2·α·ℓ²))^(−α)` | ℝ | C∞ | Multi-scale mixer — `α` controls stretch versus wiggle |
| 2 | **Gaussian (RBF)** | `exp(−d² / (2·ℓ²))` | ℝ | C∞ | The canonical smoother — smoothest possible with L² optimality |
| 3 | **Periodic** | `exp(−2·sin²(π·d/p) / ℓ²)` | ℝ | C∞ | Resonates with repetition distance `p` — ideal for cycles |
| 4 | **Locally Periodic** | Periodic · Gaussian | ℝ | C∞ | Seasonal patterns that slowly drift with trend |
| 5 | **Epanechnikov** | `(3/4)(1 − u²) · 𝟙{|u|≤1}` | | C⁰ | Asymptotically MSE-optimal (Watson 1964) — no tail contamination |
| 6 | **Tricube** | `(70/81)(1 − \|u\|³)³ · 𝟙{|u|≤1}` | | C² | The LOWESS standard — near-Gaussian with compact support |
| 7 | **Triangular** | `(1 − \|u\|) · 𝟙{|u|≤1}` | | C⁰ | Simplest non-uniform kernel — fastest to compute |
| 8 | **Cosine** | `(π/4)·cos(π·u/2) · 𝟙{|u|≤1}` | | C¹ | Raised-cosine taper — smoother boundary than Epanechnikov |
where `u = d/ℓ` and `𝟙` is the indicator function.
**Infinite-Support vs Compact-Support — Why Both Matter**
| | Infinite Support (RQ, Gauss, Periodic, LocPeriodic) | Compact Support (Epa, Tricube, Triangular, Cosine) |
|---|---|---|
| **Tail weight** | Never exactly zero | Exactly zero beyond ±ℓ |
| **Loop depth** | `3·ℓ` (3-σ cutoff, ≈99.7% mass) | Exactly `ℓ` |
| **Bar contamination** | Distant bars still pull the estimate a tiny amount | Distant bars cannot affect the estimate at all |
| **Best for** | Smooth trends, Gaussian-process intuition | Robust regression, outlier resistance |
KernelLens picks the correct loop depth automatically based on kernel family: `_depthInfinite` for Gaussian-family kernels, `_depthCompact` for bounded kernels, `_depthPeriodic` for Periodic (which must span enough cycles to reach stable weights).
**Why Eight, Not Four**
Most Pine kernel libraries ship only the four kernels from MacKay's Gaussian process tutorial. KernelLens adds the four compact-support classical kernels because:
- **Epanechnikov** minimises asymptotic mean squared error among all non-negative kernels of bounded support (Watson 1964) — it is the MSE-optimal baseline against which all other kernels are measured
- **Tricube** is the kernel used by LOWESS (Cleveland 1979), the de-facto standard for robust locally weighted scatterplot smoothing
- **Triangular** is the cheapest non-uniform compact kernel — useful when loop-budget matters on intraday charts with huge dataset size
- **Cosine** is C¹-continuous at the support boundary, unlike Epanechnikov's C⁰ discontinuity, producing visibly smoother transitions at kernel edges
Adding them makes the library an academically complete toolkit, not just a Pine port of one tutorial.
🟦 FILTER LAYER — NONE / SMOOTH / ZERO LAG
Every kernel export accepts a `_filter` parameter with three valid values. The filter layer is implemented identically across all eight kernels, so switching kernel families does not change filter behavior.
**"No Filter" — Single-Pass Raw Estimate**
```
ŷ = K(y)
```
One Nadaraya–Watson pass over the source. Cheapest mode, most reactive, fully represents the underlying kernel. Use this when you want the kernel's raw behavior with no additional smoothing or lag correction.
**"Smooth" — Double-Pass Estimate**
```
ŷ = K(K(y))
```
The kernel is applied once to the source, then applied again to its own output using the same bandwidth and the same parameters. The result is a more strongly smoothed curve at the cost of one extra loop pass per bar.
This is mathematically equivalent to convolving the kernel with itself — the effective kernel is wider and flatter, pulling longer-range context into each estimate without requiring the user to double the bandwidth.
**"Zero Lag" — Ehlers De-Lagged Estimate**
```
ŷ = 2·K(y) − K(K(y))
```
The ZLEMA identity from Ehlers (*Rocket Science for Traders*, 2000): subtract the smoothing lag from the raw estimate, effectively shifting the output back in time to match the source more closely.
The intuition: `K(y)` lags `y` by some amount; `K(K(y))` lags `K(y)` by the same amount; so `K(y) − K(K(y))` is an estimate of the lag itself, and adding it back to `K(y)` cancels out. The result tracks the source more tightly than either pass alone, at the cost of slightly noisier turning points.
**Lazy Evaluation — No Wasted Cycles**
In `"No Filter"` mode, the second pass is skipped entirely — it never runs. The filter branch uses an `if` block (not a ternary), so Pine's short-circuit semantics prevent the unused computation. A single kernel call costs one pass; `"Smooth"` or `"Zero Lag"` costs two. You only pay for what you use.
🟦 KERNEL CENTER OFFSET — THE `_phase` PARAMETER
Every KernelLens kernel takes a `_phase` parameter that shifts the kernel center into the past by `_phase` bars. It is the library's non-repainting knob.
**_phase = 0 — Live Estimate**
The kernel is centered on the current bar. The most recent price has maximum weight, and the estimate is as fresh as possible. Suitable for live signal generation, but the most recent bar can re-evaluate as it develops within its interval — standard Pine real-time behavior.
**_phase > 0 — Non-Repainting Historical Estimate**
The kernel center is moved `_phase` bars into the past. The estimate becomes the smoothed value *at that historical bar*, not the current bar. Once the bar at `bar_index − _phase` is fully confirmed (`barstate.isconfirmed`), its estimate cannot change again.
This is the standard trick for publishing kernel indicators that do not repaint: you get a stable, historically accurate curve at the cost of shifting the entire output `_phase` bars to the right on the chart. A `_phase = 25` call gives a curve that lags live price by 25 bars but is guaranteed stable for every past bar.
**Why It Belongs in the Library, Not the Caller**
Pushing `_phase` into the kernel's own loop is not the same as evaluating the kernel at a shifted source (`K(src )`). Shifting the source just uses a stale input with a current-bar-centered kernel, which still produces a fresh estimate of a stale series. KernelLens's `_phase` genuinely moves the kernel center, producing a historical-bar estimate that computes over the correct surrounding window.
🟦 NON-REPAINTING BEHAVIOR
Repainting is the single most-asked question about any Pine indicator, and the single most common source of silent failure when a retail trader moves from backtest to live. A strategy that looks flawless on historical bars and then bleeds money the moment it is deployed is almost always suffering from some form of repainting. KernelLens is engineered from first principles to eliminate every class of repainting by construction — not by patching symptoms, but by removing the dependencies that cause repainting in the first place.
**The Two Forms of Repainting**
| Form | Symptom | Typical Cause |
|---|---|---|
| **Historical repainting** | A bar that was closed days or weeks ago silently changes its plotted value when the chart is refreshed or scrolled | `request.security()` with `lookahead = barmerge.lookahead_on`, un-gated higher-timeframe data, or incorrect array rotation that reads into future bars |
| **Real-time repainting** | The plotted value on the live (current developing) bar flickers tick-by-tick as new price ticks arrive, then freezes at a final value when the bar closes | The indicator reads `close ` (or any current-bar value) inside a weighted sum — the current-bar weight changes every tick |
KernelLens avoids the first kind **entirely and unconditionally**: the library contains no `request.security` calls, no higher-timeframe lookups, no `lookahead_on` usage, and no array rotation that could leak future bars into the window. Every historical bar plotted by any KernelLens kernel is computed exclusively from bars that existed at the time that bar was closed. The plotted history is immutable.
Real-time repainting is controlled explicitly by the `_phase` parameter — it is the user's choice whether to accept tick-by-tick flicker on the live bar in exchange for zero lag (`_phase = 0`) or to eliminate the flicker entirely at the cost of a small fixed lag (`_phase ≥ 1`).
**Why Kernel Regression Normally Repaints (And How KernelLens Stops It)**
A traditional Nadaraya–Watson call centered on the current bar evaluates:
```
ŷ(t) = Σᵢ K(dᵢ/ℓ) · y_{t−i} for i = 0 … depth
```
On the live bar, the term `y_{t−0} = close ` is the current real-time price — which changes on every tick. Every tick moves the weighted sum, every tick moves the estimate, and the trader watching the chart sees the kernel plot flicker as the bar develops. The historical bars (where `close ` for that past bar is now fixed) are stable, but the live plot is unstable.
KernelLens's `_phase` parameter shifts the loop so the kernel runs over `i = _phase … _phase + depth`. With `_phase = 2`:
```
ŷ(t) = Σᵢ K((i−2)/ℓ) · y_{t−i} for i = 2 … 2 + depth
```
The sum no longer touches `close ` or `close ` — every bar it reads is already confirmed and cannot change. The live-bar kernel output is therefore identical from the first tick of the bar to the last tick of the bar, and identical again when the bar finally closes. There is no flicker and nothing to repaint.
**The Lag / Stability Trade-Off**
| `_phase` | Lag on Live Bar | Live-Bar Flicker | Historical Repainting | Best For |
|---|---|---|---|---|
| **0** | 0 bars | Yes (real-time only; history is stable) | None | Scalping, academic research, calibration |
| **1** | 1 bar | None | None | Fast day-trading; minimum acceptable lag for a live trading desk |
| **2** | 2 bars | None | None | Default for most users — the sweet spot between freshness and stability |
| **3** | 3 bars | None | None | Swing trading — extra margin against false flickers from erratic ticks |
| **5+** | 5+ bars | None | None | Position trading, long-term chart analysis, published signal marks |
Even at `_phase = 0`, **historical repainting never occurs** — only the live bar flickers during its own development. Once a bar closes, its plotted value is final; scrolling away and back, refreshing the chart, or re-opening PulseWire will never change that historical plot. The flicker is exclusively a live-bar tick-by-tick phenomenon.
**KernelLens as a Non-Repainting Primitive**
KernelLens exposes real-time flicker as an explicit, user-controlled trade-off rather than a hidden behavior. The caller picks any point on the spectrum from "fully live" (`_phase = 0`, maximum reactivity with tick-by-tick flicker) to "fully confirmed" (`_phase ≥ 1`, one or more bars of lag in exchange for a curve that never redraws) with a single integer parameter. Historical repainting — the dangerous form that silently rewrites past plots — is eliminated unconditionally regardless of `_phase`.
**How to Verify Non-Repainting Yourself**
Do not trust the word "non-repainting" from any library — always verify. KernelLens can be verified in about thirty seconds:
1. Load a chart with KernelLens on it using `_phase = 2` (or any value > 0).
2. Take a screenshot at any specific historical bar.
3. Scroll far to the left, refresh the chart, or reload the indicator.
4. Return to the same bar. The plotted value at that bar must be pixel-identical to the screenshot — because the computation on that bar used only the bars before it, which have not changed.
5. Repeat with `_phase = 0`. The historical bars must still be pixel-identical — only the live bar's plot can differ between observations, and only because the live bar's `close` is now a different number than it was when you took the screenshot.
For a stricter test, use PulseWire's **Bar Replay** mode. Enable Bar Replay, step forward one bar at a time, and watch the kernel plot on each newly-closed bar. With `_phase ≥ 1`, the value plotted on each newly-closed bar will exactly match what the indicator shows after you exit replay mode and view the same bar normally. This is the gold-standard test — Bar Replay reproduces live-bar tick arrival in a controlled way.
**Common Misconceptions**
> *"Any Pine indicator that uses `close` repaints."*
False. Using `close` on a confirmed bar does not repaint — the confirmed bar's close is locked. What can repaint is using `close` on the live bar, and only within that live bar's interval. KernelLens with `_phase > 0` never reads the live-bar close at all.
> *"`lookahead = barmerge.lookahead_on` is always wrong."*
Context-dependent. `lookahead_on` is used correctly in some multi-timeframe indicators to request a higher-TF value that is already settled on the lower TF. KernelLens does not use `request.security` at all, so this question does not apply — but for libraries that do, `lookahead_on` is only problematic when it leaks values from bars that were not yet closed at the lower-TF time of evaluation.
> *"Non-repainting means zero lag."*
False. Zero lag and non-repainting are orthogonal properties. KernelLens `_phase = 0` is zero lag with real-time flicker; `_phase = 2` is two-bar lag with no flicker. You can have any combination of the two, and the right choice depends on the trading style.
> *"The `FILTER_ZEROLAG` mode makes the indicator non-repainting."*
False. `FILTER_ZEROLAG` is an Ehlers-style de-lagging filter applied to the kernel output; it reduces the perceived lag of the estimate, but it does not affect whether the live bar flickers. Non-repainting is controlled exclusively by `_phase`. Choose `_phase` for repainting behavior, and `_filter` for smoothness / lag shape — they are independent knobs.
**When to Accept Real-Time Flicker (`_phase = 0`)**
Despite everything above, there are legitimate reasons to deliberately use `_phase = 0`:
- **Academic research and backtesting** — you want the kernel mathematics in its classical form, centered on the point being estimated, with no phase adjustment
- **Scalping on very short timeframes** — a 2-bar lag on a 1-minute chart is a 2-minute delay, which can matter when you are exiting within a 4-minute window
- **Visual calibration** — when you are choosing a bandwidth by eye, the live-bar flicker actually helps: you see how sensitive the curve is to each incoming tick, which is diagnostic information
- **Indicators that read the kernel output only on `barstate.isconfirmed`** — if your signal logic is gated by `if barstate.isconfirmed`, then live-bar flicker is invisible to your signal (it sees only the frozen close-of-bar value), and you can safely use `_phase = 0` with no practical consequence
For every other case — and especially for any live alert or automated trading system — use `_phase ≥ 1`. Two bars of lag on a clean, stable curve is almost always worth more than zero lag on a curve that redraws itself several times per bar.
🟦 UNIFIED DISPATCHER — `estimate()`
For indicators where the user picks a kernel from a dropdown, writing eight separate ternary branches is tedious and error-prone. KernelLens ships with a unified dispatcher that routes to the correct kernel based on a string argument:
```pine
import a_jabbaroff/KernelLens/1 as kl
line = kl.estimate(
kernelType = kl.KERNEL_GAUSS,
src = close,
bandwidth = 32,
shapeAlpha = 1.0,
period = 1,
phase = 2,
filter = kl.FILTER_SMOOTH)
```
The dispatcher forwards to the matching typed export, so there is no performance penalty versus calling the kernel directly — it is a compile-time routing pass. Unknown kernel names raise a descriptive `runtime.error` naming every valid alternative, so typos fail loudly instead of silently returning `na`.
**Public Constants**
KernelLens exposes its string constants so callers never type the magic values by hand:
| Constant | Value |
|---|---|
| `FILTER_NONE` | `"No Filter"` |
| `FILTER_SMOOTH` | `"Smooth"` |
| `FILTER_ZEROLAG` | `"Zero Lag"` |
| `KERNEL_RQ` | `"Rational Quadratic"` |
| `KERNEL_GAUSS` | `"Gaussian"` |
| `KERNEL_PERIODIC` | `"Periodic"` |
| `KERNEL_LOCPER` | `"Locally Periodic"` |
| `KERNEL_EPA` | `"Epanechnikov"` |
| `KERNEL_TRICUBE` | `"Tricube"` |
| `KERNEL_TRIANG` | `"Triangular"` |
| `KERNEL_COSINE` | `"Cosine"` |
Using the constants in your caller code means the Pine compiler — not a runtime string compare — catches typos at edit time.
🟦 UTILITY LAYER — FIVE PROFESSIONAL HELPERS
KernelLens ships with five utility exports that complement the core estimators. They are the functions you almost always write immediately after getting a smoothed line, factored out so you don't rewrite them in every indicator.
**`slope(estimate, step)` — Discrete First Derivative**
Returns `(y_t − y_{t−step}) / step`, the normalized rate of change over `step` bars. Use it to detect whether a kernel output is trending up, flat, or down — the foundation for any trend-following signal built on top of KernelLens.
```pine
rising = kl.slope(line, 3) > 0.0
```
**`trendState(estimate, step)` — Ternary Trend Indicator**
Returns `+1` if the estimate is rising, `−1` if falling, `0` if exactly flat over the window. A single-call replacement for hand-rolled `line > line ? 1 : line < line ? -1 : 0` ladders.
**`crossSignal(fast, slow)` — Bi-directional Crossover**
Returns `+1` on the bar where `fast` crosses above `slow` (bullish), `−1` on a bearish cross, and `0` otherwise. Built on `ta.crossover` / `ta.crossunder`, so the signal is non-repainting once the bar is confirmed.
**`confidenceBand(src, estimate, window)` — Residual Standard Deviation**
Computes the rolling standard deviation of `(src − estimate)` over a user-defined window. Use the return value as the half-width of a confidence band around the estimate:
```pine
est = kl.gaussian(close, 32, 2, kl.FILTER_SMOOTH)
sigma = kl.confidenceBand(close, est, 50)
upper = est + 1.96 * sigma
lower = est - 1.96 * sigma
```
This is a computationally cheap proxy for the full kernel-weighted local variance — ideal when you need visual bands without paying for a second weighted pass.
**`silvermanBandwidth(src, window)` — Optimal ℓ Suggestion**
Returns the Silverman rule-of-thumb bandwidth:
```
h ≈ 1.06 · σ · n^(−1/5)
```
where `σ` is the rolling standard deviation of the source and `n` is the window size. This is the classical starting point for Gaussian-family bandwidths in academic texts (Silverman 1986). Because Pine requires `simple int` for kernel bandwidth, the returned value is intended for diagnostic display — plot it, read it off the chart, then hard-code the rounded integer into the kernel call.
🟦 INPUT VALIDATION — FAIL LOUDLY, FAIL EARLY
Every public function in KernelLens validates its inputs through a set of internal `_assert*` helpers. Invalid arguments never produce silent `na` fallbacks or buried zero-divisions — they raise `runtime.error` with a descriptive message identifying the function, the parameter, and the expected range.
| Helper | Checks | Raises On |
|---|---|---|
| `_assertFilter` | Filter string is `FILTER_NONE`, `FILTER_SMOOTH`, or `FILTER_ZEROLAG` | Typos like `"No FIlter"` (capital I) — a bug that exists in at least one published kernel indicator |
| `_assertBandwidth` | Bandwidth is a strictly positive integer | Negative or zero bandwidth, which would cause division by zero or infinite loops |
| `_assertPeriod` | Period is a strictly positive integer | Zero period, which would cause `sin(π·d/0)` in Periodic kernels |
| `_assertAlpha` | Rational Quadratic shape parameter is strictly positive | Zero or negative `α`, which would invert the RQ formula |
Error messages are prefixed `KernelLens:` (or `KernelLens.:`) so they are easy to spot in the PulseWire runtime log. Every message names the parameter that failed, the value that was passed, and the set of valid alternatives — so a misconfigured chart tells you exactly what to fix.
🟦 LOOP DEPTH — THE BUG FIX THAT MOTIVATED KERNELLENS
The two most popular Pine kernel libraries on PulseWire share the same fatal bug: both compute their loop depth as
```pine
_size = array.size(array.from(_src))
```
where `array.from(_src)` creates a **one-element array containing the current value of `_src`**, so `_size` is always `1`. The loop then runs `for i = 0 to 1 + startAtBar`, effectively using only `startAtBar + 2` bars — completely ignoring the user's bandwidth. Every published kernel indicator built on those libraries inherits this silent miscalculation.
KernelLens replaces the broken helper with three explicit depth selectors:
| Helper | Depth | Used By |
|---|---|---|
| `_depthInfinite(bw)` | `max(bw · 3, 4)` | Gaussian, Rational Quadratic, Locally Periodic |
| `_depthCompact(bw)` | `max(bw, 4)` | Epanechnikov, Tricube, Triangular, Cosine |
| `_depthPeriodic(bw, p)` | `max(bw · 3, p · 10, 4)` | Periodic |
For Gaussian-family kernels, the `3·ℓ` cutoff captures approximately 99.7% of the kernel mass (the three-sigma rule). For compact-support kernels, the depth equals the bandwidth exactly — the loop terminates at the kernel's natural zero point. For Periodic kernels, the depth is the larger of the scale-based and cycle-based minima, so the loop always spans enough periods to produce a stable weighted average.
The loop counter `i` runs over bar offsets starting at `_phase`, every bar lookup is NA-checked before being incorporated into the sum, and the final `num / den` division is guarded against zero denominators. On a fresh chart, the kernel gracefully returns `na` for bars where the window extends past available history, rather than producing poisoned sums from implicit NA arithmetic.
🟦 API REFERENCE
**Core Kernel Estimators — Eight Exports**
| Export | Signature |
|---|---|
| `rationalQuadratic` | `(src, bandwidth, shapeAlpha, phase, filter) → float` |
| `gaussian` | `(src, bandwidth, phase, filter) → float` |
| `periodic` | `(src, bandwidth, period, phase, filter) → float` |
| `locallyPeriodic` | `(src, bandwidth, period, phase, filter) → float` |
| `epanechnikov` | `(src, bandwidth, phase, filter) → float` |
| `tricube` | `(src, bandwidth, phase, filter) → float` |
| `triangular` | `(src, bandwidth, phase, filter) → float` |
| `cosineKernel` | `(src, bandwidth, phase, filter) → float` |
**Unified Dispatcher**
| Export | Signature |
|---|---|
| `estimate` | `(kernelType, src, bandwidth, shapeAlpha, period, phase, filter) → float` |
**Utility Layer — Five Exports**
| Export | Signature |
|---|---|
| `slope` | `(estimate, step) → float` |
| `trendState` | `(estimate, step) → int` |
| `crossSignal` | `(fast, slow) → int` |
| `confidenceBand` | `(src, estimate, window) → float` |
| `silvermanBandwidth` | `(src, window) → float` |
**Parameter Types**
| Name | Pine Type | Description |
|---|---|---|
| `src` | `series float` | Source series (close, hl2, ohlc4, or any other price-derived series) |
| `bandwidth` | `simple int` | Kernel scale `ℓ`, must be `> 0` |
| `shapeAlpha` | `simple float` | Rational Quadratic shape parameter, must be `> 0` |
| `period` | `simple int` | Periodic repetition distance, must be `> 0` |
| `phase` | `simple int` | Kernel center offset in bars, must be `≥ 0` |
| `filter` | `simple string` | One of `FILTER_NONE`, `FILTER_SMOOTH`, `FILTER_ZEROLAG` |
| `kernelType` | `simple string` | One of the eight `KERNEL_*` constants |
| `step` | `simple int` | Finite-difference step for `slope` / `trendState`, must be `≥ 1` |
| `window` | `simple int` | Rolling window for `confidenceBand` / `silvermanBandwidth`, must be `≥ 2` |
🟦 USAGE EXAMPLES
**Minimal — One Gaussian Curve**
```pine
//@version=6
indicator("KernelLens — Gaussian Demo", overlay = true)
import a_jabbaroff/KernelLens/1 as kl
line = kl.gaussian(close, 32, 2, kl.FILTER_SMOOTH)
plot(line, "Gaussian", color = color.orange, linewidth = 2)
```
**Fast / Slow Crossover System**
```pine
//@version=6
indicator("KernelLens — RQ Crossover", overlay = true)
import a_jabbaroff/KernelLens/1 as kl
fast = kl.rationalQuadratic(close, 8, 1.0, 2, kl.FILTER_NONE)
slow = kl.rationalQuadratic(close, 32, 1.0, 2, kl.FILTER_SMOOTH)
cross = kl.crossSignal(fast, slow)
plot(fast, "Fast", color = color.aqua, linewidth = 2)
plot(slow, "Slow", color = color.orange, linewidth = 2)
plotshape(cross == 1, "Bull", location = location.belowbar,
color = color.lime, style = shape.triangleup, size = size.tiny)
plotshape(cross == -1, "Bear", location = location.abovebar,
color = color.red, style = shape.triangledown, size = size.tiny)
```
**Confidence Band Envelope**
```pine
//@version=6
indicator("KernelLens — Confidence Band", overlay = true)
import a_jabbaroff/KernelLens/1 as kl
est = kl.tricube(close, 48, 2, kl.FILTER_SMOOTH)
sigma = kl.confidenceBand(close, est, 50)
k = 1.96
upper = est + k * sigma
lower = est - k * sigma
plot(est, "Estimate", color = color.orange, linewidth = 2)
p1 = plot(upper, "+1.96σ", color = color.new(color.aqua, 70))
p2 = plot(lower, "−1.96σ", color = color.new(color.aqua, 70))
fill(p1, p2, color = color.new(color.aqua, 92))
```
**Dropdown-Driven Kernel Selection**
```pine
//@version=6
indicator("KernelLens — Dropdown", overlay = true)
import a_jabbaroff/KernelLens/1 as kl
kernelType = input.string(kl.KERNEL_GAUSS, "Kernel",
options = )
bandwidth = input.int(32, "Bandwidth", minval = 2)
alphaRQ = input.float(1.0,"RQ Alpha", minval = 0.01, step = 0.25)
period = input.int(20, "Period", minval = 1)
phase = input.int(2, "Phase", minval = 0)
filter = input.string(kl.FILTER_SMOOTH, "Filter",
options = )
line = kl.estimate(kernelType, close, bandwidth, alphaRQ, period, phase, filter)
plot(line, "KernelLens", color = color.orange, linewidth = 2)
```
🟦 TIMEFRAME PRESETS — BANDWIDTH BY STYLE
Kernel bandwidth is the single most important parameter. It controls the trade-off between reactivity (small `ℓ`, tight fit, noisier) and stability (large `ℓ`, smooth curve, slower to react). The presets below are tested starting points — adjust by ±25 % to taste.
---
**SCALPER — 1m / 3m / 5m**
| Parameter | Value |
|---|---|
| Bandwidth (ℓ) | 8 |
| Phase | 1 |
| Filter | `FILTER_NONE` |
| Best Kernel | Rational Quadratic or Gaussian |
| RQ shapeAlpha | 1.0 |
**Why:** Short bandwidth means the kernel reacts within a handful of bars. `FILTER_NONE` removes the double-pass lag, so the estimate tracks price as tightly as possible. Phase 1 keeps the estimate nearly live while still avoiding the current-bar tick noise.
---
**DAY TRADER — 15m / 30m / 1H**
| Parameter | Value |
|---|---|
| Bandwidth (ℓ) | 16 |
| Phase | 2 |
| Filter | `FILTER_SMOOTH` |
| Best Kernel | Gaussian or Tricube |
| RQ shapeAlpha | 1.0 |
**Why:** Balanced reactivity — the 16-bar Gaussian is the default Silverman range for intraday price data, and `FILTER_SMOOTH` removes most of the bar-to-bar chop without significantly increasing lag. Tricube provides near-identical behaviour with strict compact support and is preferred on noisy assets where outlier bars should not influence the curve.
---
**SWING TRADER — 4H / 1D**
| Parameter | Value |
|---|---|
| Bandwidth (ℓ) | 32 |
| Phase | 3 |
| Filter | `FILTER_SMOOTH` |
| Best Kernel | Rational Quadratic |
| RQ shapeAlpha | 2.0 |
**Why:** Swing trades need structural signals, not intraday noise. Rational Quadratic with `α = 2.0` mixes medium and long length scales, producing a curve that ignores transient spikes but catches genuine regime shifts. Phase 3 shifts the estimate three bars back so each swing decision is made against a fully confirmed kernel output.
---
**POSITION / LONG-TERM — 1D / 1W / 1M**
| Parameter | Value |
|---|---|
| Bandwidth (ℓ) | 64 |
| Phase | 5 |
| Filter | `FILTER_SMOOTH` or `FILTER_ZEROLAG` |
| Best Kernel | Gaussian or Locally Periodic |
| Period (if LP) | 52 (weekly cycle) |
**Why:** Position traders care about the macro trajectory. A Gaussian with ℓ = 64 produces a curve that only turns on genuine multi-month inflections. Locally Periodic with `period = 52` is the ideal choice when a clear seasonal cycle is present — it uses both the long-range Gaussian envelope and the 52-bar periodicity to highlight cycle turns that align with trend.
---
**RESEARCH — Academic / Backtest**
| Parameter | Value |
|---|---|
| Bandwidth (ℓ) | Compute via `silvermanBandwidth(src, 200)` |
| Phase | 0 |
| Filter | `FILTER_NONE` |
| Best Kernel | Epanechnikov |
**Why:** Epanechnikov is the MSE-optimal kernel; `FILTER_NONE` keeps the estimator in its classical single-pass form; `phase = 0` centers the kernel on the bar being evaluated. This is the configuration that matches the statistical literature exactly — use it when publishing research, running Monte-Carlo studies, or calibrating against reference implementations.
🟦 BANDWIDTH SELECTION
Bandwidth `ℓ` is the single most consequential choice in kernel regression. Too small and the estimate overfits local noise; too large and it flattens real structure. KernelLens exposes two helpers to support both manual and semi-automated bandwidth selection.
**Manual — Start with ℓ ≈ √n**
A practical starting point for financial time series: set `ℓ ≈ √window_of_interest`. If you care about 100-bar structure, try `ℓ = 10`. If you care about 400-bar structure, try `ℓ = 20`. Adjust by ±25 % based on how noisy the result looks.
**Silverman's Rule of Thumb**
The closed-form optimal bandwidth for Gaussian-family kernels under Gaussian source assumptions:
```
h ≈ 1.06 · σ · n^(−1/5)
```
Call `silvermanBandwidth(src, window)` to compute this value live. Because Pine requires `simple int` bandwidth at compile time, the returned value is for diagnostic use — plot it, read the stable value off the chart, then hard-code the rounded integer into your kernel calls.
**Leave-One-Out Cross-Validation (Manual)**
For academic rigor, compute the leave-one-out mean squared error for a range of bandwidths and pick the minimum. KernelLens does not automate this (it would require `series int` bandwidth, which Pine does not support inside kernel loops), but the formula is straightforward:
```
LOOCV(ℓ) = (1/n) · Σᵢ (yᵢ − ŷᵢ⁻ⁱ(ℓ))²
```
where `ŷᵢ⁻ⁱ` is the kernel estimate at bar `i` computed without including bar `i` in the sum. Evaluate offline, pick the minimum, hard-code the result.
🟦 FILTER SELECTION — WHEN TO USE EACH
| Filter | Best For | Avoid When |
|---|---|---|
| `FILTER_NONE` | Live signal generation, research / calibration, compact-support kernels on noisy data | Choppy markets where you need extra smoothing |
| `FILTER_SMOOTH` | Swing and position trades, confidence band midlines, most day-trading setups | Scalping — the double pass adds measurable lag |
| `FILTER_ZEROLAG` | Regime detection, crossover systems that need the curve to track price tightly | Low-volume assets — Zero Lag amplifies high-frequency noise |
The three filters use the same underlying kernel with the same bandwidth, so switching between them does not require re-tuning. Default to `FILTER_SMOOTH` when in doubt — it is the best-behaved option across the widest range of assets and timeframes.
🟦 COMPATIBILITY
KernelLens targets Pine Script v6 and runs on every PulseWire chart — no exchange, asset class, or timeframe restriction.
- **Crypto** — Spot, futures, perpetual contracts
- **Forex** — All majors, minors, and exotics
- **Equities** — Stocks, ETFs, indices
- **Commodities** — Metals, energy, agriculture
- **Timeframes** — 1 minute through Monthly
The library is deterministic — given the same source and parameters, every bar of every symbol produces the same estimate. No calibration is needed across assets; the bandwidth parameter alone controls smoothness, and the kernel formulas are scale-free in the source dimension. Silverman's bandwidth helper automatically adapts to each asset's volatility.
🟦 TECHNICAL NOTES
- **Pine Script v6** — uses the modern type system, strict type checking, and the `switch` expression in the unified dispatcher
- **Non-repainting** — kernel outputs for any confirmed bar depend only on that bar's history; there is no look-ahead, no `request.security` with lookahead, and no dependency on the unconfirmed current bar unless `_phase = 0` is deliberately chosen
- **NA-safe iteration** — every bar lookup inside a kernel loop is guarded by `if not na(y)`, so chart history gaps and warm-up bars cannot poison the weighted sum
- **Division-by-zero protection** — every kernel's final division checks `den > 0.0` and returns `na` if the denominator collapses (which can only happen on truly empty windows)
- **Input validation** — every public function asserts its preconditions up front via `_assertFilter`, `_assertBandwidth`, `_assertPeriod`, `_assertAlpha`, and raises `runtime.error` with a descriptive message on misuse — no silent `na` fallbacks
- **Lazy filter evaluation** — the `"No Filter"` path never executes the second kernel pass; the `if`-branch check short-circuits, so single-pass mode is as cheap as a raw kernel call
- **Correct loop bounds** — `_depthInfinite`, `_depthCompact`, and `_depthPeriodic` compute the correct window size per kernel family, fixing the silent `_size = 1` bug that plagues every other published Pine kernel library
- **No persistent state** — the library is purely functional: no `var`, no arrays, no history buffers that grow over time; every export is a pure expression of `(inputs) → output`, so Pine's `max_*_count` limits cannot be exceeded and the library cannot leak memory
- **O(bandwidth) per bar per kernel call** — the loop depth is bounded by the constants in Section 0; there is no hidden quadratic behavior and the cost scales linearly with the user-chosen bandwidth
- **Unicode-safe comments** — the source uses academic notation (`σ`, `ℓ`, `α`, `ŷ`, `ℝ`) where it improves readability; all strings are plain ASCII for runtime compatibility
🟦 ACADEMIC REFERENCES
Every kernel and every formula in KernelLens is cited inline in the source. The combined bibliography:
- **Nadaraya, E. A. (1964).** On estimating regression. *Theory of Probability & Its Applications*, 9(1), 141–142.
- **Watson, G. S. (1964).** Smooth regression analysis. *Sankhyā: The Indian Journal of Statistics, Series A*, 26(4), 359–372.
- **Cleveland, W. S. (1979).** Robust locally weighted regression and smoothing scatterplots. *Journal of the American Statistical Association*, 74(368), 829–836. *(Tricube kernel, LOWESS.)*
- **Silverman, B. W. (1986).** *Density Estimation for Statistics and Data Analysis*. Chapman & Hall, London. *(Bandwidth rule of thumb.)*
- **Wand, M. P. & Jones, M. C. (1995).** *Kernel Smoothing*. Chapman & Hall. *(Unified treatment of all eight kernels.)*
- **MacKay, D. J. C. (1998).** Introduction to Gaussian Processes. *NIPS Tutorial*. *(Periodic and Rational Quadratic kernels.)*
- **Ehlers, J. F. (2000).** *Rocket Science for Traders*. John Wiley & Sons. *(Zero-lag smoothing trick.)*
- **Rasmussen, C. E. & Williams, C. K. I. (2006).** *Gaussian Processes for Machine Learning*. MIT Press. *(Locally Periodic and Rational Quadratic kernels.)*
🟦 VERSIONING & LICENSE
- **Version** — 1.0.0
- **Pine Script** — v6
- **License** — Mozilla Public License 2.0
- **Status** — Production-ready
KernelLens follows semantic versioning. Minor versions add new exports without breaking existing ones; patch versions fix bugs; major versions may change function signatures and will be announced in the changelog.
🟦 DISCLAIMER
KernelLens is a mathematical library for non-parametric regression on financial time series using the Nadaraya–Watson method. The library is provided solely for educational and research purposes and does not constitute financial, investment, or trading advice.
Kernel regression is a local smoothing technique. It estimates the mean of a source series in the neighborhood of the current bar based on historical data, but it does not predict future prices, does not generate trading signals on its own, and does not guarantee the profitability of any strategy built on top of its output.
Past performance of any model does not guarantee future results. Markets contain systemic risks that cannot be eliminated by any amount of mathematical rigor in the kernel itself. Responsibility for any trading decisions made using this library rests entirely with the user. Always apply sound capital management, conduct your own independent analysis, and never risk capital you are not prepared to lose.
The author assumes no liability for direct or indirect losses incurred through the use of KernelLens or any indicator built on top of it. Library

Indicator

AG Pro Daily Open Acceptance Map [AGPro Series]AG PRO DAILY OPEN ACCEPTANCE MAP
OVERVIEW
AG Pro Daily Open Acceptance Map is an intraday overlay built to track how price behaves around the current daily open and to present that behavior in a clean, rules-based structure. Instead of treating the daily open as a passive reference line, this script evaluates whether price is being accepted above it, accepted below it, or repeatedly failing around it.
The core design goal is clarity. Many traders use the daily open as a contextual anchor, but in practice it is often shown as only a simple line with no structured interpretation. This script is designed to go one step further by turning that level into a mapped decision framework. The result is a chart that helps users read whether the market is holding one side of the daily open with acceptance, drifting into indecision, or failing to maintain directional control.
This tool is intentionally narrow in scope. It is not built as a full market structure engine, a session model, a prior high/low dashboard, a VWAP tool, or a moving average framework. Its role is much more specific: to organize the behavior of price around the daily open and to express that behavior through a compact state model, visual reference lines, and confirmed state transitions.
Because the daily open resets every trading day, the script also produces a recurring intraday reference that can be reused across many symbols and market conditions. This makes it useful for users who prefer repeatable visual anchors instead of highly discretionary chart interpretation.
WHAT IT DOES
This script identifies the current daily open and treats it as the primary intraday reference level. From there, it evaluates whether price is holding above the level, holding below the level, or still testing the area without confirmation. It also tracks the first reclaim event when enabled, allowing users to see whether the market has recovered one side of the level after losing it earlier in the day.
The overlay is structured so the current daily open remains the main visual anchor, while the previous daily open can be shown as a lighter secondary context level. Acceptance areas and state mapping are kept as supporting elements rather than replacing the open itself. This keeps the chart readable while still preserving a visual record of how the market behaved around the level throughout the session.
In practical terms, the script helps answer a simple but important question: is price truly holding one side of the daily open, or is it only rotating around it without meaningful acceptance?
HOW THIS DIFFERS FROM OTHER AG PRO TOOLS
This script is intentionally separated from the logic families used in other AG Pro tools.
It does not rely on VWAP behavior.
It does not build decisions from EMA or moving average relationships.
It does not classify price by prior day or prior week high/low structures.
It does not depend on sweep, stop hunt, liquidity trap, or session-kill-zone logic.
It does not function as a structure label, breakout, or order-flow style engine.
The purpose here is much more focused. AG Pro Daily Open Acceptance Map is a daily-open behavior tool. Its main question is not whether a breakout happened, whether liquidity was taken, or whether a trend indicator flipped. Its main question is whether the market is accepting or rejecting one side of the current daily open.
That narrow positioning is deliberate. It helps keep the chart logic cleaner, the visual language simpler, and the use case easier to understand.
UNIQUE EDGE
The unique edge of this script is not the presence of a daily open line by itself. Many tools can plot a daily open. The distinctive part of this indicator is the state framework built around that line.
Instead of only drawing the level, the script evaluates market behavior around it and converts that into a practical overlay language. The chart can therefore communicate whether the market is in bullish acceptance, bearish acceptance, or unresolved testing, rather than forcing the user to interpret every interaction manually.
The script also separates the current daily open from the previous daily open in a clear visual hierarchy. The current open is treated as the primary live anchor, while the previous open is optional secondary context. This helps users compare the active intraday reference against the prior session without turning the chart into a multi-level dashboard.
Another advantage is that the visual model remains compact. The script is designed to offer information density without becoming visually noisy, which is especially important on publish screenshots and on charts where traders prefer a clean price-first layout.
METHODOLOGY
The script starts by identifying the current daily open and, when enabled, the previous daily open. The current daily open becomes the main reference for all live state calculations.
From there, the script measures whether price is sustaining closes above the level, sustaining closes below the level, or remaining in a testing state around the level. The filter mode can be adjusted to make the interpretation more responsive or more selective. In more permissive settings, state shifts can appear earlier. In stricter settings, price generally needs cleaner confirmation before a state is recognized.
When reclaim logic is enabled, the script also monitors whether one side of the daily open is recovered after being lost earlier in the day. This is not treated as a separate prediction model. It is simply an additional contextual event that can help users understand whether the market is recovering control around the open after temporary failure.
The acceptance area, open zone, and state ribbon are visual support layers. They are not intended to replace price or overwhelm the chart. Their purpose is to make the interpretation easier to read while keeping the current daily open as the main anchor.
SIGNALS AND ALERTS
The script supports confirmed-bar style logic so that state changes can be tracked in a more stable way. Depending on the enabled settings, users can monitor:
Bullish acceptance conditions
Bearish acceptance conditions
Testing or unresolved behavior around the daily open
First reclaim context when enabled
General state transitions when the market changes side or loses control
These alerts and visual states are intended for chart organization and condition awareness. They should not be interpreted as guaranteed trade outcomes, guaranteed continuation signals, or automated execution instructions.
KEY INPUTS
FILTER MODE
Users can switch between stricter and more responsive behavior depending on how selective they want the state model to be.
HOLD / CONFIRMATION SETTINGS
These controls affect how much sustained price behavior is required before the script recognizes an accepted state.
TOLERANCE AND OPEN ZONE SETTINGS
These help define how tightly or loosely the script interprets price behavior around the daily open area.
FIRST RECLAIM SETTINGS
These controls determine whether reclaim events are tracked as part of the daily open behavior model.
DISPLAY SETTINGS
Users can control whether the current daily open, previous daily open, acceptance area, ribbon, labels, and panel elements are shown.
VISUAL SIZE SETTINGS
Panel and label sizing can be adjusted depending on symbol volatility, screen resolution, and chart density preferences.
LIMITATIONS AND TRANSPARENCY
This script is not a forecasting engine. It does not predict where price must go next. It evaluates how price is behaving relative to the current daily open and displays that information in a structured way.
It is also not a substitute for complete market analysis. It does not include broader trend context, liquidity analysis, volume profile logic, macro structure interpretation, news impact, or instrument-specific catalysts unless the user applies those separately.
Different symbols and timeframes can also produce different daily open behavior. In some instruments the daily open may act as a very strong intraday reference, while in others price may rotate around it more loosely. Because of that, the script should be interpreted as a contextual decision aid rather than a universal standalone solution.
The previous daily open is included only as optional secondary context. It does not drive the main state model. The main live logic is built around the current daily open.
RISK DISCLOSURE
This script is provided for market analysis, chart organization, and educational use. It does not provide financial advice, investment advice, or guaranteed trade signals. No indicator can remove market risk, and no visual state model can ensure a profitable result.
Traders should use their own judgment, position sizing rules, and risk management process before making any decision. This tool can help structure chart interpretation, but execution responsibility always remains with the user.
Indicator

Daily Deviation Range and Gap Stats - NikaQuant
## What It Does
This indicator projects six pairs of deviation levels above and below a defined session range, draws a daily gap line at a configurable time, and shows a live stats panel with historical hit rates, mean-revert rates, gap fill statistics, and trade-decision suggestions.
The range itself is captured as the high and low of 5-minute closes during a configurable New York time window (default 19:30 to 20:30 NY). Once the window closes, the range is locked and six fibonacci-style deviation levels at multiples 1, 2.5, 5, 8, 13, and 19 of the range size are projected forward both upward and downward across the next trading day until a configurable cutoff (default 16:00 NY next day).
A separate gap line is captured at a configurable time (default 15:55 NY) using the close of that 5-minute bar. The gap line extends visually across the overnight session and is monitored for fill during the next session's open-to-close window (default 09:30 to 16:00 NY). When price crosses the gap level inside that window, the line is locked at the fill bar.
A live statistics table aggregates historical performance per day for the lookback period, showing per-level touch frequencies, mean-revert frequencies, close-inside-level frequencies, and gap fill statistics, then turns these into actionable trade-setup suggestions.
## Why It Is Original
Unlike a standard pivots or fibonacci-retracement indicator, this script is not a static price-level projection. It is a session-range deviation framework combined with an integrated gap tracker and a per-level historical statistics engine.
This script combines three distinct functional modules because each one addresses a different question about session structure:
(1) The range-multiple deviation levels answer "how far has price moved from session balance, in units of session range?" — analogous to standard-deviation channels but anchored to a user-defined range window rather than a rolling average.
(2) The daily gap line answers "is there an unfilled overnight reference price and what is the historical edge of trading toward it?" — different from standard gap detectors that only flag open-to-close gaps because it captures a specific price (the close at gap-time) and tracks fill behaviour inside a defined session window.
(3) The historical statistics engine answers "given today's structure, what has actually happened on past days when price reached the same levels or when a gap was open at this distance?" — turning the visual levels into probability-weighted decision inputs rather than just lines on a chart.
Together, the three modules produce something none of them would alone: a session-relative deviation map with quantified historical edge per level, plus a context-aware trade decision suggestion that combines current position, time remaining in the session, and historical revert behaviour.
The script also enforces a strict 5-minute internal data resolution regardless of chart timeframe (1-minute through 1-hour), so the levels and gap stay consistent whether the user is on a 5m chart or a 1H chart. This is accomplished via a dual-path data fetch that adapts to the chart's timeframe — pulling individual 5-minute samples on lower-timeframe charts and aggregating 5-minute closes per chart bar on higher-timeframe charts.
## How It Works
On each chart bar the script collects the 5-minute bars that have closed since the last update. For each 5-minute bar it checks whether the bar falls inside the range window, the extension window, the gap trigger time, or the gap fill window, and updates the relevant state.
When a 5-minute bar marks the end of the range window, the script locks in the highest and lowest 5-minute closes of the window, computes the range size and midline, and draws the deviation levels at multiples of the range above the high and below the low, projected forward to the configured extension-end time. A range-outline box is drawn over the range window for visual reference.
When a 5-minute bar matches the gap-trigger time, the script captures that bar's close as the gap price and starts drawing a horizontal line. On every subsequent 5-minute bar inside the next session's gap-fill window, the script checks whether the bar's high-low straddles the gap price. If so, the line is locked and the gap is recorded as filled.
Every time a deviation level is touched intraday — the 5-minute high reaches an upper level or the 5-minute low reaches a lower level — the script records that touch for the day. If price subsequently revisits the midline before the extension window ends, all touched levels for that day are also recorded as having reverted. When the extension window ends, the day's data is appended to a rolling history.
Each day's gap statistics (occurred, filled, minutes from fill-window open to fill) are appended at the next gap trigger, which ensures the gap is paired with its complete fill outcome before the next gap overwrites the live tracking state.
The stats table reads the history and renders per-level touch frequency, per-level revert frequency, close-inside-level frequency, gap fill rate, gap fill-time distribution (average, median, percent filled within 1 hour, percent filled within 4 hours), daily directional bias, range expansion vs contraction regime, day-type classification, time-elapsed in the active extension, and a context-aware trade-setup suggestion with stop and target prices for active fade setups.
The setup engine includes a time-remaining guard: when fewer minutes remain in the extension than the configured threshold, time-sensitive setups (fades and gap targets) are suppressed and the panel shows a "late session" status instead.
## How To Use It
- A range outline box appears over the range window once the window closes — this is the visual reference for the session range.
- Six pairs of lines extend forward from range-end to extension-end at multiples 1, 2.5, 5, 8, 13, and 19 of the range above and below the range high and low.
- Numerical labels at each level show the multiple — labels can be placed at the left or right end of the line via the "Level Label Side" setting.
- The gap line appears horizontally at the gap price after the configured gap time and extends until either price crosses through it during the fill window or the next day's gap is set.
- The live stats panel shows current price location vs midline (in range-multiples), today's range vs historical average, the current zone between two adjacent levels, the furthest level tagged today, per-level historical touch and revert rates, gap fill statistics, and a live setup suggestion.
Recommended timeframes: 1-minute through 1-hour. The script always uses 5-minute data internally, so behavior is consistent across chart timeframes.
Recommended markets: 24-hour markets such as index futures (ES, NQ), major FX pairs, and crypto majors, where overnight session structure matters and the configured NY-time windows align with meaningful session boundaries.
Avoid using when: less than 30 sessions of chart history are loaded (statistics will be unreliable) or on instruments that close before the configured range window (the range simply will not populate).
## Settings
- Max Deviation Days (default 11): how many past days to keep deviation levels visible. Older days are removed automatically.
- Show Deviation Levels: toggle the level lines.
- Normalize Range Size: when on, the range box and level distances use the average range over N past days instead of today's actual range.
- Normalize over N Days (default 500): number of past days to average for the normalization.
- Range Start and End Hour and Minute (default 19:30 to 20:30 NY): the window during which the range is captured.
- Extension Start and End Hour and Minute (default 20:30 to 16:00 NY next day): the window during which the deviation levels are drawn forward.
- Show Gap Level: toggle the gap line.
- Max Gap Days (default 11): number of past gap lines to keep visible.
- Gap Time Hour and Minute (default 15:55 NY): the 5-minute bar whose close becomes the gap price.
- Gap Close Start and End Hour and Minute (default 09:30 to 16:00 NY next day): the window during which gap fill is detected.
- Show Range Outline (default on): toggle the range outline box.
- Range Outline Color, Width, Style, Fill Transparency: visual settings for the box.
- Gap Width, Style, Color: visual settings for the gap line.
- Levels Width, Style: visual settings for the deviation lines.
- Level 1 through Level 6 (defaults 1, 2.5, 5, 8, 13, 19): numeric multiples of the range used for each level pair.
- Level 1 to 6 Color: per-level color.
- Level Label Side (default Left): place the level number labels at the left or right end of each line.
- Font Size (default 9): label font size.
- Show Stats Table (default on): toggle the live statistics panel.
- Stats Lookback in Days (default 5000): number of past completed days to include in historical statistics. Higher means more reliable percentages but requires more chart history loaded.
- Min Revert Percent for Fade Setup (default 55): a FADE setup is suggested only if the historical mean-revert rate at the touched level is at or above this threshold and the level was tagged at least 3 times in the lookback.
- Min Remaining Minutes for Setup (default 60): suppresses time-sensitive setups when fewer than this many minutes remain in the extension. Set to 0 to disable.
- Table Position (default Top Right): where the stats table is anchored.
- Table Size (default Normal): text size inside the stats table.
- Bull / Setup Color, Bear / Warning Color, Table Background, Table Text, Table Border: color settings for the panel.
## Alerts
Five alert conditions are exposed and can be selected from PulseWire's "Add Alert" dialog:
- Range Locked: fires when the range window closes and the levels are projected.
- Level Tagged: fires the first time price reaches any deviation level on either side.
- Gap Set: fires when the daily gap level is captured.
- Gap Filled: fires when price crosses through an open gap during the fill window.
- Session End: fires when the extension window ends and stats are finalized.
## Notes
The script does not repaint after a 5-minute bar closes. The range, deviation levels, and gap line are drawn from confirmed data only. The live distance-from-midline and live setup suggestions update intrabar based on current price.
Future bar-index positions for projected lines and labels are estimated based on the chart timeframe's bar duration. On charts with weekend gaps the projected end positions may visually diverge from the configured extension-end time by a small amount, but the underlying logical end time is correct.
Indicator

Indicator

Strategy

Indicator

Index Futures Position Size CalculatorA simple, free position size calculator for CME index futures.
Click Entry, click Stop Loss, pick your asset, get your contract size. That's it.
═══════════════════════════════════
✦ SUPPORTED INSTRUMENTS
MNQ • MES • NQ • ES — all CME tick values hardcoded.
═══════════════════════════════════
✦ FEATURES
→ One-click Entry & Stop Loss directly on chart
→ Auto 1-handle SL buffer (protects against wick hunts)
→ Asset dropdown — no manual tick value entry
→ Custom rounding (≥0.75 rounds up, else down)
→ Green Entry / Red SL lines with price labels
→ Clean black-on-white size panel, top right
═══════════════════════════════════
✦ HOW TO USE
Add to chart → click Entry → click Stop Loss
Settings → pick asset, enter Account Size & Risk %
Read your size from the top-right panel
═══════════════════════════════════
✦ TIP
If you're trading a funded challenge, here are two clean ways to use this tool with your max loss limit:
Method 1 — Loss budget split
Decide how many consecutive losses you can take before you're out. Divide your max loss by that number, and use the result as your "Account Size" with Risk % at 100.
Example: $2,000 max loss ÷ 5 losses = $400 per trade
→ Account Size: $400 | Risk %: 100
Method 2 — Direct percentage
Enter your full max loss as Account Size and set Risk % to your per-trade percentage.
Example: $2,000 max loss, risking 20% per trade
→ Account Size: $2,000 | Risk %: 20
Both give the same result — pick whichever feels more natural.
═══════════════════════════════════
✦ A NOTE FROM THE AUTHOR
Built with Claude AI for my own daily trading. Sharing it free because clean tools shouldn't be locked behind paywalls.
100% free. 100% open source. No Discord, no course, no affiliate links, nothing to buy. Copy it, modify it, republish your own version — it's yours.
═══════════════════════════════════
✦ DISCLAIMER
Educational tool only. Not financial advice. Futures trading carries substantial risk of loss. Always verify calculations against your broker's parameters before trading.
Built with ❤️ by REDz & Claude Indicator

Indicator

Indicator

Indicator

Indicator

QuantEdge Momentum ML [PRO]🟦 QuantEdge Momentum ML PRO is a k-Nearest Neighbors driven momentum oscillator built on an adaptive machine-learning core. Unlike RSI, Stochastic, or MACD — which apply the same static formula to every asset — QE-ML PRO learns the dual-horizon RSI fingerprints that have historically led to bullish versus bearish outcomes on the exact instrument being traded, then scores the current bar against the N closest historical matches. The result is a non-parametric, self-calibrating oscillator whose decision boundary is shaped by the asset's own behaviour rather than a hard-coded curve.
The indicator integrates nine independent layers — feature engine, training sampler, k-NN predictor, WMA signal line, stdev-adjusted OB/OS bands, filtered signal dots, gradient channel, theme-adaptive dashboard, and a nine-theme palette — all rendered on a single, clean oscillator panel.
🟦 HOW THE CORE ENGINE WORKS
**Dual-Horizon RSI Feature Vector**
Each bar, the Feature Engine computes two RSI values at different lookback windows and smooths both through a shared trend-length WMA:
- `rsiFast = WMA(RSI(close, FastPeriod), TrendLength)` — reactive short-term momentum
- `rsiSlow = WMA(RSI(close, SlowPeriod), TrendLength)` — structural mid-term momentum
The pair `(rsiSlow, rsiFast)` is a 2-dimensional point in RSI feature space. Every training sample stores one such point along with a ±1 label that records whether price rose or fell since the previous sample. Over time the dataset accumulates a cloud of labelled points that maps which RSI states historically preceded up-moves versus down-moves on this exact asset.
**Training Sampler — Multi-Trigger Collector**
Three collection modes decide when to append a new labelled sample:
| Mode | Trigger | Use Case |
|---|---|---|
| **MA Crossover** | Fast WMA crosses Slow WMA | Clean, sparse samples — classic single-trigger behaviour |
| **Periodic** | Every N bars (user-set) | Fills dataset fast on new / low-history charts |
| **Hybrid** | MA crossover **OR** every N bars | Richest training set — recommended for fresh assets |
Sampling is gated by `barstate.isconfirmed` so the dataset never absorbs unconfirmed values from a flickering live bar.
**k-NN Predictor with Adaptive k**
On every bar, the predictor computes Euclidean distance in the 2D RSI feature space between the live `(rsiSlow, rsiFast)` point and every historical sample:
```
d = sqrt((rsiSlow_now - rsiSlow_hist)² + (rsiFast_now - rsiFast_hist)²)
```
The K closest historical points vote by summing their ±1 labels. The effective K is resolved adaptively using the classical statistical heuristic:
```
kEff = max(3, min(kMax, floor(sqrt(N))))
```
This means early bars — when only a handful of samples exist — use a small K, and the value stabilises as the dataset fills. On a fresh chart you never get a noisy prediction from an undersized neighborhood, and on a mature dataset K automatically scales up for smoother output.
**Bias Correction — Label-Mean Recentering**
Raw k-NN output is biased whenever the label distribution is skewed. On a trending asset, Periodic sampling fills the dataset with mostly +1 (or mostly −1) labels, pushing every prediction off zero. QE-ML PRO subtracts the expected value from the raw sum:
```
prediction = neighborLabelSum − (kEff × meanLabelAcrossDataset)
```
This keeps the mid-level visually centred at zero regardless of how trending the underlying asset has been. The correction is applied on every bar and is what makes the oscillator read cleanly on both sideways and strongly trending markets.
**Minimum Sample Gate**
Until the dataset has reached the user-defined Minimum Training Samples threshold, the predictor outputs exactly zero. This prevents unreliable readings during the warm-up phase on fresh charts.
**FIFO Rotation**
The dataset is hard-capped at Max Dataset Size. Once the cap is reached, the oldest sample is discarded on every new insertion — classical rolling window memory that keeps the k-NN scan bounded and the indicator fast on long histories.
🟦 PREDICTION LINE — FIVE VISUAL STYLES
All five styles are line-based. Only the visual effect differs — the underlying k-NN math is identical across styles.
| Style | Character |
|---|---|
| **Stratum** | Thick adaptive line with zone-based opacity: solid in extreme zones, semi-transparent in the mid zone. Layered intensity aesthetic — default |
| **Neon** | Bright core line with an outer glow halo. Cyberpunk luminous effect, best on dark backgrounds |
| **Resonance** | LRI-style gradient line that fades near the midline and brightens toward the rolling extremes |
| **Pulse** | Adaptive bull/bear color (above midline = bull, below = bear) plus the WMA signal line. The QE-ML PRO classic look |
| **Mono** | Single flat theme-bull line, no gradient, no adaptive coloring. Minimalist single-color silhouette |
🟦 SIGNAL LINE
A WMA of the raw prediction output, used as a crossover trigger line in the MACD convention. Crossovers between the prediction and signal line mark momentum regime changes.
**Two Visual Styles**
| Style | Rendering |
|---|---|
| **Neon** | Bright core line wrapped in a wider semi-transparent glow halo — cyberpunk aesthetic |
| **Flat** | Plain single-color line, no halo, no gradient — minimalist clean look |
🟦 SIGNAL DOTS — FILTERED CROSSOVER MARKERS
A two-layer neon cross-dot renderer fires on every Prediction × Signal crossover that survives the active filter mode. Four progressive filters decide which raw crosses reach the chart:
| Filter Mode | Behaviour | Signal Count |
|---|---|---|
| **All Crosses** | Every cross becomes a dot | Highest — noisy on choppy assets |
| **Zone Only** | Only crosses inside an OB or OS strip | Mean-reversion triggers — strongest reversal setups |
| **Mid Aligned** | Bull dots only above mid, bear dots only below | Trend-following — keeps you on regime side |
| **Strict** | Zone Only + Mid Aligned + extra strength multiplier on mid-zone crosses | Fewest signals, highest conviction — default |
Two additional gates filter out whipsaws:
- **Cooldown (bars)** — minimum spacing between consecutive dots, prevents cluster spam in ranges
- **Min Strength** — minimum `|prediction − signal|` separation at the moment of the cross, drops razor-thin crossovers that close back on themselves
Each dot is a two-layer plot: an outer glow halo with user-adjustable size and opacity, and a bright solid core on top — independently sized and opacity-controlled so users can dial in the exact visual weight they want.
The dot is placed at the actual cross point: bull dots at `min(prediction, signalLine)`, bear dots at `max(prediction, signalLine)`.
🟦 DYNAMIC BANDS — STDEV-ADJUSTED OB / OS ZONES
QE-ML PRO does not use fixed 80 / 20 overbought / oversold levels. Instead, the bands adapt to the actual historical range of the prediction output:
- **Channel Extremes** — rolling highest / lowest of the prediction over a user-configurable lookback
- **Stdev Band** — EMA of rolling standard deviation of the prediction, multiplied by the user's stdev length
- **OB Level** = `rangeHi − stdevBand` (inner boundary of the overbought strip)
- **OS Level** = `rangeLo + stdevBand` (inner boundary of the oversold strip)
The result is a pair of mean-reversion zones that tighten during quiet markets and widen during volatile ones — no manual recalibration needed across assets.
The strips are rendered as gradient fills anchored on the live prediction plot, so they only appear visually while the prediction is actually inside the zone.
🟦 CHANNEL GRADIENT
Two symmetric gradient fills bracket the mid line. The upper fill stretches from `midValue` to `rangeHi`, the lower fill from `midValue` to `rangeLo`. Opacity fades from full intensity at the extremes to fully transparent at the midline — a visual range meter showing how close the prediction is sitting to its historical boundaries.
Colors are pulled from the active Theme. A single opacity slider controls the gradient intensity.
🟦 DASHBOARD — LIVE DATA PANEL
A compact 2-column × 7-row monospace panel drawn on the last bar only (zero historical overhead). Every field updates in real time on the live bar.
| Row | Left | Right |
|---|---|---|
| Header | QE-ML PRO | Regime (▲ BULL / ▼ BEAR / ■ NEUTRAL) |
| Row 1 | Prediction | Raw value + trend arrow vs previous bar |
| Row 2 | Signal | WMA trigger line value |
| Row 3 | Strength | 10-block gauge of `|prediction − signal|` normalised against rolling channel |
| Row 4 | Zone | OB / MID / OS tag |
| Row 5 | Dataset | Sample count / effective k |
| Row 6 | Mode | Active Learning Mode (MA Cross / Periodic / Hybrid) |
**Theme-Aware Auto-Invert**
The panel background scaffolds auto-switch:
- **Tropic / Amber / Pastel / Cyber / Gold / Electric / Candy** → dark panel with bright theme accent text
- **Midnight / Graphite** → light panel with dark theme accent text
This guarantees legibility on every theme without breaking the theme's color identity — because Midnight and Graphite use deep dark bull tones that would drown against a black panel.
**Direction via Glyphs, Not Color**
Both columns share the same full-strength theme tone. Regime direction is conveyed by `▲ ▼ ■` glyphs rather than color shifts, which keeps the panel reading cleanly even on the most minimal themes.
🟦 NINE COLOR THEMES
One theme selector drives every colored component — Prediction line, Signal line, Channel fill, OB / OS strips, Mid-level line, Signal Dots, and Dashboard panel. No per-color manual inputs.
| Theme | Character | Bull | Bear |
|---|---|---|---|
| **Tropic** | Cyan steel + deep orange — electric contrast (default) | Cyan | Deep Orange |
| **Amber** | Warm amber + indigo blue — fire tones | Amber | Red |
| **Pastel** | Sky blue + soft lavender — cool arctic glow | Sky Blue | Lavender |
| **Cyber** | Neon lime + hot crimson — cyber terminal | Neon Green | Crimson |
| **Gold** | Bright gold + scarlet — solar warmth | Yellow Gold | Red |
| **Electric** | Electric aqua + magenta — high-voltage neon | Aqua | Magenta |
| **Candy** | Neon green + hot pink — dark energy pop | Mint Green | Hot Pink |
| **Midnight** | Deep navy + dark crimson — dark depth (auto light dashboard) | Navy Blue | Dark Red |
| **Graphite** | Near-black + silver grey — monochrome minimal (auto light dashboard) | Near Black | Grey |
🟦 ALERT SYSTEM — TEN CONDITIONS
Every alert is gated by its matching "Show X" visibility toggle — if a component is hidden from the chart, its alerts are automatically suppressed. This eliminates the mismatch between visual signals and alert signals that plagues many indicators.
| Alert | Condition | Gated By |
|---|---|---|
| Crossover OB | Prediction crosses above the overbought boundary | Show OB/OS Fill |
| Crossunder OB | Prediction crosses back down through OB | Show OB/OS Fill |
| Crossover OS | Prediction crosses up through oversold boundary | Show OB/OS Fill |
| Crossunder OS | Prediction crosses below the oversold boundary | Show OB/OS Fill |
| Crossover Mid | Prediction crosses above the mid line — bullish regime flip | Show Mid Level |
| Crossunder Mid | Prediction crosses below the mid line — bearish regime flip | Show Mid Level |
| Crossover Signal | Prediction crosses above its WMA signal line (MACD bullish) | Show Signal Line |
| Crossunder Signal | Prediction crosses below its WMA signal line (MACD bearish) | Show Signal Line |
| Bull Signal Dot | A filtered Bull Signal Dot is plotted (uses Filter Mode + Cooldown + Min Strength) | Show Signal Dots |
| Bear Signal Dot | A filtered Bear Signal Dot is plotted (uses Filter Mode + Cooldown + Min Strength) | Show Signal Dots |
🟦 SETTINGS REFERENCE
**Visual**
- Theme — nine cohesive palettes. Default: Tropic
**Machine Learning**
- Neighbors (k) — upper bound on neighbors used by the predictor. Default: 100
- Adaptive k — scales k with dataset size using the `floor(sqrt(N))` heuristic. Default: ON
- Learning Mode — MA Crossover / Periodic / Hybrid. Default: MA Crossover
- Sample Every (bars) — bar interval for the Periodic / Hybrid trigger. Default: 5
- Minimum Training Samples — warm-up gate, predictor outputs zero until reached. Default: 30
- Max Dataset Size — hard FIFO cap. Default: 500 (safe on all timeframes)
**Feature Engine**
- Trend Length — WMA smoothing applied to both RSI features. Default: 20
- RSI Fast Period — first feature dimension. Default: 5
- RSI Slow Period — second feature dimension. Default: 20
- MA Fast Period — fast WMA for the crossover training trigger. Default: 5
- MA Slow Period — slow WMA for the crossover training trigger. Default: 20
**Prediction Line**
- Show Prediction Line — master toggle. Default: ON
- Prediction Style — Stratum / Neon / Resonance / Pulse / Mono. Default: Stratum
- Prediction Width — 1 to 5. Default: 2
**Signal Line**
- Show Signal Line — toggle. Default: ON
- Signal Style — Neon / Flat. Default: Neon
- Signal Period — WMA length of the signal line. Default: 20
- Signal Width — 1 to 5. Default: 1
**Signal Dots**
- Show Signal Dots — toggle. Default: ON
- Filter Mode — All Crosses / Zone Only / Mid Aligned / Strict. Default: Strict
- Cooldown (bars) — minimum spacing between dots. Default: 5
- Min Strength — minimum `|prediction − signal|` at the cross. Default: 0.5
- Core Dot Size — 1 to 8. Default: 3
- Core Dot Opacity — 0 to 100. Default: 100
- Glow Dot Size — 1 to 12. Default: 8
- Glow Dot Opacity — 0 to 100. Default: 30
**Channel Fill**
- Show Channel Fill — toggle. Default: ON
- Channel Opacity — 0 to 100. Default: 25
- Channel Lookback — rolling highest / lowest window. Default: 500
**OB / OS Fill**
- Show OB/OS Fill — toggle. Default: ON
- Zone Stdev Length — stdev window that offsets the OB / OS boundaries inward. Default: 20
**Mid Level**
- Show Mid Level — toggle. Default: ON
- Mid Level Value — Y-value of the reference line. Default: 0
- Mid Level Style — Solid / Dashed / Dotted. Default: Dashed
**Dashboard**
- Show Dashboard — toggle. Default: ON
- Panel Position — six slots (Top/Middle/Bottom × Right/Left). Default: Middle Right
- Panel Text Size — Tiny / Small / Normal / Large. Default: Small
**Alerts**
- Ten opt-in toggles, one per alert condition. All default: ON
🟦 TRADER PRESETS — SETTINGS BY STYLE
QE-ML PRO is volatility-agnostic thanks to the adaptive bands and bias correction, but the reactivity of the predictor scales directly with the feature and sampler parameters. The four presets below are tested starting points you can drop straight into the settings panel — adjust by ±20% to taste.
---
** SCALPER — 1m / 3m / 5m**
High-frequency entries, tight stops, many signals per session. Priority is reaction speed — you want the predictor to flip states within a handful of bars of an actual move.
| Setting | Value |
|---|---|
| Trend Length | 10 |
| RSI Fast Period | 3 |
| RSI Slow Period | 14 |
| MA Fast Period | 3 |
| MA Slow Period | 10 |
| Signal Period | 8 |
| Neighbors (k) | 40 |
| Adaptive k | ON |
| Learning Mode | **Hybrid** |
| Sample Every | 2 |
| Minimum Training Samples | 20 |
| Max Dataset Size | **300** (keeps 1m charts fast) |
| Filter Mode | **All Crosses** or Zone Only |
| Cooldown | 2 |
| Min Strength | 0.3 |
| Channel Lookback | 200 |
| Zone Stdev Length | 10 |
| Prediction Style | Neon or Stratum |
**Why:** Low smoothing (Trend=10) + short RSI pair (3/14) keeps the features razor-sharp. Hybrid learning means you never wait for an MA crossover during quiet 1m sessions. Max Dataset capped at 300 protects you from the PulseWire per-bar calculation limit on long 1m histories.
---
** DAY TRADER — 15m / 30m / 1H**
Balanced reactivity and conviction — the default profile. You want clean crosses without noise spam, and signals that survive the open / close volatility spikes.
| Setting | Value |
|---|---|
| Trend Length | 20 (default) |
| RSI Fast Period | 5 (default) |
| RSI Slow Period | 20 (default) |
| MA Fast Period | 5 (default) |
| MA Slow Period | 20 (default) |
| Signal Period | 20 (default) |
| Neighbors (k) | 100 (default) |
| Adaptive k | ON |
| Learning Mode | **MA Crossover** (default) |
| Minimum Training Samples | 30 (default) |
| Max Dataset Size | 500 (default) |
| Filter Mode | **Strict** (default) |
| Cooldown | 5 (default) |
| Min Strength | 0.5 (default) |
| Channel Lookback | 500 (default) |
| Zone Stdev Length | 20 (default) |
| Prediction Style | Stratum (default) |
**Why:** Every default value was tuned for this range. Strict filter + 5-bar cooldown keeps the dot count honest on a 30m chart. MA Crossover sampling gives you clean sparse data since 15m+ charts already have enough crossover events.
---
** SWING TRADER — 4H / 1D**
Lower signal frequency, higher conviction per signal. You're holding for days or weeks — every dot needs to mean something.
| Setting | Value |
|---|---|
| Trend Length | 30 |
| RSI Fast Period | 7 |
| RSI Slow Period | 30 |
| MA Fast Period | 7 |
| MA Slow Period | 30 |
| Signal Period | 30 |
| Neighbors (k) | 150 |
| Adaptive k | ON |
| Learning Mode | MA Crossover |
| Minimum Training Samples | 50 |
| Max Dataset Size | 800 |
| Filter Mode | **Strict** |
| Cooldown | 10 |
| Min Strength | 0.8 |
| Channel Lookback | 800 |
| Zone Stdev Length | 30 |
| Prediction Style | Stratum or Mono |
**Why:** Longer feature periods mean the predictor only moves on genuine structural shifts. Larger k (150) + bigger dataset (800) gives the k-NN vote a wider base so outliers don't flip the sign. Cooldown of 10 bars on a 4H chart = 40 hours minimum between dots — exactly what a swing trader wants.
---
** POSITION / LONG-TERM — 1D / 1W / 1M**
Macro regime detection. You're looking for the handful of generational setups per year — noise is the enemy.
| Setting | Value |
|---|---|
| Trend Length | 50 |
| RSI Fast Period | 10 |
| RSI Slow Period | 40 |
| MA Fast Period | 10 |
| MA Slow Period | 40 |
| Signal Period | 40 |
| Neighbors (k) | 200 |
| Adaptive k | ON |
| Learning Mode | **Hybrid** |
| Sample Every | 3 |
| Minimum Training Samples | 40 |
| Max Dataset Size | 1000 |
| Filter Mode | **Strict** |
| Cooldown | 15 |
| Min Strength | 1.0 |
| Channel Lookback | 1000 |
| Zone Stdev Length | 40 |
| Prediction Style | Mono or Pulse |
**Why:** Weekly and monthly charts have few crossover events per year — without Hybrid mode the dataset starves. Sample Every = 3 on a weekly chart means one sample every 3 weeks, which is plenty of structural density. Min Strength 1.0 filters out every shallow cross — you only see dots on generational momentum inflections.
---
**Tuning Tip**
If the predictor feels **too reactive** → increase Trend Length and Signal Period by 25%, raise Cooldown.
If the predictor feels **too sluggish** → switch Learning Mode to Hybrid, decrease Min Samples, lower Trend Length.
If the dashboard shows **Dataset N is stuck low** → switch Learning Mode from MA Crossover to Hybrid — crossover events are too rare on your current settings.
If you see **runtime / timeout errors** on long histories → drop Max Dataset Size to 300 and Channel Lookback to 300.
🟦 COMPATIBILITY
Works on all asset classes and all timeframes in PulseWire Pine Script v6.
- **Crypto** — Spot, futures, perpetual contracts
- **Forex** — All pairs
- **Equities** — Stocks, ETFs, indices
- **Commodities** — Metals, energy, agriculture
- **Timeframes** — 1m through Monthly
The k-NN engine learns each asset's own RSI fingerprint distribution, and the stdev-adjusted bands auto-scale to the volatility of that distribution, so the indicator is truly self-calibrating across assets and timeframes — no manual recalibration required.
🟦 TECHNICAL NOTES
- Pine Script v6
- No repainting — training samples are gated by `barstate.isconfirmed` so the dataset never absorbs unconfirmed live-bar values
- Dataset is hard-capped via FIFO rotation; no unbounded memory growth
- Dashboard renders only on `barstate.islast` — zero historical overhead
- All drawing objects are stateless plots (no label / box / line object pools), so `max_*_count` limits cannot be exceeded
- k-NN distance pass is O(N), sort is O(N log N), both bounded by Max Dataset Size
- Default Max Dataset Size of 500 is tuned to stay within PulseWire's per-bar calculation budget on histories up to ~50,000 bars
- Bias correction uses a single extra accumulator pass during the distance sweep — no performance penalty
🟦 DISCLAIMER
This indicator is provided for educational and informational purposes only. It does not constitute financial advice. Past performance does not guarantee future results. The k-NN engine learns from historical patterns, but markets do not guarantee that historical patterns will repeat. Always conduct your own analysis and apply proper risk management. Indicator

Indicator

Descriptive Statistics [Median, Quartiles, Outliers]This indicator seeks to provide insight to traders by modeling market structure using widely accepted statistical methods applied to price data. It does not predict direction; instead, it describes how current price behaves relative to its historical distribution.
It is built around non-parametric statistics, making it resistant to distortion from extreme price movements.
What it shows?
1. Median (Q2): The central equilibrium level of price distribution.
2. Quartiles (Q1, Q3): Boundaries of the “normal” trading range.
3. Interquartile Range (IQR): Measures the width of the core market structure.
4. Outlier Bands (1.5 × IQR rule): Statistical extremes where price becomes unusual relative to recent behavior.
How it works?
The indicator collects price data either through:
1. Reset Mode: Builds a new distribution each session (Daily, Weekly, Monthly, or chart timeframe).
2. Length Mode: Uses a rolling window of the last N candles.
All values are sorted to construct a real-time price distribution, from which median, quartiles, and outlier thresholds are derived.
How to use it?
1. Price inside Q1–Q3 range → normal market conditions
2. Price near Median → equilibrium / fair value zone
3. Price outside Outlier bands → statistically extreme conditions (potential exhaustion, expansion zones or news driven events)
4. Large expansions between Q1 and Q3 → increased volatility and potential momentum in either direction
Key concept?
This tool does not forecast price. It provides a distribution map of market behavior, helping traders understand structure, deviation, and statistical positioning of price.
⚠️ Note
This indicator is for educational and analytical purposes only and should not be used as standalone trading advice.
Author: TUGUME WILLIAM MUTARA Indicator

Indicator

SNP420 - SAO - Ultima - Multi-Asset Momentum IndicatorMulti-timeframe trend-following indicator for H1 charts. Combines D1 + H4 trend alignment with H1 entry precision using EMA, RSI, MACD, and ADX filters. Designed for EURUSD, USDJPY, and GBPUSD during London/NY
sessions.
Entry: Requires D1 and H4 trend agreement, price above/below EMA21, RSI in momentum zone (50-75 long / 25-50 short), positive MACD histogram, and ADX above 25. Signals only fire during active sessions (London,
Overlap, NY).
Exit logic (8 layers, priority-ordered): Hard SL at 2.5×ATR, TP at 5R, trailing stop from 2R profit, breakeven protection at 2R, stale position killer at 8 bars, D1/H4 trend reversal exits, and adaptive time
stops (48 bars losers / 96 bars winners).
On-chart display: Entry arrows (LONG/SHORT), color-coded exit labels (SL, TP, TRAIL, BE, STALE, FLIP, TIME), live SL/TP/trail level lines, trend background shading, EMA ribbon (21/50/200), and real-time info
panel showing D1/H4 trend, ADX, RSI, session status, and position state. Built-in alerts for all entry and exit events.
Backtested: +448% in 2025 (12/12 months profitable), +107% in 2026 Q1. Profit driven by TRAIL exits (100% WR, 83% of total profit). Robust across 10 synthetic market Monte Carlo scenarios (100% profitable, avg
78% of backtest performance).
Piece and love. Indicator

Indicator

Uptrick: ML Kernel Regression
Introduction
This indicator applies Nadaraya-Watson kernel regression, a non-parametric machine learning estimator, directly to price data in order to produce a smooth, noise-reduced representation of the market's underlying trend. Unlike moving averages that apply equal or linearly decaying weights, this method uses a Gaussian kernel function to assign weights based on how far back in time each bar sits relative to the current one. Bars closer in time receive exponentially higher weights, while older bars decay naturally. The result is a regression curve that adapts organically to local price structure rather than imposing a fixed lag model onto the data. Residual bands are then constructed around this curve using the rolling standard deviation of the difference between price and the regression line, forming dynamic envelopes that reflect actual price dispersion rather than arbitrary multipliers of a fixed moving average.
The indicator is designed for traders who want a statistically grounded trend baseline with state-driven directional signals, without relying on lagging traditional averages. It is built in Pine Script v6 and is fully non-repainting. All state decisions are committed only on confirmed bars, meaning no signal is generated intra-bar and no future bar data influences the output.
How It Works
The core calculation is the Nadaraya-Watson estimator. At each bar the indicator looks back across a user-defined window and computes a weighted average of past closing prices. The weight assigned to each historical bar is determined by the Gaussian kernel: weight = exp( -lag² / (2 · h²) ), where lag is the number of bars back and h is the bandwidth parameter. A larger bandwidth makes the curve smoother and slower to react. A smaller bandwidth makes it more reactive but noisier.
When adaptive bandwidth is enabled, the bandwidth h is scaled dynamically by a normalised ATR factor. In volatile periods, the kernel widens, producing a smoother estimate that avoids overreacting to spike conditions. In calm periods, the kernel tightens, allowing the curve to track price more closely. This makes the regression inherently context-aware without requiring the user to manually switch settings across different market regimes.
The residual at each bar is defined as the difference between the closing price and the regression value. A rolling standard deviation of these residuals forms the sigma value, which is then smoothed via EMA. The upper and lower bands are placed at a user-controlled multiple of sigma above and below the kernel line. Because the bands are derived from actual price-to-regression deviation, they expand during high-dispersion conditions and contract when price tracks the regression tightly.
State is classified as bullish when price closes above the upper band on a confirmed bar, and bearish when price closes below the lower band on a confirmed bar. Between breakout events the state persists, meaning the indicator holds its last valid directional reading rather than flipping to neutral. This gives the signal a regime-like quality rather than a purely oscillatory one.
Features
Nadaraya-Watson Gaussian kernel regression curve computed from scratch over a fully user-controlled lookback window
Adaptive bandwidth scaling driven by a normalised ATR factor, widening the kernel during volatile conditions and tightening it during calm ones
Residual-based standard deviation bands that expand and contract with actual price-to-regression dispersion rather than fixed multipliers
Smoothing controls for both the main regression output and the band width, allowing fine-tuning of reactivity versus stability
Three visual display modes: Bands mode showing the full envelope, Single Line mode showing only the regression curve with a gradient fill toward price, and Trail mode showing only the relevant band side as a directional trail
Gradient fills in all three visual modes that fade from the regression line outward toward price, maintaining visual clarity without obscuring price action
State-based bar coloring that applies the directional regime color to every candle, using custom plotcandle rendering for full wickcolor and bordercolor consistency
Signal labels that appear only on confirmed state transitions, placed at user-selectable anchors including High or Low, the Main Line, or the Band levels, with adjustable ATR-based offset
Seven selectable color themes covering Classic, Cyber Aqua, Crimson Pulse, Royal Purple, Emerald Night, Minimal Mono, and Classic Emerald, each providing a complete set of bull, bear, neutral, background, and frame colors
A live dashboard table displaying current signal direction, kernel MA value, upper band value, lower band value, current sigma width, and active bandwidth including whether adaptive mode is engaged
Alert conditions for bullish breakout above the upper band and bearish breakdown below the lower band, both tied to confirmed crossover and crossunder events
Toggle controls for bar coloring, band fill, and the dashboard table independently
Dashboard:
Band Mode:
Single Line Mode:
Trail Mode:
Inputs
Lookback Window: controls how many historical bars the Gaussian kernel sums over. Larger values produce a slower, broader regression curve. Default is 30.
Base Bandwidth (h): sets the core width of the Gaussian kernel. Higher values create smoother, more generalized curves. Lower values track price more closely. Default is 8.0.
Adaptive Bandwidth: when enabled, the bandwidth is multiplied by a factor derived from normalised ATR, making the kernel wider in volatile conditions. Default is enabled.
ATR Length (adaptive): the period used to compute the ATR for adaptive scaling. Default is 14.
MA Output Smoothing: applies an EMA pass over the raw regression output to reduce micro-jitter in the curve. Default is 3.
Band Multiplier (sigma): how many standard deviations above and below the regression line the bands are placed. Default is 1.0.
Band Lookback (sigma): the rolling window used to compute the standard deviation of residuals. Default is 24.
Band Smoothing: EMA smoothing applied to the raw sigma value to stabilize band movement. Default is 5.
Visual Mode: selects between Bands, Single Line, and Trail display modes.
Color Bars: enables state-colored candles. Default is enabled.
Fill Bands: enables the semi-transparent fill between upper and lower bands. Default is enabled.
Show Dashboard: toggles the live data table. Default is enabled.
Color Gradient Smooth: controls color smoothing, currently reserved for future gradient transitions.
Label Anchor: selects where signal labels are pinned. Options are High or Low, Main Line, and Bands.
Offset Mult (ATR): scales how far above or below the anchor point labels are offset. Default is 0.50.
Theme: selects the color theme across all visual elements.
Alert: Cross Above Upper Band: enables the bullish breakout alert condition.
Alert: Cross Below Lower Band: enables the bearish breakdown alert condition.
Originality
The originality of this script lies in the combination of a properly implemented Nadaraya-Watson estimator with an ATR-adaptive bandwidth system, residual standard deviation bands, and a persistent non-neutral state engine, all packaged with a multi-mode visual system that adjusts its presentation to the current directional regime. The regression curve is not a modified moving average. It is a genuine weighted least squares estimate computed bar by bar using a Gaussian kernel function. The adaptive bandwidth mechanism means the indicator does not treat all market conditions equally, which is a meaningful departure from static-parameter band systems. The state logic prioritises confirmed readings and persists between band contacts, which makes the regime classification stable and avoids the false-neutral problem common in threshold-based indicators. The three visual modes serve distinct use cases: Bands for envelope and breakout context, Single Line for a clean trend baseline, and Trail for a dynamic support or resistance reference that follows the active regime. These elements are not assembled from existing published open-source scripts; the full codebase is original work by the author.
Conclusion
Uptrick: ML Kernel Regression provides a statistically grounded approach to price smoothing and trend regime classification by applying a Gaussian kernel estimator rather than a conventional moving average. The adaptive bandwidth, residual bands, and persistent state logic work together to give traders a tool that reflects actual market behaviour rather than imposing fixed parameters onto it. The multiple visual modes and theme system make it practical across a range of chart styles and use cases.
Disclaimer
This script is published for educational and analytical purposes only. Nothing in this script or its description constitutes financial advice, investment advice, or a recommendation to buy or sell any asset. All trading involves risk. Past performance of any indicator or signal does not guarantee future results. You are solely responsible for your own trading decisions.
Indicator
