Wavelet Trend FilterWhat it is
A denoised price line whose smoothing is derived from measured noise, not a period you pick — plus the tool's signature number, the noise fraction (what share of the recent move is noise vs structure). Most published "wavelet denoising improves prediction" results denoise the whole series including future bars, which is lookahead-contaminated and impossible live. This tool refuses that: it runs a Haar wavelet transform over a trailing power-of-two window and keeps only the endpoint as today's value, fixed at close and never revised. Strictly causal, non-repainting, no forecast.
How it's built
The engine is a five-step Donoho-Johnstone wavelet shrinkage, run every bar over a trailing window (default 128 bars): a Haar DWT (shortest support, fewest boundary coefficients — the right choice for short causal series); noise scale σ = MAD(finest detail coefficients)/0.6745 (robust to outliers); the universal threshold λ = σ·√(2 ln n) with an optional multiplier; soft or hard shrinkage of the detail coefficients; and an inverse transform, keeping the endpoint. Optional symmetric reflection padding reduces edge distortion. Because the threshold self-scales from measured noise, a quiet tape is smoothed less and a noisy tape more — automatically, on any timeframe.
Derived reads: noise fraction = 1 − var(denoised)/var(raw) over the window (share the transform removed), ranked into a percentile; trend slope in noise-σ units; and a signal-to-noise strength = slope (σ) × structure share (1 − noise fraction), the single "is this trend real?" number.
How you read it — and the honest actionable signal
The noise fraction gates everything. A bold chop/structure ribbon along the bottom of the chart shows the whole regime spectrum (green = structure/low noise/trend trustworthy, red = chop/high noise/stand aside), and a ±1σ noise envelope around the denoised line makes the removed noise visible — so it's obviously not just a moving average.
The actionable markers are structure-gated: a green ▲ / red ▼ prints when the denoised slope turns up/down and the tape has structure (low noise); in chop the tool withholds and marks the turn with a small caution dot instead. A hysteresis on the structure state keeps the signals from re-firing as noise oscillates. This is not a blind crossover generator — it goes quiet exactly when the tape is too noisy to trust, which is when ordinary signals whipsaw. The panel's "Read" row states the current call in plain English ("up-trend · structure ✓", "chop — stand aside").
Exports & alerts
EXP_Denoised · EXP_NoiseSigma · EXP_NoiseFrac (0–1) · EXP_Slope (σ) · EXP_SNR (trend strength) · EXP_Stance (+1 up·structure / −1 down·structure / 0). Alerts: noise fraction entering top / bottom quartile (chop / structure) · denoised slope turning up / down · confirmed up-trend / down-trend with structure present. Indicator

Wavelet Energy OscillatorWavelet Energy Oscillator
What it does
The Wavelet Energy Oscillator decomposes price into three cycle bands at once — fast, mid and slow — and shows two things together: a single composite momentum line (in σ units) and a live energy spectrum telling you which band currently drives the market.
Why this is different (and original)
Cycle and dominant-period tools lock onto one period and follow it. The problem is that markets hand control between timescales: a fast, choppy regime gives way to a slower swing, and a single-period reading only turns after that has happened. By running a bank of band-pass filters in parallel and measuring the energy in each band, this oscillator shows the whole spectrum simultaneously — so a fast band losing energy to a slow band is visible as an early footprint of a regime change. Presenting the live energy split next to a dominant-band-coloured composite, with a built-in edge test, is what makes it original.
How it works
Three band-pass filters (recursive, near-orthogonal) are centred on the fast, mid and slow periods you choose.
Each band's energy is its smoothed squared output. The three energies are normalized to percentage shares so the dashboard reads as a live spectrum.
The composite is the summed band output, z-scored over the normalization window into the σ oscillator and coloured by whichever band currently dominates.
How to use it
Read the spectrum first. Fast share dominant → short, choppy moves; slow share dominant → a longer swing is in control; a shift between them flags a changing regime.
Composite zero-crosses (triangles) time the swing in the dominant band; the σ bands (red top, green bottom) flag stretched readings.
The line's colour tells you which timeframe is driving at a glance.
Read the EDGE row. The harness checks whether composite crosses preceded a favourable ≥ k×ATR move within the horizon, versus the unconditional Base %. EDGE = Hit − Base.
Settings guide
01 · Cycle Bands — source, the three centre periods, bandwidth (narrow = sharper/ringier, wide = smoother), energy smoothing, universal price source.
02 · Normalization — z-score window, output smoothing.
03 · Calibration — horizon, favourable-move threshold (×ATR), base-rate window.
04 · Bands — swing and extreme σ bands.
05 · Display & Theme — visual style, regime tint, dashboard, and per-band + band-zone colors.
Non-repaint
All filters are recursive and run on closed bars — no recalculation of history, no future leak.
Concept credit
Band-pass / roofing digital-signal-processing filters for market cycles — John Ehlers, Cycle Analytics for Traders (2013) and Rocket Science for Traders (2001).
Disclaimer
For research and education only. Not financial advice, not a recommendation, and not a guarantee of future results. Market cycles are non-stationary — band energy describes the recent spectrum, it does not predict it. All statistics are in-sample, close-to-close, and exclude costs. Do your own research and manage your own risk. Indicator

