RollingWindow█ OVERVIEW
This a Pine Script™ library to create rolling windows with arrays and matrices.
A rolling window is a first-in-first-out algorithm that stores values over chart updates, removing the oldest element as new values are added. Many programmers implement a form of this algorithm into their scripts currently like this:
var window = array.new(size = 10)
window.push(close) // Append `close` as a new element every new bar.
if 10 < window.size() // Maintain a size of 10 elements.
window.shift() // Remove oldest element.
With the RollingWindow library, you can simply call `roll()` to do the same thing like so:
var window = array.new(size = 10)
window.roll(close) // Rolling window of 10 elements updated each bar with `close`.
█ USAGE
Rolling Window Arrays
Import the RollingWindow library into your script.
import joebaus/RollingWindow/1 as rw
Create a rolling window array by calling `roll()` on an array declared with `var` bar persistence.
var window = array.new()
rw.roll(id = window, source = close, size = 3) // Alternatively: window.roll(close, 3)
Using an array with `varip` intrabar persistence lets `roll()` execute on and update elements intrabar.
varip window = array.new() // Updates intrabar.
rw.roll(id = window, source = close, size = 3) // Executes `roll()` every realtime update.
Ensure arrays are declared with `var` or `varip` keywords to store updated elements. Otherwise, applying `roll()` will not store rolled values.
id = array.new() // No `var` or `varip` keyword.
rw.roll(id, close, 3) // Only updates a single element in `id`!
New elements can be added dynamically to empty arrays with the limit set by the `roll(size)` parameter. Once the array is full, every sequential chart update rolls out , removes, the oldest element.
varip id = array.new()
// Dynamically appends up to 3 elements of `timenow`, then rolls elements.
id.roll(source = timenow, size = 3) // Use `roll()` as a method on `id`.
Arrays with initialized values and sizes can be used as a rolling window array.
var array id = array.from("Hello", "World")
string closeString = str.tostring(close, format.mintick)
id.roll(source = closeString, size = 2) // Rolls elements into `id`, up to 2 elements.
The `roll(size)` parameter becomes optional for arrays with an initialized size, because `roll()` will by default use the initialized size of the array provided if `roll(size)` is not set.
var id = array.new(size = 3) // Returns
color gradient = color.from_gradient(close, low, high, color.red, color.green)
id.roll(source = gradient) // Uses the size of `id` as the rolling window size limit.
An array with initialized values can still grow dynamically if `roll(size)` parameter is greater than the array's initial size.
var id = array.new(size = 3) // Returns
chart.point nowPoint = chart.point.now(close)
id.roll(source = nowPoint, size = 4) // Dynamically grows to
The `roll(size)` parameter must always be equal to or greater than the initial size of the array, or else `roll()` will generate a runtime error.
var id = array.new(size = 3)
id.roll(source = close, size = 2) // Generates a runtime error!
// roll(array id, float source, int size):
// `size` (2) must be greater than or equal to the size of `id` (3), or set to `na`!
When the array size and `roll(size)` parameter are both unspecified, `roll()` will dynamically size the array up to the element limit before rolling new elements.
var id = array.new()
id.roll(timenow) // Adds new elements to `id` up to the element limit, then rolls elements.
From within a conditional local scope , `roll()` can operate on arrays in a higher scope.
var id1 = array.new(size = 3)
float sma50 = ta.sma(close, 50)
float sma200 = ta.sma(close, 200)
if ta.cross(sma50, sma200) // Golden Cross condition.
id1.roll(source = str.format_time(time)) // Rolls up to 3 Golden Cross dates into `id1`.
var id2 = array.new()
footprint reqFootprint = request.footprint(100)
if not na(reqFootprint)
id2.roll(source = reqFootprint, size = 3) // Rolls up to 3 footprint objects into `id2`.
`roll()` returns the element removed from the array, allowing scripts to capture values as they are rolled out.
var id = array.new(size = 3)
float removedElement = id.roll(close, 3) // Returns the removed `close` value from the array.
if not na(removedElement)
label.new(bar_index, removedValue, str.tostring(removedValue))
Reverse Rolling Window Arrays
The roll operation can be done in reverse order using the `rollReverse()` library function; new elements are inserted at the beginning of the array instead, and old elements are removed at the end of the array.
var id1 = array.new()
id1.rollReverse(source = close, size = 3) // Dynamically sized reverse rolling window array.
varip id2 = array.new(size = 3)
id2.rollReverse(source = close) // Initialized size reverse rolling window array.
`rollReverse()` returns the element removed from the array, just like `roll()`.
var id = array.new(size = 3)
int removedValue = id.rollReverse(bar_index, 3)
Sorted Rolling Window Arrays
Rolling window arrays created with `roll()` are unsorted. To create ascending sorted rolling window arrays for `float` or `int` types, use the `rollAscendingVar()` or `rollAscendingVarip()` functions for `var` and `varip` keyword arrays respectively.
var id1 = array.new()
// Ascending sorted, dynamically sized `var` rolling window array.
id1.rollAscendingVar(source = close, size = 3)
varip id2 = array.new(size = 3)
// Ascending sorted, initialized size `varip` rolling window array.
id2.rollAscendingVarip(source = bar_index)
To create descending sorted rolling window arrays for `float` or `int` types, use the `rollDescendingVar()` or `rollDescendingVarip()` functions for `var` and `varip` keyword arrays respectively.
var id1 = array.new()
// Descending sorted, dynamically sized `var` rolling window array.
id1.rollDescendingVar(bar_index, 3)
varip id2 = array.new(3)
// Descending sorted, initialized size `varip` rolling window array.
id2.rollDescendingVarip(close)
Just like with the `array.sort()` built-in function, the ascending and descending rolling window functions do not sort `na` values.
float sma = ta.sma(50, close) // First 49 values are `na`.
var id = array.new()
id.rollAscendingVar(sma, 3) // Rolls nothing until `sma` values are not `na`.
The arrays with unsorted values should be sorted in ascending or descending order before calling the respective sorted rolling window library functions.
var array id = array.from(4, 1, 2, 3, 10, 8, 15, 7) // Unsorted initialized array.
id.sort(order.ascending) // Sort it first!
id.rollAscendingVar(bar_index)
The sorted rolling window functions can return the latest element removed from the array.
var id = array.new(size = 3)
float removedElement = id.rollAscendingVar(close, 3)
Rolling Window Matrices
The `roll()` matrix methods store a rolling window of arrays in row-major order. Rows are "rolled" by adding a new row at index `0`, and removing the oldest row at the end of the matrix.
var closeArray = array.new(10) // Array to store in the rolling window matrix.
var closeMatrix = matrix.new()
// Create a rolling window matrix with up to 3 `closeArray` rows and 10 columns (1 per element).
rw.roll(id = closeMatrix, array_id = closeArray, rows = 3)
A matrix with `varip` intrabar persistence lets `roll()` execute and update matrix rows intrabar.
varip closeArray = array.new(size = 10)
rw.roll(id = closeArray, source = time)
varip closeMatrix = matrix.new()
// Create a rolling window matrix with up to 3 `closeArray` rows and 10 elements (columns).
closeMatrix.roll(array_id = closeArray, rows = 3)
The matrix methods of `roll()` will dynamically create the necessary columns to fit all elements of `roll(array_id)` as long as the array size is greater than the number of matrix columns.
var closeArray = array.new(size = 10000)
closeArray.roll(source = close) // Creating a rolling window array.
// Size empty matrices dynamically with `roll(array_id)`.
var closeMatrix = matrix.new()
// Roll up to 100 rows of `closeArray` with 10000 elements (columns) into `closeMatrix`.
rw.roll(id = closeMatrix, array_id = closeArray, rows = 100)
The size of `array_id` can possibly be too large when dynamically adding columns to a rolling window matrix, generating a runtime error when the new column would exceed the 100,000 matrix size limit.
var closeArray = array.new()
closeArray.roll(source = close, size = 1001)
var closeMatrix = matrix.new()
rw.roll(id = closeMatrix, array_id = closeArray, rows = 100) // Generates a runtime error!
// roll(matrix id, array array_id, int rows):
// `array_id` (1001) and `rows` (100) create 100100 matrix elements!"
// Reduce the size of `array_id` or value of `rows` to stay within the 100,000 matrix size limit!
A matrix with initialized rows and columns can also be used with `roll()`. This requires that the array's size used in `roll(array_id)` must be less than or equal to the number of matrix columns.
var closeArray = array.new(100) // Initialized matrix columns require initialized array sizes.
closeArray.roll(close) // Roll 100 `close` elements into `closeArray`.
var closeMatrix = matrix.new(rows = 10, columns = 100) // 100 array elements, 100 columns.
rw.roll(id = closeMatrix, array_id = closeArray, rows = 10)
The `roll(rows)` parameter is also optional: `roll()` will use the number of rows in the initialized matrix when `roll(rows)` is not set. Plus the number of initialized matrix columns does not have to be the same size as `roll(array_id)`.
var closeArray = array.new(10) // Array initialized with 10 elements.
closeArray.roll(close)
var closeMatrix = matrix.new(rows = 10, columns = 100) // Matrix initialized with 100 columns.
closeMatrix.roll(closeArray) // No `rows` parameter, uses the initialized number of matrix rows.
Managing Drawings
An array or matrix of `line`, `linefill`, `label`, `box`, `polyline`, or `table` types can be used with `roll()` to manage the number of drawing on a chart.
var id = array.new()
// Roll a label in `id` after a bullish bar is confirmed.
if close > open and barstate.isconfirmed
chart.point nowPoint = chart.point.now(high)
label newLabel = label.new(nowPoint, "Bullish")
id.roll(newLabel, 5) // Rolls up to 5 labels in `id`, array grows up to a size of 5.
When drawings are rolled out of an array or matrix, they are deleted with the `.delete()` method of the respective type used. The library functions return `void` for drawing types, so no value is returned when an element is removed.
Library

Trend Quality [AGPro Series]Trend Quality
Trend Quality fuses three independent regime dimensions — ADX directional strength, Kaufman Efficiency Ratio, and ATR-normalized EMA slope — into a single 0–100 composite Trend Quality Score. A hysteresis + confirmation + cooldown gate turns that score into a stable TREND / CHOP regime, enhanced with HTF confirmation, lifecycle phases, score velocity, breakout grading, directional dominance, and a full adaptive on-chart quality window. The goal is simple: replace noisy "is this a trend?" guessing with a transparent, multi-dimensional, low-lag quality reading you can read in one glance.
🎯 OVERVIEW
Most trend filters fail at the same thing — they tell you a trend exists, but not whether that trend is clean, accelerating, fading, or already exhausted. Trend Quality answers the harder question. Every bar is scored on three independent dimensions that each measure a different physical property of price movement:
• ADX — directional strength (how strongly one side dominates)
• Kaufman Efficiency Ratio (ER) — path efficiency (how little wasted motion)
• ATR-normalized EMA slope — normalized trend velocity (how fast, relative to volatility)
These three signals are combined into one 0–100 Trend Quality Score. A hysteresis band + confirmation bars + cooldown filter convert that score into a stable TREND / CHOP regime — no single-bar flipping, no false recovery wicks. On top of the core regime, the indicator layers Score Velocity, Lifecycle phases (Emerging → Confirmed → Exhausting), Breakout Quality grading (A / B / C), directional dominance, and a visual Quality Window that tracks the active trend zone and projects it forward.
💎 UNIQUE EDGE
What separates Trend Quality from a standard ADX filter, an EMA slope indicator, or a generic regime meter:
• Tri-factor fusion (not a single metric) — ADX alone misses path quality; ER alone misses direction; slope alone misses choppy-but-strong moves. Weighted fusion (45% ADX, 35% ER, 20% Slope) neutralizes each component's blind spot.
• Stable regime, not a flickering line — the TREND / CHOP state passes through a 3-layer filter: hysteresis band around the threshold, N confirmation bars, and a cooldown window after every transition. The result is a regime reading that holds through pullbacks without flipping.
• Score Velocity Engine — a second-derivative layer that watches how fast the score itself is changing. Surges flag momentum ignition; collapses flag quality breakdown before price confirms it. A bearish divergence detector fires when price makes new highs while quality is fading.
• Lifecycle phases — inside every TREND regime, the script distinguishes Emerging (young, fresh, accelerating), Confirmed (mature, stable, above buffer), and Exhausting (score rolling over from a peak). This lets you see whether you are entering early, running mid-trend, or catching the end.
• Breakout Quality Badge (A / B / C) — every CHOP → TREND transition receives a graded badge based on composite score plus velocity bonus. Grade A breakouts are rare and have an optional dedicated alert.
• HTF confirmation with Auto-HTF mapping — the same engine runs on a higher timeframe. When LTF is trending but HTF is not, the regime is marked BLOCKED (not forced to CHOP) so you retain full transparency about why the regime is gated.
• Adaptive Quality Window — a live rectangular zone that tracks the full trend's high/low from its start bar, projects forward, shows ceiling/floor projection labels, and preserves historical windows with directional color coding (green for up-trends, pink for down-trends, amber for HTF-blocked trends).
🧪 METHODOLOGY
Core composite score (every bar, LTF):
Score = 100 × (0.45 × ADX_norm + 0.35 × ER_norm + 0.20 × Slope_norm)
• ADX_norm = min(ADX / 50, 1)
• ER_norm = |close − close | / (SMA(|Δclose|, N) × N)
• Slope_norm = min(|EMA − EMA | / ATR × 10, 1)
Regime gating:
• Hysteresis: +3 above threshold to enter TREND, −3 below to enter CHOP
• Confirmation: N consecutive bars above/below the hysteresis band
• Cooldown: N bars after every regime flip where no new flip is allowed
MTF confirmation (optional, default ON):
The same core function is called via request.security on the HTF (Auto: 30m→4H, 4H→Daily, Daily→Weekly, Weekly→Monthly in Strict mode). When LTF=TREND but HTF=CHOP, the regime is tagged BLOCKED — a transparent third state that is neither forced-CHOP nor accepted-TREND.
Lifecycle logic:
• Emerging: TREND is young (bars since start ≤ Emerging Bars) OR score slope ≥ 0 and score below buffer
• Confirmed: score ≥ threshold + Confirmed Buffer AND HTF passes (optional)
• Exhausting: score slope < 0 AND pullback from peak ≥ Exhaustion Pullback
Score velocity:
velocity = score − score (default 5-bar look-back)
Breakout quality grading:
bqScore = score + velocity_bonus (bonus: +15 if vel>15, +7 if vel>5, else 0)
A ≥ 82, B ≥ 67, C < 67
🔔 SIGNALS & ALERTS
The script exposes 12 alert conditions — all moderator-safe, educational, non-solicitating:
• CHOP → TREND / TREND → CHOP regime flips with LTF+HTF context
• Strong Trend composite conviction threshold
• HTF Blocked / HTF Unblocked third-state transparency events
• Emerging / Confirmed / Exhausting Trend lifecycle phase changes
• Velocity Surge / Velocity Collapse second-derivative extremes
• Grade-A Breakout rare high-conviction breakouts
• Bearish Divergence price up, quality down warning
On-chart visual events (also filterable via inputs):
• Breakout Quality badge (A / B / C) at every CHOP → TREND
• Bearish divergence ⚠ marker at trend peaks where quality fades
• State tag near backbone: EMERGING / CONFIRMED / EXHAUSTING / HTF BLOCKED
• Quality Window label: ACTIVE + phase
• Projection labels on the right edge: QUALITY CEILING / TREND FLOOR
All badge and warning labels are gated with an 8-bar cooldown so the chart stays clean even on repeated intra-swing triggers.
⚙️ KEY INPUTS
Core engine:
• ADX Length (14) — directional strength look-back
• Efficiency Length (20) — ER path-efficiency window
• Slope EMA Length (50) — trend backbone reference
• ATR Length (14) — volatility normalization
• TREND Threshold (55) — composite score level to enter TREND
• Confirmation Bars (1) — bars of persistence before flipping
• Strong Trend Offset (15) — extra score above threshold for STRONG tag
MTF:
• HTF Confirmation (ON) — enable/disable HTF gate
• Auto HTF (ON, Strict) — smart HTF mapping per chart TF
• Manual HTF (240) — override timeframe
Stability:
• Change Cooldown Bars (2) — lock-out window after any regime flip
Lifecycle:
• Emerging Phase Bars (4) — max trend age to stay Emerging
• Confirmed Buffer (8.0) — score must clear threshold+buffer
• Exhaustion Pullback (4.0) — peak-to-current drop to flag Exhausting
Visual Overlay:
• Backbone + Glow + Zone + State Candles + Quality Window + Historical Windows + Projection Box + Guides + Midline (all toggleable)
Panel, Theme, Layout, Help rows, Alerts, Score Velocity Engine, Breakout Quality Badge, Divergence Detector — every layer has its own input group and can be shown/hidden independently.
📘 HOW TO USE
Read-in-one-glance panel (standard AGPro format):
• Blue header row: script title
• Line 2: REGIME / LIFECYCLE · Score N/100 · Velocity state
• Line 3: LTF regime · Direction · Directional Dominance
• Line 4: HTF regime · MTF PASS/BLOCKED · Active Window state · Streak
Quick playbook:
1. CHOP on LTF → wait. No setup, no commitment.
2. CHOP → TREND transition with Grade A badge + HTF PASS → highest-conviction regime start.
3. CONFIRMED phase with DOM HIGH and rising score → the middle of the trend, usually the cleanest section.
4. Velocity COLLAPSE or EXHAUSTING phase with bearish divergence ⚠ → quality is deteriorating; reduce exposure or tighten stops.
5. HTF BLOCKED amber window → LTF trend exists but higher timeframe disagrees; treat as lower-conviction and be aware of mean-reversion risk.
The indicator does NOT issue buy/sell signals, does NOT define entry/exit prices, and is NOT a strategy. It is a regime-quality reading — a context layer you pair with your own trade management.
⚠️ LIMITATIONS & TRANSPARENCY
• Trend-quality indicators are inherently trend-following. In low-volatility ranges the score can stay above threshold on minor moves; in very fast markets the score can lag by 1–3 bars while the filters stabilize.
• HTF confirmation introduces a natural HTF delay. This is intentional (it removes noise) but means the HTF gate may lift several LTF bars after price has already moved.
• All composite signals rely on look-backs (ADX 14, ER 20, Slope EMA 50, ATR 14). On very short intraday timeframes with low bar counts these need calibration.
• Lifecycle phases are structural readings, not predictions. EXHAUSTING means the score is rolling over — not that price must reverse.
• Past performance of any visual regime does not imply future performance. Charts showing clean historical windows are illustrative of the indicator's logic, not trading results.
• No repainting on historical bars. The HTF call uses lookahead_off and barmerge.gaps_off. Score and regime values on closed bars are final.
🛡️ RISK DISCLOSURE
This script is published as an educational and analytical tool. It does not provide financial advice, does not generate trade signals of any kind, and must not be used as a standalone decision system. Markets involve substantial risk of loss. Past behavior of any market regime, indicator output, or historical visual window is no guarantee of future results. Always combine any indicator with independent risk management, position sizing, a tested plan, and — where appropriate — the guidance of a licensed professional. You are solely responsible for any trading decisions you make. Indicator