Machine Learning: seMLP Q-Wavelet RL Engine [Jamallo]Author Note: I always get asked: "How can I build a Machine Learning or Artificial Intelligence trading system?" I created the study "Machine Learning: seMLP Q-Wavelet RL Engine" to showcase exactly how it can be done in a beginner-friendly manner. We will break down exactly how this AI thinks in plain English, and then show you exactly how the Pine Script code executes it step-by-step.
Introduction: The Institutional Approach to Algorithmic Trading
Most retail and algorithmic traders spend years searching for the "holy grail" by combining static indicators and hard-coded `IF/THEN` rule sets. They are often unaware that institutional quant desks abandoned those basic, curve-fitted patterns decades ago. Standard algorithmic analysis fails because financial markets are inherently chaotic—a hardcoded strategy that works perfectly in a backtest will systematically break down during a live regime shift.
To acquire a true institutional edge, algorithmic strategies cannot rely on rigid, backwards-looking formulas; they require a system that adapts dynamically in real-time. This script brings that quantitative firepower directly to your chart by constructing a live Self-Teaching AI .
Dynamic Filtering : It uses advanced frequency mathematics (Wavelets) to separate random market noise from true institutional momentum footprints with near-zero lag.
Artificial Brain : It feeds that data into a neural network—a living matrix of artificial "neurons" that continuously analyze and execute decisions.
Self-Correction : Most importantly, it executes Reinforcement Learning. If a trade fails, the AI actively calculates the error and mathematically rewires its own brain, ensuring it constantly evolves to survive changing market conditions.
Ultimately, this serves as a foundational study showing you exactly how to break away from basic scripting and get started in true Quantitative Algorithmic Trading.
1. The Core Architecture Loop
Here is the high-level flow of how the AI thinks on every single candle:
The Invisible "Burn-In" Phase
Because the AI starts with a completely randomized, "empty" brain, it will make terrible decisions on the very first few candles. To prevent it from acting prematurely on live data, the script executes an aggressive Burn-In Phase (e.g., the first 300 bars of the chart). During this period, the indicator is completely invisible. It aggressively executes hundreds of "mock trades" in the background, tracking virtual PnL, taking massive risks, and rapidly rewiring its brain without showing a single signal on your screen. Once the 300 bars are up, the burn-in phase ends. The AI stops acting recklessly and officially enters "Live Trading" mode with a fully trained, highly-intelligent brain.
SECTIONS 2 & 3: Setting Up the Brain
Conceptual Overview
Imagine the brain as a massive team of financial analysts.
We have 16 junior analysts looking at chart data.
They report their findings up to 12 senior analysts.
The seniors report to 6 directors.
The 6 directors send their final opinions to 3 executives representing the 3 possible actions: `BUY, SELL, HOLD`. This is called a 16 → 12 → 6 → 3 network structure.
Before we hand the price data to the junior analysts, we Normalize it (Z-Score). This just means "leveling the playing field" so a massive $500 candle wick doesn't break the analysts' math compared to a tiny $1 movement.
The Code Breakdown
// Section 2: Brain Size Constants
int NI = 16 // 16 Inputs (Junior analysts)
int NH1 = 12 // 12 Hidden layer 1 nodes
int NH2 = 6 // 6 Hidden layer 2 nodes
int NO = 3 // 3 Outputs
// Section 3: Normalization Helper
norm(series float x, simple int win) =>
float mu = ta.sma(x, win)
float sg = ta.stdev(x, win)
float sf = nz(sg) < 1e-10 ? 1.0 : sg
float res = (x - nz(mu, x)) / sf // Levels out the price data
na(res) ? 0.0 : res
SECTIONS 4 & 5: Giving the AI "Memory"
Conceptual Overview
By default, PulseWire indicators suffer from permanent amnesia! Every time a new candle paints, PulseWire completely deletes its short-term memory and forgets what happened on the last candle. If we are building an AI for trading that needs to "learn", it must be able to remember its past mathematical mistakes.
To force PulseWire to remember, we use special variables called `var` to create "Persistent Memory Matrices" where the AI for trading stores its brain's wiring throughout the entire chart history.
The Code Breakdown
// Using 'var' locks the memory so it never resets when a new candle paints
var matrix W1 = matrix.new(NI, NH1, 0.0) // The connections between neurons
var matrix W2 = matrix.new(NH1, NH2, 0.0)
...
var int pos = 0 // The AI remembers its current position: Long (1), Short (-1), or Flat (0)
SECTION 6: Seeing the Market (Wavelets)
Conceptual Overview
If you use a Moving Average, it always "lags" behind the real price. By the time the Moving Average crosses to tell you to buy, the massive breakout has already happened.
To fix this, we teach the AI for trading to see using Haar Wavelets . A Wavelet is a piece of advanced math that splits the price candle with minimal lag into two things:
The Detail (D) : The immediate, rapid volatility chop.
The Smooth (V) : The true underlying smooth momentum. By looking at the detail and momentum completely separately, the AI for trading can react to shifts with minimal lag.
The Code Breakdown
// We take standard features like Open, Close, and Volume:
float f0 = open
float f1 = close...
// We break them into Wavelets using simple math combinations:
float v1_0 = (f0 + nz(f0 , f0)) / 2.0 // Smooth momentum
float d1_0 = (f0 - nz(f0 , f0)) / 2.0 // Instant volatility detail
...
// We pack all 16 traits into the 'feat' array to feed the AI for trading's Brain
feat.set(0, norm(d1_0, i_normWin))
feat.set(14, float(pos)) // Tells the brain its current trade position
feat.set(15, norm(portRet, i_normWin)) // Tells the brain its current open trade return
SECTION 7: How the Brain Thinks (seMLP)
Conceptual Overview
An "MLP" is just a standard Neural Network (a massive web of variables that pass data to each other). The problem is that if you give PulseWire an insanely massive web of math equations, it will crash and throw a compiler timeout error.
So, we use a Self-evolving MLP (seMLP) . The AI pushes the Wavelet data through its network dynamically. To prevent "dead zones" where a neuron just stops firing in a flat market, it uses a formula called LeakyReLU . It basically acts as a gatekeeper that tells the neuron: "If this signal is incredibly weak, shrink it down to 1%, but don't explicitly delete it."
The Code Breakdown
// The data enters Hidden Layer 1 (h1)
array h1 = array.new(NH1, 0.0)
for j = 0 to NH1 - 1
float s = B1.get(j)
// The inner brain loops through all 16 incoming inputs
for i = 0 to NI - 1
s += feat.get(i) * W1.get(i, j)
// LeakyReLU Formula: f(x) = x if x > 0 else 0.01 * x
// If the signal 's' is positive, keep it. If 's' is negative, shrink to 1%
h1.set(j, s > 0 ? s : 0.01 * s)
SECTION 8: Taking Action (Exploration vs Exploitation)
Conceptual Overview
How does the AI actually press the BUY or SELL button? It calculates a "Confidence Score" (called a Q-Value) for all three options— Buy, Sell, and Hold. The highest score wins and executes the trade.
However, during its invisible "Burn-In Period", the AI uses a variable called Epsilon . Think of Epsilon as a dice roll. Sometimes, instead of making the smartest, highest-scoring choice, the AI will randomly pick a completely stupid trade just to "experiment" and see if a hidden market pattern exists! This is conceptually how AI for trading discovers new, out-of-the-box strategies. As training goes on, Epsilon gets smaller, and the AI stops experimenting.
The Code Breakdown
// Calculate Epsilon: Start at a high 50% and slowly decay to 5% over time
float epsilon = bar_index <= i_burnIn ? math.max(0.05, i_epsStart_val * ...)
// Roll the dice. If the random number is less than epsilon, we experiment randomly!
bool explore = math.random(0.0, 1.0) < epsilon
// Find the AI for trading's highest confidence choice: Q(0) = Buy, Q(1) = Sell, Q(2) = Hold
if Q.get(1) > bestQ // If Sell confidence is higher than current best (Buy)...
bestQ := Q.get(1)
bestAct := 1
if Q.get(2) > bestQ // If Hold is even higher...
bestQ := Q.get(2)
bestAct := 2
// Execute the final action
int act = explore ? math.min(int(math.floor(math.random(0.0, 2.999))), 2) : qArg
SECTION 9: Training with Rewards (Reinforcement Learning)
Conceptual Overview
This is the heart of Machine Learning. It functions exactly like training a pet. If the AI makes a winning trade that generates cash, we give it a mathematical "treat" (a positive reward). If the AI loses money, we hit it with a brutal negative reward. Over time, the AI autonomously refines its neural weights exclusively to collect the maximum amount of "treats".
The Code Breakdown
// Calculate how much money the candle moved
float cRet = nz((close - close ) / close , 0.0)
// The Reward (R) is a combination of three factors:
// 1. PnL (rPn) - Did we make raw cash profit?
// 2. Trail (rTn) - Did we efficiently track the trend?
// 3. Lee (rLee) - A shaping bonus for correct directional positioning.
float R = i_alphaT * rTn + i_alphaP * rPn + 0.1 * rLee
SECTION 10: Learning from Mistakes (Backpropagation)
Conceptual Overview
If the AI's trade failed, how does it adjust its internal logic? It uses a process called Backpropagation . It looks at the Reward it just received, realizes it was horribly wrong, and calculates the "Error Margin" (How far off my prediction was I?). It then mathematically rewrites all of the internal connections `(W1, W2, W3)` in reverse, editing them to be slightly smarter for the next candle!
Because updating a massive brain on every single micro-tick causes chaotic glitches, we "Accumulate" the errors in a batch over several candles, and then update the brain smoothly with the batch average.
The Code Breakdown
// Compare the Target Reward vs what the Brain actually Predicted (Temporal Difference Error)
float tgt = R + i_gamma * max_qt
float td = tgt - pOut.get(prevAct)
// Accumulate the backwards gradients over multiple bars so we don't glitch
for j = 0 to NO - 1
gB3_acc.set(j, gB3_acc.get(j) + g3.get(j))
accumCount += 1
// Once 'i_accumSteps' bars have passed, we apply the compiled batch update to 'Rewire' the Brain weights!
if accumCount >= i_accumSteps
for i = 0 to NH2 - 1
for j = 0 to NO - 1
float dw = gW3_acc.get(i, j) * sc
W3.set(i, j, W3.get(i, j) + clr * dw - clr * i_l2 * W3.get(i, j))
SECTION 11: Link Pruning (Making the Brain Faster)
Conceptual Overview
Stage 1: The Initial Brain (Complex & Slow)
Stage 2: The Pruning Decision
Stage 3: The Optimized AI for trading (Sleek & Fast)
As the brain learns, some of the mathematical connections become totally useless. Having a giant Tradingview indicator calculate hundreds of useless math connections will trigger a calculation timeout. At a specific point in training length (defaulting to the end of the 300-bar burn-in period), the script literally pauses and deletes (zeroes out) the weakest neural links. PulseWire skips over calculations containing plain zeroes, making your indicator insanely fast and completely lag-proof.
The Code Breakdown
if bar_index == i_pruneBar and not pruned
// Evaluate every single connection weight...
// Find the bottom weakest percentage (i_prunePct)
float thr = absW.get(pidx)
// Explicitly set the weakest weights to Zero!
for i = 0 to NI - 1
for j = 0 to NH1 - 1
if math.abs(W1.get(i, j)) <= thr
W1.set(i, j, 0.0) // Permanent pruning: weak link removed
Important Disclaimer
This indicator is published strictly for educational and research purposes. It is a conceptual showcase proving that advanced Deep Reinforcement Learning architectures generally reserved for Python/TensorFlow can be natively executed within the PulseWire Pine Script environment. Due to Pine Script's structural time-series limitations—specifically the lack of a random-access historical buffer required for true experience replay—this is NOT intended for practical live trading. For production-grade deployment, it is highly recommended to port this mathematical framework to Python.
References
This indicator's mathematical engine was directly modeled and bridged from the following quantitative research papers:
Lee et al. (2021) — " Learning to trade in financial time series using high-frequency through wavelet transformation and deep reinforcement learning " (Used for the MODWT Wavelet integration & State architecture).
Tsantekidis et al. (2021) — " Price Trailing for Financial Trading using Deep Reinforcement Learning " (Used for the dynamic margin-trailing reward system).
Seow et al. (2021) — " seMLP: Self-evolving Multi-layer Perceptron " (Used for the 16 → 12 → 6 → 3 sparse Neural Network structure and the automatic Link Pruning logic).
Indicator

Trend Sniper v2.5 - Haar Wavelet Edition [Jamallo]Author's Note:
The previous Trend Sniper v2.5 was built around a 2-Pole Butterworth Super Smoother with Parkinson historical volatility driving the trailing stops. This edition replaces that entire core with a Maximal Overlap Discrete Wavelet Transform (MODWT) using Haar basis functions and a Vervoort ATR trailing stop . Where the Butterworth produced smooth, continuous curves, the Haar wavelet produces structural steps — only updating when true market movement exceeds the calculated noise energy floor. Same Trend Sniper framework, completely different engine under the hood.
Intro
Trend Sniper v2.5 - Haar Wavelet Edition the Maximal Overlap Discrete Wavelet Transform (MODWT) using Haar basis functions. The result is a structural, step-based signal line that ignores minor price fluctuations entirely and only updates when true market movement exceeds a dynamically calculated noise threshold. Combined with a Vervoort ATR trailing stop, dual SuperTrend envelopes, and KAMA midpoint, this indicator provides a complete trend-following framework built on signal processing principles rather than traditional moving average logic.
Breakdown
Haar Wavelet Signal Line (MODWT + Adaptive Deadband)
The core of this indicator is a 5-level cascaded MODWT Haar wavelet decomposition applied to smoothed Heikin-Ashi price. At each level, price is split into a smooth coefficient (trend) and a detail coefficient (noise). The user selects a decomposition level (1–5), controlling the structural scale — from 2-bar micro-structure up to 32-bar macro-structure.
An adaptive deadband then wraps the smooth coefficient: the average absolute detail energy is measured over a lookback window and scaled by a multiplier. The signal line only steps to a new value when the smooth coefficient moves beyond this noise-energy threshold. This creates the characteristic "staircase" behavior — flat holds during noise, clean steps on real moves. The signal line colors by its own step direction: bull when it steps up, bear when it steps down.
Vervoort ATR Trailing Stop
A Sylvain Vervoort-style trailing stop is anchored directly to the Haar wavelet signal line rather than raw price. The stop distance is calculated as ATR × multiplier. In an uptrend, the stop ratchets upward and never retreats; in a downtrend, it ratchets downward. The stop flips when price closes through it. Because it's anchored to the structural wavelet line instead of noisy price, it produces cleaner, more decisive flip points.
The trailing stop uses independent CMO (Chande Momentum Oscillator) + deadband hysteresis for its coloring — it only changes color when confirmed momentum cleanly breaches the CMO threshold, preventing color flicker during consolidation.
Dual SuperTrend Envelopes
Two SuperTrend calculations using smoothed Heikin-Ashi ATR create the outer structure:
Slow SuperTrend (default mult 9.0) — the wide envelope defining macro trend boundaries
Fast SuperTrend (default mult 6.0) — combined with the signal line to create the Fast Trigger dots
The Fast Trigger is the midpoint of the fast SuperTrend and the Haar signal, plotted as orange circles for quick visual reference of momentum alignment.
KAMA Midpoint & 4-State Fill
A Kaufman Adaptive Moving Average smooths the midpoint between the slow SuperTrend and the Haar signal. The fill between the KAMA midpoint and the signal line uses four distinct color states based on whether price is above/below the slow SuperTrend and whether the signal is above/below the fast trigger — providing an immediate visual read on trend alignment and momentum phase.
End
The wavelet decomposition reveals the true step-by-step nature of price movement by mathematically separating signal from noise — use it alongside your own risk management and confluence analysis. Trade the structure, not the noise. Indicator