VolProfex Volatility Time Window AnalyzerVolProfex Volatility Time Window Analyzer (VPX VTWA) analyzes intraday volatility across user-defined time windows within a trading session. It displays a table ranking windows by average and median move size (price % or ATR multiples), using historical data over a lookback period, with optional trend quality filtering out choppy periods using Directional Efficiency Ratio (Kaufman ER).
Session
Session (HHMM-HHMM): Defines trading session in exchange local time (e.g., 0930-1600 for NYSE/NASDAQ).
Session Timezone: Selects timezone handling DST automatically (e.g., America/New_York).
Calculation
Analysis Window (min): Time slot size for table display (options: 5,10,15,30,60,120,240).
Intrabar Resolution (min): Lower TF for accurate intrabar data (options: 1,2,3,5,10,15,30); smaller = better precision, longer load.
Lookback Days: Recent days analyzed (1-5000, default 1000).
Move Method: High-Low Range (absolute) or Open-to-Close (directional).
ATR Normalisation: ON shows moves as ATR multiples for regime-independent comparison.
ATR Period: ATR lookback (1-200, default 14).
Trend Quality Filter
Enable Trend Quality Filter: Excludes choppy windows based on efficiency ratio.
Min Trend Quality (%): Threshold (0-100, default 30); higher = stricter directional moves.
Consolidation
Enable Consolidation: Shows top N individually, groups rest.
Show Top N Individually: Highest-vol windows at full detail (1-100, default 10).
Group Remaining Into (min): Block size for lower-vol averages (options: 5,10,15,30,60,120).
Display
Highlight Top N Rows: Green highlight count (1-10, default 3).
Table Position: Corner placement.
Text Size: Table font (Tiny,Small,Normal,Large).
Indicator

Session Range Boxes by APOVERVIEW
This indicator is designed for traders who require clear, visual boundaries for different trading sessions. It tracks the highest high and lowest low of up to six custom-defined time windows, wrapping them in dynamic boxes that update in real-time.
FEATURES
6 Customizable Sessions: Fully adjustable time ranges and names (Asia, London, NY Open, etc.).
Real-Time Tracking: Session boxes expand dynamically as price creates new highs or lows during the session.
Visual Organization: Individual color and transparency controls for each session to keep your chart clean.
Auto-Delete Logic: Automatically removes older session boxes to prevent chart clutter (user-definable "Keep Last N Sessions").
Timezone Flexibility: Built-in timezone support (IANA/Olson format) to ensure sessions align perfectly with your chart regardless of your local time.
HOW TO USE
Define your Timezone: Set the global "Session Timezone" to your reference market (e.g., America/New_York)
Input Sessions: Enter the 24-hour time ranges for your desired trading windows (e.g., 0930-1100).
Customize your settings & colors
Enjoy :)
SETTINGS
Global : Toggle borders and labels globally, and set the auto-cleanup frequency.
Session-Specific: Individual toggles for time, background fill, border color, and naming.
NOTES
Of course I could add more functionality, but my main goal was to keep the indicator as small and simple as possible, while providing functionality which it was built for.
Since the functionality is limited, I will keep this indicator open-source so everybody can edit and customize it to his own liking.
Indicator