Indicator

Wavelet-Trend ML Integration [Alpha Extract]Alpha-Extract Volatility Quality Indicator
The Alpha-Extract Volatility Quality (AVQ) Indicator provides traders with deep insights into market volatility by measuring the directional strength of price movements. This sophisticated momentum-based tool helps identify overbought and oversold conditions, offering actionable buy and sell signals based on volatility trends and standard deviation bands.
🔶 CALCULATION
The indicator processes volatility quality data through a series of analytical steps:
Bar Range Calculation: Measures true range (TR) to capture price volatility.
Directional Weighting: Applies directional bias (positive for bullish candles, negative for bearish) to the true range.
VQI Computation: Uses an exponential moving average (EMA) of weighted volatility to derive the Volatility Quality Index (VQI).
Smoothing: Applies an additional EMA to smooth the VQI for clearer signals.
Normalization: Optionally normalizes VQI to a -100/+100 scale based on historical highs and lows.
Standard Deviation Bands: Calculates three upper and lower bands using standard deviation multipliers for volatility thresholds.
Signal Generation: Produces overbought/oversold signals when VQI reaches extreme levels (±200 in normalized mode).
Formula:
Bar Range = True Range (TR)
Weighted Volatility = Bar Range × (Close > Open ? 1 : Close < Open ? -1 : 0)
VQI Raw = EMA(Weighted Volatility, VQI Length)
VQI Smoothed = EMA(VQI Raw, Smoothing Length)
VQI Normalized = ((VQI Smoothed - Lowest VQI) / (Highest VQI - Lowest VQI) - 0.5) × 200
Upper Band N = VQI Smoothed + (StdDev(VQI Smoothed, VQI Length) × Multiplier N)
Lower Band N = VQI Smoothed - (StdDev(VQI Smoothed, VQI Length) × Multiplier N)
🔶 DETAILS
Visual Features:
VQI Plot: Displays VQI as a line or histogram (lime for positive, red for negative).
Standard Deviation Bands: Plots three upper and lower bands (teal for upper, grayscale for lower) to indicate volatility thresholds.
Reference Levels: Horizontal lines at 0 (neutral), +100, and -100 (in normalized mode) for context.
Zone Highlighting: Overbought (⋎ above bars) and oversold (⋏ below bars) signals for extreme VQI levels (±200 in normalized mode).
Candle Coloring: Optional candle overlay colored by VQI direction (lime for positive, red for negative).
Interpretation:
VQI ≥ 200 (Normalized): Overbought condition, strong sell signal.
VQI 100–200: High volatility, potential selling opportunity.
VQI 0–100: Neutral bullish momentum.
VQI 0 to -100: Neutral bearish momentum.
VQI -100 to -200: High volatility, strong bearish momentum.
VQI ≤ -200 (Normalized): Oversold condition, strong buy signal.
🔶 EXAMPLES
Overbought Signal Detection: When VQI exceeds 200 (normalized), the indicator flags potential market tops with a red ⋎ symbol.
Example: During strong uptrends, VQI reaching 200 has historically preceded corrections, allowing traders to secure profits.
Oversold Signal Detection: When VQI falls below -200 (normalized), a lime ⋏ symbol highlights potential buying opportunities.
Example: In bearish markets, VQI dropping below -200 has marked reversal points for profitable long entries.
Volatility Trend Tracking: The VQI plot and bands help traders visualize shifts in market momentum.
Example: A rising VQI crossing above zero with widening bands indicates strengthening bullish momentum, guiding traders to hold or enter long positions.
Dynamic Support/Resistance: Standard deviation bands act as dynamic volatility thresholds during price movements.
Example: Price reversals often occur near the third standard deviation bands, providing reliable entry/exit points during volatile periods.
🔶 SETTINGS
Customization Options:
VQI Length: Adjust the EMA period for VQI calculation (default: 14, range: 1–50).
Smoothing Length: Set the EMA period for smoothing (default: 5, range: 1–50).
Standard Deviation Multipliers: Customize multipliers for bands (defaults: 1.0, 2.0, 3.0).
Normalization: Toggle normalization to -100/+100 scale and adjust lookback period (default: 200, min: 50).
Display Style: Switch between line or histogram plot for VQI.
Candle Overlay: Enable/disable VQI-colored candles (lime for positive, red for negative).
The Alpha-Extract Volatility Quality Indicator empowers traders with a robust tool to navigate market volatility. By combining directional price range analysis with smoothed volatility metrics, it identifies overbought and oversold conditions, offering clear buy and sell signals. The customizable standard deviation bands and optional normalization provide precise context for market conditions, enabling traders to make informed decisions across various market cycles. Indicator