Indicator

Sinc Bollinger BandsKaiser Windowed Sinc Bollinger Bands Indicator
The Kaiser Windowed Sinc Bollinger Bands indicator combines the advanced filtering capabilities of the Kaiser Windowed Sinc Moving Average with the volatility measurement of Bollinger Bands. This indicator represents a sophisticated approach to trend identification and volatility analysis in financial markets.
Core Components
At the heart of this indicator is the Kaiser Windowed Sinc Moving Average, which utilizes the sinc function as an ideal low-pass filter, windowed by the Kaiser function. This combination allows for precise control over the frequency response of the moving average, effectively separating trend from noise in price data.
The sinc function, representing an ideal low-pass filter, provides the foundation for the moving average calculation. By using the sinc function, analysts can independently control two critical parameters: the cutoff frequency and the number of samples used. The cutoff frequency determines which price movements are considered significant (low frequency) and which are treated as noise (high frequency). The number of samples influences the filter's accuracy and steepness, allowing for a more precise approximation of the ideal low-pass filter without altering its fundamental frequency response characteristics.
The Kaiser window is applied to the sinc function to create a practical, finite-length filter while minimizing unwanted oscillations in the frequency domain. The alpha parameter of the Kaiser window allows users to fine-tune the trade-off between the main-lobe width and side-lobe levels in the frequency response.
Bollinger Bands Implementation
Building upon the Kaiser Windowed Sinc Moving Average, this indicator adds Bollinger Bands to provide a measure of price volatility. The bands are calculated by adding and subtracting a multiple of the standard deviation from the moving average.
Advanced Centered Standard Deviation Calculation
A unique feature of this indicator is its specialized standard deviation calculation for the centered mode. This method employs the Kaiser window to create a smooth deviation that serves as an highly effective envelope, even though it's always based on past data.
The centered standard deviation calculation works as follows:
It determines the effective sample size of the Kaiser window.
The window size is then adjusted to reflect the target sample size.
The source data is offset in the calculation to allow for proper centering.
This approach results in a highly accurate and smooth volatility estimation. The centered standard deviation provides a more refined and responsive measure of price volatility compared to traditional methods, particularly useful for historical analysis and backtesting.
Operational Modes
The indicator offers two operational modes:
Non-Centered (Real-time) Mode: Uses half of the windowed sinc function and a traditional standard deviation calculation. This mode is suitable for real-time analysis and current market conditions.
Centered Mode: Utilizes the full windowed sinc function and the specialized Kaiser window-based standard deviation calculation. While this mode introduces a delay, it offers the most accurate trend and volatility identification for historical analysis.
Customizable Parameters
The Kaiser Windowed Sinc Bollinger Bands indicator provides several key parameters for customization:
Cutoff: Controls the filter's cutoff frequency, determining the divide between trends and noise.
Number of Samples: Sets the number of samples used in the FIR filter calculation, affecting the filter's accuracy and computational complexity.
Alpha: Influences the shape of the Kaiser window, allowing for fine-tuning of the filter's frequency response characteristics.
Standard Deviation Length: Determines the period over which volatility is calculated.
Multiplier: Sets the number of standard deviations used for the Bollinger Bands.
Centered Alpha: Specific to the centered mode, this parameter affects the Kaiser window used in the specialized standard deviation calculation.
Visualization Features
To enhance the analytical value of the indicator, several visualization options are included:
Gradient Coloring: Offers a range of color schemes to represent trend direction and strength for the moving average line.
Glow Effect: An optional visual enhancement for improved line visibility.
Background Fill: Highlights the area between the Bollinger Bands, aiding in volatility visualization.
Applications in Technical Analysis
The Kaiser Windowed Sinc Bollinger Bands indicator is particularly useful for:
Precise trend identification with reduced noise influence
Advanced volatility analysis, especially in the centered mode
Identifying potential overbought and oversold conditions
Recognizing periods of price consolidation and potential breakouts
Compared to traditional Bollinger Bands, this indicator offers superior frequency response characteristics in its moving average and a more refined volatility measurement, especially in centered mode. These features allow for a more nuanced analysis of price trends and volatility patterns across various market conditions and timeframes.
Conclusion
The Kaiser Windowed Sinc Bollinger Bands indicator represents a significant advancement in technical analysis tools. By combining the ideal low-pass filter characteristics of the sinc function, the practical benefits of Kaiser windowing, and an innovative approach to volatility measurement, this indicator provides traders and analysts with a sophisticated instrument for examining price trends and market volatility.
Its implementation in Pine Script contributes to the TradingView community by making advanced signal processing and statistical techniques accessible for experimentation and further development in technical analysis. This indicator serves not only as a practical tool for market analysis but also as an educational resource for those interested in the intersection of signal processing, statistics, and financial markets.
Related:
Indicator

Sinc MAKaiser Windowed Sinc Moving Average Indicator
The Kaiser Windowed Sinc Moving Average is an advanced technical indicator that combines the sinc function with the Kaiser window to create a highly customizable finite impulse response (FIR) filter for financial time series analysis.
Sinc Function: The Ideal Low-Pass Filter
At the core of this indicator is the sinc function, which represents the impulse response of an ideal low-pass filter. In signal processing and technical analysis, the sinc function is crucial because it allows for the creation of filters with precise frequency cutoff characteristics. When applied to financial data, this means the ability to separate long-term trends from short-term fluctuations with remarkable accuracy.
The primary advantage of using a sinc-based filter is the independent control over two critical parameters: the cutoff frequency and the number of samples used. The cutoff frequency, analogous to the "length" in traditional moving averages, determines which price movements are considered significant (low frequency) and which are treated as noise (high frequency). By adjusting the cutoff, analysts can fine-tune the filter to respond to specific market cycles or timeframes of interest.
The number of samples used in the filter doesn't affect the cutoff frequency but instead influences the filter's accuracy and steepness. Increasing the sample size results in a better approximation of the ideal low-pass filter, leading to sharper transitions between passed and attenuated frequencies. This allows for more precise trend identification and noise reduction without changing the fundamental frequency response characteristics.
Kaiser Window: Optimizing the Sinc Filter
While the sinc function provides excellent frequency domain characteristics, it has infinite length in the time domain, which is impractical for real-world applications. This is where the Kaiser window comes into play. By applying the Kaiser window to the sinc function, we create a finite-length filter that approximates the ideal response while minimizing unwanted oscillations (known as the Gibbs phenomenon) in the frequency domain.
The Kaiser window introduces an additional parameter, alpha, which controls the trade-off between the main-lobe width and side-lobe levels in the frequency response. This parameter allows users to fine-tune the filter's behavior, balancing between sharp cutoffs and minimal ripple effects.
Customizable Parameters
The Kaiser Windowed Sinc Moving Average offers several key parameters for customization:
Cutoff: Controls the filter's cutoff frequency, determining the divide between trends and noise.
Length: Sets the number of samples used in the FIR filter calculation, affecting the filter's accuracy and computational complexity.
Alpha: Influences the shape of the Kaiser window, allowing for fine-tuning of the filter's frequency response characteristics.
Centered and Non-Centered Modes
The indicator provides two operational modes:
Non-Centered (Real-time) Mode: Uses half of the windowed sinc function, suitable for real-time analysis and current market conditions.
Centered Mode: Utilizes the full windowed sinc function, resulting in a zero-phase filter. This mode introduces a delay but offers the most accurate trend identification for historical analysis.
Visualization Features
To enhance the analytical value of the indicator, several visualization options are included:
Gradient Coloring: Offers a range of color schemes to represent trend direction and strength.
Glow Effect: An optional visual enhancement for improved line visibility.
Background Fill: Highlights the area between the moving average and price, aiding in trend visualization.
Applications in Technical Analysis
The Kaiser Windowed Sinc Moving Average is particularly useful for precise trend identification, cycle analysis, and noise reduction in financial time series. Its ability to create custom low-pass filters with independent control over cutoff and filter accuracy makes it a powerful tool for analyzing various market conditions and timeframes.
Compared to traditional moving averages, this indicator offers superior frequency response characteristics and reduced lag in trend identification when properly tuned. It provides greater flexibility in filter design, allowing analysts to create moving averages tailored to specific trading strategies or market behaviors.
Conclusion
The Kaiser Windowed Sinc Moving Average represents an advanced approach to price smoothing and trend identification in technical analysis. By making the ideal low-pass filter characteristics of the sinc function practically applicable through Kaiser windowing, this indicator provides traders and analysts with a sophisticated tool for examining price trends and cycles.
Its implementation in Pine Script contributes to the TradingView community by making advanced signal processing techniques accessible for experimentation and further development in technical analysis. This indicator serves not only as a practical tool for market analysis but also as an educational resource for those interested in the intersection of signal processing and financial markets.
Related script:
Indicator