Wavelet Filter with Adaptive Upsampling [BackQuant]Wavelet Filter with Adaptive Upsampling
The Wavelet Filter with Adaptive Upsampling is an advanced filtering and signal reconstruction tool designed to enhance the analysis of financial time series data. It combines wavelet transforms with adaptive upsampling techniques to filter and reconstruct price data, making it ideal for capturing subtle market movements and enhancing trend detection. This system uses high-pass and low-pass filters to decompose the price series into different frequency components, applying adaptive thresholding to eliminate noise and preserve relevant signal information.
Shout out to Loxx for the Least Squares fitting of trigonometric series and Quinn and Fernandes algorithm for finding frequency
www.pulsewire.com
Key Features
1. Frequency Decomposition with High-Pass and Low-Pass Filters:
The indicator decomposes the input time series using high-pass and low-pass filters to separate the high-frequency (detail) and low-frequency (trend) components of the data. This decomposition allows for a more accurate analysis of underlying trends, while mitigating the impact of noise.
2. Soft Thresholding for Noise Reduction:
A soft thresholding function is applied to the high-frequency component, allowing for the reduction of noise while retaining significant market signals. This function adjusts the coefficients of the high-frequency data, removing small fluctuations and leaving only the essential price movements.
3. Adaptive Upsampling Process:
The upsampling process in this script can be customized using different methods: sinusoidal upsampling, advanced upsampling, and simple upsampling. Each method serves a unique purpose:
Sinusoidal Upsample uses a sine wave to interpolate between data points, providing a smooth transition.
Advanced Upsample utilizes a Quinn-Fernandes algorithm to estimate frequency and apply more sophisticated interpolation techniques, adapting to the market’s cyclical behavior.
Simple Upsample linearly interpolates between data points, providing a basic upsampling technique for less complex analysis.
4. Reconstruction of Filtered Signal:
The indicator reconstructs the filtered signal by summing the high and low-frequency components after upsampling. This allows for a detailed yet smooth representation of the original time series, which can be used for analyzing underlying trends in the market.
5. Visualization of Reconstructed Data:
The reconstructed series is plotted, showing how the upsampling and filtering process enhances the clarity of the price movements. Additionally, the script provides the option to visualize the log returns of the reconstructed series as a histogram, with positive returns shown in green and negative returns in red.
6. Cumulative Series and Trend Detection:
A cumulative series is plotted to visualize the compounded effect of the filtered and reconstructed data. This feature helps traders track the overall performance of the asset over time, identifying whether the asset is following a sustained upward or downward trend.
7. Adaptive Thresholding and Noise Estimation:
The system estimates the noise level in the high-frequency component and applies an adaptive thresholding process based on the standard deviation of the downsampled data. This ensures that only significant price movements are retained, further refining the trend analysis.
8. Customizable Parameters for Flexibility:
Users can customize the following parameters to adjust the behavior of the indicator:
Frequency and Phase Shift: Control the periodicity of the wavelet transformation and the phase of the upsampling function.
Upsample Factor: Adjust the level of interpolation applied during the upsampling process.
Smoothing Period: Determine the length of time used to smooth the signal, helping to filter out short-term fluctuations.
References
Enhancing Cross-Sectional Currency Strategies with Context-Aware Learning to Rank
arxiv.org
Daubechies Wavelet - Wikipedia
en.wikipedia.org
Quinn Fernandes Fourier Transform of Filtered Price by Loxx
Note on Usage for Mean-Reversion Strategy
This indicator is primarily designed for trend-following strategies. However, by taking the inverse of the signals, it can be adapted for mean-reversion strategies. This involves buying underperforming assets and selling outperforming ones. Caution: This method may not work effectively with highly correlated assets, as the price movements between correlated assets tend to mirror each other, limiting the effectiveness of mean-reversion strategies.
Final Thoughts
The Wavelet Filter with Adaptive Upsampling is a powerful tool for traders seeking to improve their understanding of market trends and noise. By using advanced wavelet decomposition and adaptive upsampling, this system offers a clearer, more refined picture of price movements, enhancing trend-following strategies. It’s particularly useful for detecting subtle shifts in market momentum and reconstructing price data in a way that removes noise, providing more accurate insights into market conditions. Indicator

PaddingThe Padding library is a comprehensive and flexible toolkit designed to extend time series data within PulseWire, making it an indispensable resource for advanced signal processing tasks such as FFT, filtering, convolution, and wavelet analysis. At its core, the library addresses the common challenge of edge effects by "padding" your data—that is, by appending additional data points beyond the natural boundaries of your original dataset. This extension not only mitigates the distortions that can occur at the endpoints but also helps to maintain the integrity of various transformations and calculations performed on the series. The library accomplishes this while preserving the ordering of your data, ensuring that the most recent point always resides at index 0.
Central to the functionality of this library are two key enumerations: Direction and PaddingType. The Direction enum determines where the padding will be applied. You can choose to extend the data in the forward direction (ahead of the current values), in the backward direction (behind the current values), or in both directions simultaneously. The PaddingType enum defines the specific method used for extending the data. The library supports several methods—including symmetric, reflect, periodic, antisymmetric, antireflect, smooth, constant, and zero padding—each of which has been implemented to suit different analytical scenarios. For instance, symmetric padding mirrors the original data across its boundaries, while reflect padding continues the trend by reflecting around endpoint values. Periodic padding repeats the data, and antisymmetric padding mirrors the data with alternating signs to counterbalance it. The antireflect and smooth methods take into account the derivatives of your data, thereby extending the series in a way that preserves or smoothly continues these derivative values. Constant and zero padding simply extend the series using fixed endpoint values or zeros. Together, these enums allow you to fine-tune how your data is extended, ensuring that the padding method aligns with the specific requirements of your analysis.
The library is designed to work with both single variable inputs and array inputs. When using array-based methods—particularly with the antireflect and smooth padding types—please note that the implementation intentionally discards the last data point as a result of the delta computation process. This behavior is an important consideration when integrating the library into your PulseWire studies, as it affects the overall data length of the padded series. Despite this, the library’s structure and documentation make it straightforward to incorporate into your existing scripts. You simply provide your data source, define the length of your data window, and select the desired padding type and direction, along with any optional parameters to control the extent of the padding (using both_period, forward_period, or backward_period).
In practical application, the Padding library enables you to extend historical data beyond its original range in a controlled and predictable manner. This is particularly useful when preparing datasets for further signal processing, as it helps to reduce artifacts that can otherwise compromise the results of your analytical routines. Whether you are an experienced Pine Script developer or a trader exploring advanced data analysis techniques, this library offers a robust solution that enhances the reliability and accuracy of your studies by ensuring your algorithms operate on a more complete and well-prepared dataset.
Library "Padding"
A comprehensive library for padding time series data with various methods. Supports both single variable and array inputs, with flexible padding directions and periods. Designed for signal processing applications including FFT, filtering, convolution, and wavelets. All methods maintain data ordering with most recent point at index 0.
symmetric(source, series_length, direction, both_period, forward_period, backward_period)
Applies symmetric padding by mirroring the input data across boundaries
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with symmetric padding applied
method symmetric(source, direction, both_period, forward_period, backward_period)
Applies symmetric padding to an array by mirroring the data across boundaries
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with symmetric padding applied
reflect(source, series_length, direction, both_period, forward_period, backward_period)
Applies reflect padding by continuing trends through reflection around endpoint values
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with reflect padding applied
method reflect(source, direction, both_period, forward_period, backward_period)
Applies reflect padding to an array by continuing trends through reflection around endpoint values
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with reflect padding applied
periodic(source, series_length, direction, both_period, forward_period, backward_period)
Applies periodic padding by repeating the input data
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with periodic padding applied
method periodic(source, direction, both_period, forward_period, backward_period)
Applies periodic padding to an array by repeating the data
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with periodic padding applied
antisymmetric(source, series_length, direction, both_period, forward_period, backward_period)
Applies antisymmetric padding by mirroring data and alternating signs
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with antisymmetric padding applied
method antisymmetric(source, direction, both_period, forward_period, backward_period)
Applies antisymmetric padding to an array by mirroring data and alternating signs
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with antisymmetric padding applied
antireflect(source, series_length, direction, both_period, forward_period, backward_period)
Applies antireflect padding by reflecting around endpoints while preserving derivatives
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with antireflect padding applied
method antireflect(source, direction, both_period, forward_period, backward_period)
Applies antireflect padding to an array by reflecting around endpoints while preserving derivatives
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with antireflect padding applied. Note: Last data point is lost when using array input
smooth(source, series_length, direction, both_period, forward_period, backward_period)
Applies smooth padding by extending with constant derivatives from endpoints
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with smooth padding applied
method smooth(source, direction, both_period, forward_period, backward_period)
Applies smooth padding to an array by extending with constant derivatives from endpoints
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with smooth padding applied. Note: Last data point is lost when using array input
constant(source, series_length, direction, both_period, forward_period, backward_period)
Applies constant padding by extending endpoint values
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with constant padding applied
method constant(source, direction, both_period, forward_period, backward_period)
Applies constant padding to an array by extending endpoint values
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with constant padding applied
zero(source, series_length, direction, both_period, forward_period, backward_period)
Applies zero padding by extending with zeros
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with zero padding applied
method zero(source, direction, both_period, forward_period, backward_period)
Applies zero padding to an array by extending with zeros
Namespace types: array
Parameters:
source (array) : Array of values to pad
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with zero padding applied
pad_data(source, series_length, padding_type, direction, both_period, forward_period, backward_period)
Generic padding function that applies specified padding type to input data
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
padding_type (series PaddingType) : Type of padding to apply (see PaddingType enum)
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with specified padding applied
method pad_data(source, padding_type, direction, both_period, forward_period, backward_period)
Generic padding function that applies specified padding type to array input
Namespace types: array
Parameters:
source (array) : Array of values to pad
padding_type (series PaddingType) : Type of padding to apply (see PaddingType enum)
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to array length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to array length if not specified
Returns: Array ordered with most recent point at index 0, containing original data with specified padding applied. Note: Last data point is lost when using antireflect or smooth padding types
make_padded_data(source, series_length, padding_type, direction, both_period, forward_period, backward_period)
Creates a window-based padded data series that updates with each new value. WARNING: Function must be called on every bar for consistency. Do not use in scopes where it may not execute on every bar.
Parameters:
source (float) : Input value to pad from
series_length (int) : Length of the data window
padding_type (series PaddingType) : Type of padding to apply (see PaddingType enum)
direction (series Direction) : Direction to apply padding
both_period (int) : Optional - periods to pad in both directions. Overrides forward_period and backward_period if specified
forward_period (int) : Optional - periods to pad forward. Defaults to series_length if not specified
backward_period (int) : Optional - periods to pad backward. Defaults to series_length if not specified
Returns: Array ordered with most recent point at index 0, containing windowed data with specified padding applied Library