Kaiser Window MAKaiser Window Moving Average Indicator
The Kaiser Window Moving Average is a technical indicator that implements the Kaiser window function in the context of a moving average. This indicator serves as an example of applying the Kaiser window and the modified Bessel function of the first kind in technical analysis, providing an open-source implementation of these functions in the TradingView Pine Script ecosystem.
Key Components
Kaiser Window Implementation
This indicator incorporates the Kaiser window, a parameterized window function with certain frequency response characteristics. By making this implementation available in Pine Script, it allows for exploration and experimentation with the Kaiser window in the context of financial time series analysis.
Modified Bessel Function of the First Kind
The indicator includes an implementation of the modified Bessel function of the first kind, which is integral to the Kaiser window calculation. This mathematical function is now accessible within TradingView, potentially useful for other custom indicators or studies.
Customizable Alpha Parameter
The indicator features an adjustable alpha parameter, which directly influences the shape of the Kaiser window. This parameter allows for experimentation with the indicator's behavior:
Lower alpha values: The indicator's behavior approaches that of a Simple Moving Average (SMA)
Moderate alpha values: The behavior becomes more similar to a Weighted Moving Average (WMA)
Higher alpha values: Increases the weight of more recent data points
In signal processing terms, the alpha parameter affects the trade-off between main-lobe width and side lobe level in the frequency domain.
Centered and Non-Centered Modes
The indicator offers two operational modes:
Non-Centered (Real-time) Mode: Uses half of the Kaiser window, starting from the peak. This mode operates similarly to traditional moving averages, suitable for real-time analysis.
Centered Mode: Utilizes the full Kaiser window, resulting in a phase-correct filter. This mode introduces a delay equal to half the window size, with the plot automatically offset to align with the correct time points.
Visualization Options
The indicator includes several visualization features to aid in analysis:
Gradient Coloring: Offers three gradient options:
• Three-color gradient: Includes a neutral color
• Two-color gradient: Traditional up/down color scheme
• Solid color: For a uniform appearance
Glow Effect: An optional visual enhancement for the moving average line.
Background Fill: An option to fill the area between the moving average and the price.
Use Cases
The Kaiser Window Moving Average can be applied similarly to other moving averages. Its primary value lies in providing an example implementation of the Kaiser window and modified Bessel function in TradingView. It serves as a starting point for traders and analysts interested in exploring these mathematical concepts in the context of technical analysis.
Conclusion
The Kaiser Window Moving Average indicator demonstrates the application of the Kaiser window function in a moving average calculation. By providing open-source implementations of the Kaiser window and the modified Bessel function of the first kind, this indicator contributes to the expansion of available mathematical tools in the TradingView Pine Script environment, potentially facilitating further experimentation and development in technical analysis. Indicator