Fine-tune Inputs: Fourier Smoothed Volume zone oscillator WFSVZ0Use this Strategy to Fine-tune inputs for the (W&)FSVZ0 Indicator.
Strategy allows you to fine-tune the indicator for 1 TimeFrame at a time; cross Timeframe Input fine-tuning is done manually after exporting the chart data.
I suggest using "Close all" input False when fine-tuning Inputs for 1 TimeFrame. When you export data to Excel/Numbers/GSheets I suggest using "Close all" input as True, except for the lowest TimeFrame.
MEANINGFUL DESCRIPTION:
The Volume Zone oscillator breaks up volume activity into positive and negative categories. It is positive when the current closing price is greater than the prior closing price and negative when it's lower than the prior closing price. The resulting curve plots through relative percentage levels that yield a series of buy and sell signals, depending on level and indicator direction.
The Wavelet & Fourier Smoothed Volume Zone Oscillator (W&)FSVZO is a refined version of the Volume Zone Oscillator, enhanced by the implementation of the Discrete Fourier Transform . Its primary function is to streamline price data and diminish market noise, thus offering a clearer and more precise reflection of price trends.
By combining the Wavalet and Fourier aproximation with Ehler's white noise histogram, users gain a comprehensive perspective on volume-related market conditions.
HOW TO USE THE INDICATOR:
The default period is 2 but can be adjusted after backtesting. (I suggest 5 VZO length and NoiceR max length 8 as-well)
The VZO points to a positive trend when it is rising above the 0% level, and a negative trend when it is falling below the 0% level. 0% level can be adjusted in setting by adjusting VzoDifference. Oscillations rising below 0% level or falling above 0% level result in a natural trend.
HOW TO USE THE STRATEGY:
Here you fine-tune the inputs until you find a combination that works well on all Timeframes you will use when creating your Automated Trade Algorithmic Strategy. I suggest 4h, 12h, 1D, 2D, 3D, 4D, 5D, 6D, W and M.
When I ndicator/Strategy returns 0 or natural trend , Strategy Closes All it's positions.
ORIGINALITY & USFULLNESS:
Personal combination of Fourier and Wavalet aproximation of a price which results in less noise Volume Zone Oscillator.
The Wavelet Transform is a powerful mathematical tool for signal analysis, particularly effective in analyzing signals with varying frequency or non-stationary characteristics. It dissects a signal into wavelets, small waves with varying frequency and limited duration, providing a multi-resolution analysis. This approach captures both frequency and location information, making it especially useful for detecting changes or anomalies in complex signals.
The Discrete Fourier Transform (DFT) is a mathematical technique that transforms discrete data from the time domain into its corresponding representation in the frequency domain. This process involves breaking down a signal into its individual frequency components, thereby exposing the amplitude and phase characteristics inherent in each frequency element.
This indicator utilizes the concept of Ehler's Universal Oscillator and displays a histogram, offering critical insights into the prevailing levels of market noise. The Ehler's Universal Oscillator is grounded in a statistical model that captures the erratic and unpredictable nature of market movements. Through the application of this principle, the histogram aids traders in pinpointing times when market volatility is either rising or subsiding.
DETAILED DESCRIPTION:
My detailed description of the indicator and use cases which I find very valuable.
What is oscillator?
Oscillators are chart indicators that can assist a trader in determining overbought or oversold conditions in ranging (non-trending) markets.
What is volume zone oscillator?
Price Zone Oscillator measures if the most recent closing price is above or below the preceding closing price.
Volume Zone Oscillator is Volume multiplied by the 1 or -1 depending on the difference of the preceding 2 close prices and smoothed with Exponential moving Average.
What does this mean?
If the VZO is above 0 and VZO is rising. We have a bullish trend. Most likely.
If the VZO is below 0 and VZO is falling. We have a bearish trend. Most likely.
Rising means that VZO on close is higher than the previous day.
Falling means that VZO on close is lower than the previous day.
What if VZO is falling above 0 line?
It means we have a high probability of a bearish trend.
Thus the indicator returns 0 and Strategy closes all it's positions when falling above 0 (or rising bellow 0) and we combine higher and lower timeframes to gauge the trend.
In the next Image you can see that trend is negative on 4h, negative on 12h and positive on 1D. That means trend is negative.
I am sorry, the chart is a bit messy. The idea is to use the indicator over more than 1 Timeframe.
What is approximation and smoothing?
They are mathematical concepts for making a discrete set of numbers a
continuous curved line.
Fourier and Wavelet approximation of a close price are taken from aprox library.
Key Features:
You can tailor the Indicator/Strategy to your preferences with adjustable parameters such as VZO length, noise reduction settings, and smoothing length.
Volume Zone Oscillator (VZO) shows market sentiment with the VZO, enhanced with Exponential Moving Average (EMA) smoothing for clearer trend identification.
Noise Reduction leverages Euler's White noise capabilities for effective noise reduction in the VZO, providing a cleaner and more accurate representation of market dynamics.
Choose between the traditional Fast Fourier Transform (FFT) , the innovative Double Discrete Fourier Transform (DTF32) and Wavelet soothed Fourier soothed price series to suit your analytical needs.
Image of Wavelet transform with FAST settings, Double Fourier transform with FAST settings. Improved noice reduction with SLOW settings, and standard FSVZO with SLOW settings:
Fast setting are setting by default:
VZO length = 2
NoiceR max Length = 2
Slow settings are:
VZO length = 5 or 7
NoiceR max Length = 8
As you can see fast setting are more volatile. I suggest averaging fast setting on 4h 12h 1d 2d 3d 4d W and M Timeframe to get a clear view on market trend.
What if I want long only when VZO is rising and above 15 not 0?
You have set Setting VzoDifference to 15. That reduces the number of trend changes.
Example of W&FSVZO with VzoDifference 15 than 0:
VZO crossed 0 line but not 15 line and that's why Indicator returns 0 in one case an 1 in another.
What is Smooth length setting?
A way of calculating Bullish or Bearish (W&)FSVZO .
If smooth length is 2 the trend is rising if:
rising = VZO > ta.ema(VZO, 2)
Meaning that we check if VZO is higher that exponential average of the last 2 elements.
If smooth length is 1 the trend is rising if:
rising = VZO_ > VZO_
Use this Strategy to fine-tune inputs for the (W&)FSVZO Indicator.
(Strategy allows you to fine-tune the indicator for 1 TimeFrame at a time; cross Timeframe Input fine-tuning is done manually after exporting the chart data)
I suggest using " Close all " input False when fine-tuning Inputs for 1 TimeFrame . When you export data to Excel/Numbers/GSheets I suggest using " Close all " input as True , except for the lowest TimeFrame . I suggest using 100% equity as your default quantity for fine-tune purposes. I have to mention that 100% equity may lead to unrealistic backtesting results. Be avare. When backtesting for trading purposes use Contracts or USDT. Strategy