Adaptive MFT Extremum Pivots [Elysian_Mind]Adaptive MFT Extremum Pivots
Overview:
The Adaptive MFT Extremum Pivots indicator, developed by Elysian_Mind, is a powerful Pine Script tool that dynamically displays key market levels, including Monthly Highs/Lows, Weekly Extremums, Pivot Points, and dynamic Resistances/Supports. The term "dynamic" emphasizes the adaptive nature of the calculated levels, ensuring they reflect real-time market conditions. I thank Zandalin for the excellent table design.
---
Chart Explanation:
The table, a visual output of the script, is conveniently positioned in the bottom right corner of the screen, showcasing the indicator's dynamic results. The configuration block, elucidated in the documentation, empowers users to customize the display position. The default placement is at the bottom right, exemplified in the accompanying chart.
The deliberate design ensures that the table does not obscure the candlesticks, with traders commonly situating it outside the candle area. However, the flexibility exists to overlay the table onto the candles. Thanks to transparent cells, the underlying chart remains visible even with the table displayed atop.
In the initial column of the table, users will find labels for the monthly high and low, accompanied by their respective numerical values. The default precision for these values is set at #.###, yet this can be adjusted within the configuration block to suit markets with varying degrees of volatility.
Mirroring this layout, the last column of the table presents the weekly high and low data. This arrangement is part of the upper half of the table. Transitioning to the lower half, users encounter the resistance levels in the first column and the support levels in the last column.
At the center of the table, prominently displayed, is the monthly pivot point. For a comprehensive understanding of the calculations governing these values, users can refer to the documentation. Importantly, users retain the freedom to modify these mathematical calculations, with the table seamlessly updating to reflect any adjustments made.
Noteworthy is the table's persistence; it continues to display reliably even if users choose to customize the mathematical calculations, providing a consistent and adaptable tool for informed decision-making in trading.
This detailed breakdown offers traders a clear guide to interpreting the information presented by the table, ensuring optimal use and understanding of the Adaptive MFT Extremum Pivots indicator.
---
Usage:
Table Layout:
The table is a crucial component of this indicator, providing a structured representation of various market levels. Color-coded cells enhance readability, with blue indicating key levels and a semi-transparent background to maintain chart visibility.
1. Utilizing a Table for Enhanced Visibility:
In presenting this wealth of information, the indicator employs a table format beneath the chart. The use of a table is deliberate and offers several advantages:
2. Structured Organization:
The table organizes the diverse data into a structured format, enhancing clarity and making it easier for traders to locate specific information.
3. Concise Presentation:
A table allows for the concise presentation of multiple data points without cluttering the main chart. Traders can quickly reference key levels without distraction.
4. Dynamic Visibility:
As the market dynamically evolves, the table seamlessly updates in real-time, ensuring that the most relevant information is readily visible without obstructing the candlestick chart.
5. Color Coding for Readability:
Color-coded cells in the table not only add visual appeal but also serve a functional purpose by improving readability. Key levels are easily distinguishable, contributing to efficient analysis.
Data Values:
Numerical values for each level are displayed in their respective cells, with precision defined by the iPrecision configuration parameter.
Configuration:
// User configuration: You can modify this part without code understanding
// Table location configuration
// Position: Table
const string iPosition = position.bottom_right
// Width: Table borders
const int iBorderWidth = 1
// Color configuration
// Color: Borders
const color iBorderColor = color.new(color.white, 75)
// Color: Table background
const color iTableColor = color.new(#2B2A29, 25)
// Color: Title cell background
const color iTitleCellColor = color.new(#171F54, 0)
// Color: Characters
const color iCharColor = color.white
// Color: Data cell background
const color iDataCellColor = color.new(#25456E, 0)
// Precision: Numerical data
const int iPrecision = 3
// End of configuration
The code includes a configuration block where users can customize the following parameters:
Precision of Numerical Table Data (iPrecision):
// Precision: Numerical data
const int iPrecision = 3
This parameter (iPrecision) sets the precision of the numerical values displayed in the table. The default value is 3, displaying numbers in #.### format.
Position of the Table (iPosition):
// Position: Table
const string iPosition = position.bottom_right
This parameter (iPosition) sets the position of the table on the chart. The default is position.bottom_right.
Color preferences
Table borders (iBorderColor):
// Color: Borders
const color iBorderColor = color.new(color.white, 75)
This parameters (iBorderColor) sets the color of the borders everywhere within the window.
Table Background (iTableColor):
// Color: Table background
const color iTableColor = color.new(#2B2A29, 25)
This is the background color of the table. If you've got cells without custom background color, this color will be their background.
Title Cell Background (iTitleCellColor):
// Color: Title cell background
const color iTitleCellColor = color.new(#171F54, 0)
This is the background color the title cells. You can set the background of data cells and text color elsewhere.
Text (iCharColor):
// Color: Characters
const color iCharColor = color.white
This is the color of the text - titles and data - within the table window. If you change any of the background colors, you might want to change this parameter to ensure visibility.
Data Cell Background: (iDataCellColor):
// Color: Data cell background
const color iDataCellColor = color.new(#25456E, 0)
The data cells have a background color to differ from title cells. You can configure this is a different parameter (iDataColor). You might even set the same color for data as for the titles if you will.
---
Mathematical Background:
Monthly and Weekly Extremums:
The indicator calculates the High (H) and Low (L) of the previous month and week, ensuring accurate representation of these key levels.
Standard Monthly Pivot Point:
The standard pivot point is determined based on the previous month's data using the formula:
PivotPoint = (PrevMonthHigh + PrevMonthLow + Close ) / 3
Monthly Pivot Points (R1, R2, R3, S1, S2, S3):
Additional pivot points are calculated for Resistances (R) and Supports (S) using the monthly data:
R1 = 2 * PivotPoint - PrevMonthLow
S1 = 2 * PivotPoint - PrevMonthHigh
R2 = PivotPoint + (PrevMonthHigh - PrevMonthLow)
S2 = PivotPoint - (PrevMonthHigh - PrevMonthLow)
R3 = PrevMonthHigh + 2 * (PivotPoint - PrevMonthLow)
S3 = PrevMonthLow - 2 * (PrevMonthHigh - PivotPoint)
---
Code Explanation and Interpretation:
The table displayed beneath the chart provides the following information:
Monthly Extremums:
(H) High of the previous month
(L) Low of the previous month
// Function to get the high and low of the previous month
getPrevMonthHighLow() =>
var float prevMonthHigh = na
var float prevMonthLow = na
monthChanged = month(time) != month(time )
if (monthChanged)
prevMonthHigh := high
prevMonthLow := low
Weekly Extremums:
(H) High of the previous week
(L) Low of the previous week
// Function to get the high and low of the previous week
getPrevWeekHighLow() =>
var float prevWeekHigh = na
var float prevWeekLow = na
weekChanged = weekofyear(time) != weekofyear(time )
if (weekChanged)
prevWeekHigh := high
prevWeekLow := low
Monthly Pivots:
Pivot: Standard pivot point based on the previous month's data
// Function to calculate the standard pivot point based on the previous month's data
getStandardPivotPoint() =>
= getPrevMonthHighLow()
pivotPoint = (prevMonthHigh + prevMonthLow + close ) / 3
Resistances:
R3, R2, R1: Monthly resistance levels
// Function to calculate additional pivot points based on the monthly data
getMonthlyPivotPoints() =>
= getPrevMonthHighLow()
pivotPoint = (prevMonthHigh + prevMonthLow + close ) / 3
r1 = (2 * pivotPoint) - prevMonthLow
s1 = (2 * pivotPoint) - prevMonthHigh
r2 = pivotPoint + (prevMonthHigh - prevMonthLow)
s2 = pivotPoint - (prevMonthHigh - prevMonthLow)
r3 = prevMonthHigh + 2 * (pivotPoint - prevMonthLow)
s3 = prevMonthLow - 2 * (prevMonthHigh - pivotPoint)
Initializing and Populating the Table:
The myTable variable initializes the table with a blue background, and subsequent table.cell functions populate the table with headers and data.
// Initialize the table with adjusted bgcolor
var myTable = table.new(position = iPosition, columns = 5, rows = 10, bgcolor = color.new(color.blue, 90), border_width = 1, border_color = color.new(color.blue, 70))
Dynamic Data Population:
Data is dynamically populated in the table using the calculated values for Monthly Extremums, Weekly Extremums, Monthly Pivot Points, Resistances, and Supports.
// Add rows dynamically with data
= getPrevMonthHighLow()
= getPrevWeekHighLow()
= getMonthlyPivotPoints()
---
Conclusion:
The Adaptive MFT Extremum Pivots indicator offers traders a detailed and clear representation of critical market levels, empowering them to make informed decisions. However, users should carefully analyze the market and consider their individual risk tolerance before making any trading decisions. The indicator's disclaimer emphasizes that it is not investment advice, and the author and script provider are not responsible for any financial losses incurred.
---
Disclaimer:
This indicator is not investment advice. Trading decisions should be made based on a careful analysis of the market and individual risk tolerance. The author and script provider are not responsible for any financial losses incurred.
Kind regards,
Ely Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Indicator

Strategy

Strategy

Strategy