Wavelet & Fourier Smoothed Volume zone oscillator (W&)FSVZO Indicator id:
USER;e7a774913c1242c3b1354334a8ea0f3c
(only relevant to those that use API requests)
MEANINGFUL DESCRIPTION:
The Volume Zone oscillator breaks up volume activity into positive and negative categories. It is positive when the current closing price is greater than the prior closing price and negative when it's lower than the prior closing price. The resulting curve plots through relative percentage levels that yield a series of buy and sell signals, depending on level and indicator direction.
The Wavelet & Fourier Smoothed Volume Zone Oscillator (W&)FSVZO is a refined version of the Volume Zone Oscillator, enhanced by the implementation of the Discrete Fourier Transform. Its primary function is to streamline price data and diminish market noise, thus offering a clearer and more precise reflection of price trends.
By combining the Wavalet and Fourier aproximation with Ehler's white noise histogram, users gain a comprehensive perspective on volume-related market conditions.
HOW TO USE THE INDICATOR:
The default period is 2 but can be adjusted after backtesting. (I suggest 5 VZO length and NoiceR max length 8 as-well)
The VZO points to a positive trend when it is rising above the 0% level, and a negative trend when it is falling below the 0% level. 0% level can be adjusted in setting by adjusting VzoDifference. Oscillations rising below 0% level or falling above 0% level result in natural trend.
ORIGINALITY & USFULLNESS:
Personal combination of Fourier and Wavalet aproximation of a price which results in less noise Volume Zone Oscillator.
The Wavelet Transform is a powerful mathematical tool for signal analysis, particularly effective in analyzing signals with varying frequency or non-stationary characteristics. It dissects a signal into wavelets, small waves with varying frequency and limited duration, providing a multi-resolution analysis. This approach captures both frequency and location information, making it especially useful for detecting changes or anomalies in complex signals.
The Discrete Fourier Transform (DFT) is a mathematical technique that transforms discrete data from the time domain into its corresponding representation in the frequency domain. This process involves breaking down a signal into its individual frequency components, thereby exposing the amplitude and phase characteristics inherent in each frequency element.
This indicator utilizes the concept of Ehler's Universal Oscillator and displays a histogram, offering critical insights into the prevailing levels of market noise. The Ehler's Universal Oscillator is grounded in a statistical model that captures the erratic and unpredictable nature of market movements. Through the application of this principle, the histogram aids traders in pinpointing times when market volatility is either rising or subsiding.
DETAILED DESCRIPTION:
My detailed description of the indicator and use cases which I find very valuable.
What is oscillator?
Oscillators are chart indicators that can assist a trader in determining overbought or oversold conditions in ranging (non-trending) markets.
What is volume zone oscillator?
Price Zone Oscillator measures if the most recent closing price is above or below the preceding closing price.
Volume Zone Oscillator is Volume multiplied by the 1 or -1 depending on the difference of the preceding 2 close prices and smoothed with Exponential moving Average.
What does this mean?
If the VZO is above 0 and VZO is rising. We have a bullish trend. Most likely.
If the VZO is below 0 and VZO is falling. We have a bearish trend. Most likely.
Rising means that VZO on close is higher than the previous day.
Falling means that VZO on close is lower than the previous day.
What if VZO is falling above 0 line?
It means we have a high probability of a bearish trend.
Thus the indicator returns 0 when falling above 0 (or rising bellow 0) and we combine higher and lower timeframes to gauge the trend.
In the next Image you can see that trend is positive on 4h, neutral on 12h and positive on 1D. That means trend is positive.
I am sorry, the chart is a bit messy. The idea is to use the indicator over more than 1 Timeframe.
What is approximation and smoothing?
They are mathematical concepts for making a discrete set of numbers a
continuous curved line.
Fourier and Wavelet approximation of a close price are taken from aprox library.
Key Features:
You can tailor the indicator to your preferences with adjustable parameters such as VZO length, noise reduction settings, and smoothing length.
Volume Zone Oscillator (VZO) shows market sentiment with the VZO, enhanced with Exponential Moving Average (EMA) smoothing for clearer trend identification.
Noise Reduction leverages Euler's White noise capabilities for effective noise reduction in the VZO, providing a cleaner and more accurate representation of market dynamics.
Choose between the traditional Fast Fourier Transform (FFT), the innovative Double Discrete Fourier Transform (DTF32) and Wavelet soothed Fourier soothed price series to suit your analytical needs.
Image of Wavelet transform with FAST settings, Double Fourier transform with FAST settings. Improved noice reduction with SLOW settings, and standard FSVZO with SLOW settings:
Fast setting are setting by default:
VZO length = 2
NoiceR max Length = 2
Slow settings are:
VZO length = 5 or 7
NoiceR max Length = 8
As you can see fast setting are more volatile. I suggest averaging fast setting on 4h 12h 1d 2d 3d 4d W and M Timeframe to get a clear view on market trend.
What if I want long only when VZO is rising and above 15 not 0?
You have set Setting VzoDifference to 15. That reduces the number of trend changes.
Example of W&FSVZO with VzoDifference 15 than 0:
VZO crossed 0 line but not 15 line and that's why Indicator returns 0 in one case an 1 in another.
What is Smooth length setting?
A way of calculating Bullish or Bearish FSVZO.
If smooth length is 2 the trend is rising if:
rising = VZO > ta.ema(VZO, 2)
Meaning that we check if VZO is higher that exponential average of the last 2 elements.
If smooth length is 1 the trend is rising if:
rising = VZO_ > VZO_
Rising is boolean value, meaning TRUE if rising and FALSE if falling.
Mathematical equations presented in Pinescript:
Fourier of the real (x axis) discrete:
x_0 = array.get(x, 0) + array.get(x, 1) + array.get(x, 2)
x_1 = array.get(x, 0) + array.get(x, 1) * math.cos( -2 * math.pi * _dir / 3 ) - array.get(y, 1) * math.sin( -2 * math.pi * _dir / 3 ) + array.get(x, 2) * math.cos( -4 * math.pi * _dir / 3 ) - array.get(y, 2) * math.sin( -4 * math.pi * _dir / 3 )
x_2 = array.get(x, 0) + array.get(x, 1) * math.cos( -4 * math.pi * _dir / 3 ) - array.get(y, 1) * math.sin( -4 * math.pi * _dir / 3 ) + array.get(x, 2) * math.cos( -8 * math.pi * _dir / 3 ) - array.get(y, 2) * math.sin( -8 * math.pi * _dir / 3 )
Euler's Noice reduction with both close and Discrete Furrier approximated price.
w = (dft1*src - dft1 *src ) / math.sqrt(math.pow(math.abs(src- src ),2) + math.pow(math.abs(dft1 - dft1 ),2))
filt := na(filt ) ? 0 : c1 * (w*dft1 + nz(w *dft1 )) / 2.0 /math.abs(dft1 -dft1 ) + c2 * nz(filt ) - c3 * nz(filt )
Usecase:
First option:
Select the preferred version of DFT and noise reduction settings based on your analysis requirements.
Leverage the script to identify Bullish and Bearish trends, shown with green and red triangle.
Combine Different Timeframes to accurately determine market trend.
Second option:
Pull the data with API sockets to automate your trading journey.
plot(close, title="ClosePrice", display=display.status_line)
plot(open, title="OpenPrice", display=display.status_line)
plot(greencon ? 1 : redcon ? -1 : 0, title="position", display=display.status_line)
Use ClosePrice, OpenPrice and "position" titles to easily read and backtest your strategy utilising more than 1 Time Frame.
Indicator id:
USER;e7a774913c1242c3b1354334a8ea0f3c
(only relevant to those that use API requests)
Indicator
