Indicator

Planetary Aspect Lines [PyraTime]The Problem This Solves
Traders utilizing W.D. Gann methodologies and financial astrology often face three major hurdles: manually calculating geocentric planetary aspects across varying timezones, dealing with cluttered charts that obscure price action, and the persistent "Floating Indicator Issue" where graphical lines and labels detach from historical price bars or freeze in mid-air when panning and zooming.
The Solution
PyraTime is a self-contained visual ephemeris built specifically to automate planetary aspect tracking while maintaining strict chart stability. It calculates geocentric mean longitudes for up to three customizable planet pairs, alerts you to exact angular aspects, and anchors all visual data directly to absolute UNIX timestamps. This ensures your astrological analysis remains perfectly aligned with the historical price action, regardless of chart scale.
Key Features:
Predictive HUD Dashboard: A clean, minimal chart overlay that scans forward to project the next upcoming aspect. It provides a live countdown (in days) alongside the calculated directional bias.
Directional Bias System: Instantly gauge the astrological weight of an aspect directly on the chart labels and HUD. The script categorizes Trines and Sextiles as Bullish; Squares, Oppositions, Semi-Squares, and Sesquiquadrates as Bearish; and Conjunctions and Quincunxes as Neutral.
Floating Indicator Protection: We explicitly solved the native PulseWire floating object bug. By anchoring all line objects to absolute UNIX timestamps (xloc.bar_time) rather than relative bar indices, and using dynamic vertical positioning for labels, your aspect lines will never detach or float away when scrolling through data.
Layered Aesthetics: Aspects are plotted using a 3-layer overlapping line technique for a clean neon aesthetic without muddying the candles. When an aspect reaches exact status (within 0.1 degrees of the target orb), the visual labels dynamically scale to full opacity to highlight the exact pivot point.
Retrograde Filtering: An optional toggle allows users to automatically suppress aspect alerts and visuals if either planet in a monitored pair is currently moving in retrograde.
Timezone Agnostic: The internal ephemeris engine relies on absolute time data, meaning it synchronizes automatically with your local PulseWire clock. No manual UTC offset configurations are required.
How to Use:
Apply the indicator to your chart and open the settings menu.
Select your target planet pairs (e.g., Sun and Mars) and enable any additional pairs you wish to track.
Toggle the specific aspects you want to monitor and adjust your target orbs (degrees of tolerance) based on your trading strategy.
Set standard PulseWire alerts to trigger when a confirmed aspect prints on the chart.
Technical Note: This script uses an internal Mean Longitude mathematical engine to calculate planetary positions. This provides fast, self-contained visual performance without relying on external libraries. Traders looking for extreme precision on highly elliptical planets or specific retrograde stations should note there may be slight orb drift compared to a full Swiss Ephemeris array. Indicator

Strategy

Harmonic Pulse Tracker [JOAT]Harmonic Pulse Tracker
Introduction
The Harmonic Pulse Tracker is an open-source institutional-grade wave and rhythm analysis system that combines Elliott Wave principles, Fibonacci harmonic analysis, WaveTrend oscillator mechanics, and cycle detection into a unified oscillator. This sophisticated system integrates multiple proven methodologies to identify high-probability reversal zones where harmonic patterns, wave cycles, and momentum indicators converge.
The indicator is designed for traders who understand that market movements follow natural harmonic patterns and cyclical rhythms. By synthesizing detrended price oscillation, Fibonacci retracement levels, WaveTrend momentum analysis, money flow dynamics, and volume confirmation, this tool helps identify structural market turning points with mathematical precision.
Why This Integration Exists
This indicator combines six distinct analytical frameworks that complement each other:
Harmonic Wave Analysis: Uses detrended price oscillation combined with Ehlers cycle detection to identify natural market rhythms
Fibonacci Harmonic Levels: Calculates dynamic Fibonacci retracements and extensions based on wave swing points
WaveTrend Oscillator: Implements LazyBear's WaveTrend algorithm for momentum and overbought/oversold detection
Money Flow Integration: Tracks institutional buying and selling pressure through Money Flow Index analysis
Volume Analysis: Confirms wave movements with volume spikes and directional volume pressure
Elliott Wave Counting: Simplified wave counting system to identify impulse and corrective wave phases
Each component addresses different aspects of market rhythm and harmony. The harmonic wave engine identifies natural price cycles, Fibonacci levels provide mathematical support/resistance, WaveTrend shows momentum extremes, money flow reveals institutional activity, volume confirms genuine moves, and Elliott Wave counting provides structural context. Together, they create a multi-dimensional view of market harmony and discord.
Core Components Explained
1. Harmonic Wave Engine
The core wave calculation combines two advanced techniques:
DPO (Detrended Price Oscillator) = close - sma(close, length/2 + 1)
Ehlers Cycle Component = High-pass filtered price with cycle smoothing
Harmonic Wave = Smoothed DPO + (Cycle Component * 0.5)
This creates a wave that removes trend bias while preserving cyclical components, revealing the natural harmonic rhythm of price movement.
Wave Derivatives:
- Wave Momentum: Rate of change in harmonic wave
- Wave Acceleration: Rate of change in momentum
- Wave Velocity: Percentage rate of change over 5 periods
These derivatives help identify wave phase transitions and momentum shifts before they become obvious in price.
2. Fibonacci Harmonic Level System
The indicator calculates dynamic Fibonacci levels based on harmonic wave swing points:
Standard Retracements:
- 23.6%, 38.2%, 50.0%, 61.8%, 78.6% of wave range
Extensions:
- 127.2%, 161.8%, 261.8% beyond wave high
Golden Pocket Zone:
The critical 61.8% to 78.6% retracement zone where most harmonic reversals occur. This zone represents the mathematical sweet spot where Fibonacci ratios converge with natural market rhythm.
Harmonic Resonance Detection:
The system identifies when price is within 5% of key Fibonacci levels and calculates confluence scores when multiple levels align.
3. WaveTrend Oscillator Integration
Implements the proven WaveTrend algorithm:
ESA = ema(hlc3, channel_length)
D = ema(abs(hlc3 - ESA), channel_length)
CI = (hlc3 - ESA) / (0.015 * D)
WT1 = ema(CI, average_length)
WT2 = sma(WT1, 4)
WaveTrend Signals:
- Crossovers in oversold zone (< -50): Bullish reversal signals
- Crossunders in overbought zone (> 50): Bearish reversal signals
- Regular crossovers: Momentum shift confirmation
4. Money Flow Analysis
Tracks institutional buying and selling pressure:
MFI = Money Flow Index over specified period
MFI Centered = (MFI - 50) * multiplier
- Positive MFI: Institutional buying pressure
- Negative MFI: Institutional selling pressure
- Strong MFI: Absolute value > 25 indicates significant institutional activity
5. Volume Analysis Engine
Comprehensive volume analysis including:
Volume Spikes: Volume > Average Volume * Threshold
Volume Ratio: Current volume / Average volume
Volume Strength: Normalized volume intensity (0-100)
Directional Volume:
- Bullish Volume Spike: High volume + green candle
- Bearish Volume Spike: High volume + red candle
6. Elliott Wave Phase Detection
Simplified wave analysis to identify market structure:
Impulse Waves:
- Impulse Up: Positive momentum + acceleration + velocity
- Impulse Down: Negative momentum + acceleration + velocity
Corrective Waves:
- Mixed momentum and acceleration signals indicating consolidation
Wave Counting:
Basic 5-wave count system that resets after wave 5 completion, helping identify potential reversal zones.
Multi-Factor Confluence Scoring System
The indicator calculates a real-time confluence score (0-100) by weighting each component:
Confluence Score Components:
- Fibonacci Zone: Up to 20 points (Golden Pocket = 20, other Fib levels = 4 each)
- Wave Strength: Up to 20 points (based on wave momentum intensity)
- WaveTrend: Up to 20 points (extreme zone crossovers = 20, regular = 15)
- Money Flow: Up to 20 points (strong institutional activity = 20)
- Volume: Up to 20 points (volume spikes = 20, elevated = 15)
Scores above 80 indicate exceptional confluence for potential trades. The dashboard displays individual component scores for transparency.
Perfect Harmonic Alignment Detection
The system identifies rare "Perfect Harmonic" setups when:
- Price is in Golden Pocket zone
- Impulse wave phase is active
- Wave strength > 70
- WaveTrend crossover in extreme zone
- Positive money flow (for bullish) or negative (for bearish)
- Volume spike confirmation
These setups represent the highest probability reversal opportunities.
Visual Elements
Harmonic Wave: Main oscillator with gradient coloring based on wave position
Wave Momentum: Histogram showing rate of change in wave movement
Fibonacci Levels: Key retracement and extension levels (38.2%, 50%, 61.8%, 78.6%, 161.8%)
Golden Pocket Zone: Highlighted area between 61.8% and 78.6% levels
WaveTrend Lines: WT1 and WT2 with overbought/oversold zones
Money Flow Columns: Institutional buying/selling pressure visualization
Volume Strength: Volume intensity histogram
Signal Markers: Perfect Harmonic signals and strong confluence alerts
Background Zones: Golden Pocket and Perfect Signal highlighting
Dashboard: Real-time display of all component values and confluence score
How Components Work Together
The integration creates a harmonic analysis approach:
Layer 1 - Wave Rhythm: Harmonic wave identifies natural market cycles and turning points
Layer 2 - Mathematical Levels: Fibonacci ratios provide precise support/resistance zones
Layer 3 - Momentum Context: WaveTrend shows overbought/oversold extremes
Layer 4 - Institutional Flow: Money flow reveals smart money positioning
Layer 5 - Volume Confirmation: Volume analysis validates genuine moves vs noise
Layer 6 - Wave Structure: Elliott Wave context provides structural framework
Example scenario: Harmonic wave reaches Golden Pocket zone (Layer 1 + 2) during WaveTrend oversold crossover (Layer 3) with positive money flow (Layer 4) and volume spike (Layer 5) in corrective wave phase (Layer 6). This confluence suggests exceptional reversal probability.
Input Parameters
Wave Settings:
Wave Length: Period for harmonic wave calculation (default: 34)
Smoothing Period: Wave smoothing factor (default: 5)
WaveTrend Settings:
Show WaveTrend: Toggle WaveTrend display
WT Channel Length: Channel calculation period (default: 9)
WT Average Length: Smoothing period (default: 12)
WT Overbought: Overbought threshold (default: 50)
WT Oversold: Oversold threshold (default: -50)
Money Flow Settings:
Show Money Flow: Toggle money flow display
MFI Length: Money Flow Index period (default: 14)
MFI Multiplier: Sensitivity adjustment (default: 1.5)
Volume Settings:
Show Volume Analysis: Toggle volume indicators
Volume Spike Threshold: Multiplier for spike detection (default: 1.5)
Fibonacci Settings:
Show Fibonacci Levels: Toggle Fibonacci level display
Fibonacci Lookback: Period for swing point calculation (default: 100)
Cycle Settings:
Cycle Period: Ehlers cycle detection period (default: 20)
Cycle Smoothing: Cycle component smoothing (default: 3)
How to Use This Indicator
Step 1: Identify Wave Phase
Check the dashboard for current wave phase (Impulse Up/Down, Corrective, Neutral) and Elliott Wave count.
Step 2: Locate Fibonacci Zones
Look for price approaching key Fibonacci levels, especially the Golden Pocket zone (61.8%-78.6%).
Step 3: Check WaveTrend Position
Identify if WaveTrend is in extreme zones and watch for crossovers in oversold/overbought areas.
Step 4: Analyze Money Flow
Confirm institutional positioning through Money Flow Index - positive for bullish setups, negative for bearish.
Step 5: Verify Volume Confirmation
Ensure volume supports the move - look for volume spikes in the direction of the expected reversal.
Step 6: Review Confluence Score
Check the dashboard confluence score. Scores above 80 indicate high-probability setups.
Step 7: Wait for Perfect Harmonic Signals
The highest probability trades occur when "PERFECT" signals appear, indicating all factors are aligned.
Best Practices
Use on 15-minute to 4-hour timeframes for optimal harmonic detection
Focus on Golden Pocket zone entries - this is where most harmonic reversals occur
Wait for WaveTrend crossovers in extreme zones for best risk:reward
Confirm with money flow direction - institutional flow should support the trade direction
Volume spikes add significant confirmation to harmonic setups
Perfect Harmonic signals are rare but offer exceptional probability
Wave 5 completions often coincide with major reversal opportunities
Use confluence scores above 80 as primary filter for trade selection
Indicator Limitations
Harmonic patterns can extend beyond expected Fibonacci levels
Perfect Harmonic signals are rare - patience is required for best setups
Wave counting is simplified and may not match complex Elliott Wave analysis
Fibonacci levels are dynamic and may adjust as new swing points form
Money flow can remain extreme longer than expected during strong trends
Volume confirmation may be less reliable in low-liquidity markets
Confluence scoring is mathematical, not predictive of future performance
Requires understanding of harmonic analysis principles for effective use
Technical Implementation
Built with Pine Script v6 using:
Advanced detrended price oscillation with Ehlers cycle detection
Dynamic Fibonacci calculation based on swing point analysis
LazyBear WaveTrend algorithm implementation
Real-time Money Flow Index with institutional bias detection
Volume analysis with spike detection and directional confirmation
Simplified Elliott Wave counting with phase detection
Multi-factor confluence scoring system with component weighting
Anti-overlap signal filtering to prevent signal clustering
The code is fully open-source and can be modified to suit individual trading styles and preferences.
Originality Statement
This indicator is original in its harmonic integration approach. While individual components (DPO, Fibonacci, WaveTrend, MFI, volume analysis, Elliott Wave) are established concepts, this integration is justified because:
It synthesizes six distinct methodologies that address different aspects of market harmony
The harmonic wave engine combines detrended oscillation with cycle detection for superior rhythm analysis
Dynamic Fibonacci levels adjust to current wave structure rather than using static retracements
Golden Pocket zone identification provides mathematical precision for reversal timing
Multi-factor confluence scoring quantifies setup quality across all components
Perfect Harmonic detection identifies rare, high-probability reversal opportunities
Each component contributes unique harmonic information: wave analysis reveals natural cycles, Fibonacci provides mathematical levels, WaveTrend shows momentum extremes, money flow indicates institutional positioning, volume confirms genuine moves, and Elliott Wave provides structural context. The integration's value lies in identifying moments when all these harmonic factors align simultaneously.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss and is not suitable for all investors.
Harmonic analysis and Fibonacci levels are mathematical concepts that do not guarantee future price movement. Past performance and backtested results do not guarantee future results. Market conditions change, and harmonic patterns that worked historically may not work in the future.
Always use proper risk management, including stop losses and position sizing appropriate for your account size and risk tolerance. Never risk more than you can afford to lose. Consider consulting with a qualified financial advisor before making investment decisions.
The author is not responsible for any losses incurred from using this indicator. Users assume full responsibility for all trading decisions made using this tool.
-Made with passion by officialjackofalltrades Indicator

Wolfe Wave Pattern [UAlgo]Wolfe Wave Pattern is a pivot based pattern recognition indicator that scans price structure for a five point Wolfe Wave sequence and automatically draws the pattern on the chart once a valid setup is confirmed. The script works directly on price ( overlay=true ) and is built for visual analysis, giving traders a clear geometric representation of bullish and bearish Wolfe Wave formations with point labels, channel references, and a projected EPA target line.
This implementation uses confirmed swing pivots from PulseWire pivot functions as its structural foundation. Every new confirmed pivot is stored, and the script evaluates the most recent five alternating pivots for Wolfe Wave conditions. Instead of trying to detect every possible variation, it applies a practical and consistent ruleset based on swing sequencing, relative highs and lows, convergence of channel lines, and point 5 overshoot behavior beyond the 1 to 3 guide line.
When a valid pattern is found, the script draws the core wave legs (1 to 2, 2 to 3, 3 to 4, 4 to 5), a 2 to 4 channel reference, a 1 to 3 sweet zone guide, and an extended EPA line from 1 to 4 into the future. It also marks the pivot points with labels and triggers an alert message at detection time.
This makes the tool useful for discretionary traders who want a structured way to monitor Wolfe Wave geometry without manually drawing every candidate pattern.
🔹 Features
🔸 1) Pivot Based Wolfe Wave Detection
The script uses ta.pivothigh() and ta.pivotlow() with user configurable left and right bars to build a swing structure map. Each pivot is stored as a custom PivotPoint object containing:
Index of the pivot bar
Pivot price
Pivot type (high or low)
This gives the pattern engine a clean sequence of confirmed turning points rather than raw candle noise.
🔸 2) Automatic Five Point Pattern Recognition
On each newly confirmed pivot, the script checks the most recent five pivots and validates whether they form an alternating sequence suitable for a Wolfe Wave candidate. Only alternating high low high low high or low high low high low structures are considered.
This is an important filter because Wolfe Waves are geometric swing patterns and require clear alternation in pivot direction.
🔸 3) Bullish Wolfe Wave Detection Logic
The bullish model looks for a low high low high low sequence and applies structural and geometric checks, including:
Point 3 below Point 1
Point 4 below Point 2
Point 5 overshooting below the projected 1 to 3 line
Converging channel behavior through slope comparison of 1 to 3 and 2 to 4
This produces a clean descending wedge style candidate that matches the intended bullish Wolfe Wave concept in this implementation.
🔸 4) Bearish Wolfe Wave Detection Logic
The bearish model looks for a high low high low high sequence and applies the inverse logic:
Point 3 above Point 1
Point 4 above Point 2
Point 5 overshooting above the projected 1 to 3 line
Converging channel behavior through slope comparison of 1 to 3 and 2 to 4
This creates a rising wedge style candidate for bearish Wolfe Wave detection.
🔸 5) Full Pattern Drawing on Chart
Once detected, the script draws the pattern directly on price using line objects:
Wave legs 1 to 2, 2 to 3, 3 to 4, and 4 to 5
A 2 to 4 channel reference line
A 1 to 3 sweet zone guide line
An EPA projection line extended from 1 to 4 into future bars
This helps traders quickly inspect geometry and projected target direction without manual plotting.
🔸 6) Point Labels and Pattern Name Display
The indicator labels all five pivot points and positions the labels above or below price depending on pattern direction. This improves readability and makes it easy to verify the sequence visually.
For bullish patterns, low points are labeled below bars and high points above bars. For bearish patterns, the logic is inverted.
🔸 7) EPA Target Projection
The script draws an extended EPA line based on Point 1 and Point 4, projecting it beyond Point 5 to create a visual target path. This offers a practical reference for post detection expectation analysis.
The projection length is proportional to the 1 to 4 horizontal distance, which keeps the target line visually consistent with the pattern scale.
🔸 8) Visual Customization Inputs
Users can customize:
Bullish pattern color
Bearish pattern color
Line width
The script also includes a line style input and line style helper mapping. In the current implementation, core pattern segments are drawn with fixed style choices for visual consistency, while supporting lines use dedicated dashed and arrow styles.
🔸 9) Alert on Detection
When a new bullish or bearish Wolfe Wave is confirmed, the script triggers an alert message at bar close frequency. This allows traders to monitor multiple symbols or timeframes without constantly watching the chart.
🔸 10) Structured Object Design for Maintainability
The script uses custom types for both pivots and patterns:
PivotPoint for swing points
WolfeWave for the full detected pattern including lines, labels, EPA line, and sweet zone line
This object based design keeps the code organized and easier to extend in future versions.
🔹 Calculations
1) Pivot Detection and Storage
The script identifies confirmed swing highs and lows using user defined left and right pivot lengths:
float ph = ta.pivothigh(high, lenLeft, lenRight)
float pl = ta.pivotlow(low, lenLeft, lenRight)
When a pivot is confirmed, it is stored at the actual pivot bar index ( bar_index - lenRight ) because pivot confirmation happens after the right side bars are complete:
if not na(ph)
pivotArray.addPivot(bar_index - lenRight, ph, true)
if not na(pl)
pivotArray.addPivot(bar_index - lenRight, pl, false)
The pivot array is capped to a manageable size:
if pivots.size() > 100
pivots.shift()
2) Pattern Scan Trigger and Five Pivot Window
The pattern engine only runs when at least five pivots exist. It then reads the latest five pivots in order:
PivotPoint p5 = pivotArray.get(pivotArray.size() - 1)
PivotPoint p4 = pivotArray.get(pivotArray.size() - 2)
PivotPoint p3 = pivotArray.get(pivotArray.size() - 3)
PivotPoint p2 = pivotArray.get(pivotArray.size() - 4)
PivotPoint p1 = pivotArray.get(pivotArray.size() - 5)
The check is gated so the recognition logic processes only when a new pivot has just been confirmed:
bool newPivotConfirmed = not na(ph) or not na(pl)
3) Alternation Check
Before applying Wolfe rules, the script requires the five pivots to alternate between highs and lows:
bool alternating = (p1.isHigh != p2.isHigh) and (p2.isHigh != p3.isHigh) and (p3.isHigh != p4.isHigh) and (p4.isHigh != p5.isHigh)
This prevents invalid sequences such as repeated highs or repeated lows from being treated as pattern candidates.
4) Slope and Projection Utilities
Two helper methods provide the geometric basis of the pattern logic:
Slope between two pivots:
method getSlope(PivotPoint pA, PivotPoint pB) =>
(pB.price - pA.price) / (pB.index - pA.index)
Projected price of a line at a target bar index:
method getProjectedPrice(PivotPoint pA, PivotPoint pB, int targetIndex) =>
float slope = (pB.price - pA.price) / (pB.index - pA.index)
pA.price + slope * (targetIndex - pA.index)
These methods are used for overshoot validation, convergence checks, and EPA target projection.
5) Bullish Wolfe Wave Detection Rules
The bullish pattern requires a pivot sequence of:
Point 1 low
Point 2 high
Point 3 low
Point 4 high
Point 5 low
In code, this is checked as:
if not p1.isHigh and p2.isHigh and not p3.isHigh and p4.isHigh and not p5.isHigh
Then the script applies structural conditions:
if p3.price < p1.price and p4.price < p2.price
This enforces a downward contracting structure.
Next, it checks Point 5 overshoot relative to the projected 1 to 3 line at the Point 5 index:
float proj13_at_5 = p1.getProjectedPrice(p3, p5.index)
if p5.price < proj13_at_5
Finally, it checks convergence using slope comparison:
float m13 = p1.getSlope(p3)
float m24 = p2.getSlope(p4)
if m24 < m13
detected := true
Interpretation:
For a bullish setup in this script, both 1 to 3 and 2 to 4 slopes are typically negative, and the 2 to 4 line must descend faster than the 1 to 3 line so the structure converges to the right.
6) Bearish Wolfe Wave Detection Rules
The bearish pattern requires a pivot sequence of:
Point 1 high
Point 2 low
Point 3 high
Point 4 low
Point 5 high
In code:
else if p1.isHigh and not p2.isHigh and p3.isHigh and not p4.isHigh and p5.isHigh
Structural conditions:
if p3.price > p1.price and p4.price > p2.price
This enforces an upward contracting structure.
Point 5 overshoot must be above the projected 1 to 3 line:
float proj13_at_5 = p1.getProjectedPrice(p3, p5.index)
if p5.price > proj13_at_5
Convergence is then checked using slope comparison:
float m13 = p1.getSlope(p3)
float m24 = p2.getSlope(p4)
if m24 > m13
detected := true
Interpretation:
For a bearish setup, both lines are typically rising, and the 2 to 4 line must rise faster than the 1 to 3 line so the wedge contracts to the right.
7) Sweet Zone Guide and Channel Reference
After detection, the script draws a sweet zone guide using the 1 to 3 geometry projected to the Point 5 index:
this.sweetZoneLine := line.new(
this.p1.index, this.p1.price,
this.p5.index, this.p1.getProjectedPrice(this.p3, this.p5.index),
color=color.new(c, 50), width=1, style=line.style_dashed)
It also draws a 2 to 4 reference line as a dashed channel boundary:
this.patternLines.push(line.new(this.p2.index, this.p2.price, this.p4.index, this.p4.price, color=color.new(c, 50), width=1, style=line.style_dashed))
Together, these lines visually frame the Wolfe Wave channel and the Point 5 overshoot area.
8) EPA Line Projection
The EPA line is projected from Point 1 to Point 4 and extended into the future. The horizontal projection length is based on the bar distance from Point 1 to Point 4:
int dist14 = this.p4.index - this.p1.index
int targetIdx = this.p5.index + dist14
float targetPrice = this.p1.getProjectedPrice(this.p4, targetIdx)
The EPA line is then drawn with an arrow style:
this.epaLine := line.new(this.p1.index, this.p1.price, targetIdx, targetPrice, color=color.yellow, width=2, style=line.style_arrow_right)
This provides a projected target path for the expected move after Point 5.
9) Label Placement Logic
The script places point labels above or below bars based on pattern direction so the labels remain readable and consistent with swing polarity.
For bullish patterns:
Points 1, 3, and 5 are placed below bars
Points 2 and 4 are placed above bars
For bearish patterns:
Points 1, 3, and 5 are placed above bars
Points 2 and 4 are placed below bars
This logic is encoded through direction dependent yloc assignment before creating labels.
10) Detection Object Construction and Drawing
Once a pattern is validated, the script creates a WolfeWave object and calls its draw method:
WolfeWave ww = WolfeWave.new(p1, p2, p3, p4, p5, isBull)
ww.draw()
The object stores the five pivots, direction, line arrays, label arrays, and special lines (EPA and sweet zone), which makes the implementation modular and easier to manage.
11) Alert Logic
After a bullish or bearish pattern is drawn, the script sends an alert message:
alert("Wolfe Wave " + (isBull ? "Bullish" : "Bearish") + " Detected", alert.freq_once_per_bar_close)
This allows users to automate notification workflows and review setups only when a complete pattern has been confirmed. Indicator

Cascade Trend Navigator [JOAT]Cascade Trend Navigator
Introduction
The Cascade Trend Navigator is an open-source institutional-grade multi-timeframe trend and flow system that combines dynamic support/resistance zones, volume profile analysis, and liquidity detection into a unified overlay indicator. This comprehensive system integrates multiple proven methodologies to identify high-probability trend continuation and reversal zones where institutional and retail liquidity converge.
The indicator is designed for traders who understand that successful trend following requires more than simple moving average crossovers. By synthesizing adaptive moving averages, dynamic support/resistance zones, volume profile analysis, and liquidity pool detection, this tool helps identify structural market inflection points with institutional-grade precision.
Why This Integration Exists
This indicator combines four distinct analytical frameworks that complement each other:
Adaptive Moving Average System: Uses Hull, TEMA, DEMA, ZEMA, and VWMA calculations for superior trend identification with reduced lag
Dynamic Support/Resistance Zones: Calculates real-time zones using Hull Moving Averages and ATR-based deviation bands
Volume Profile Analysis: Identifies Point of Control (POC) and high-volume price levels where institutional activity concentrates
Liquidity Pool Detection: Tracks equal highs/lows, swing points, and liquidity zones where stop hunts typically occur
Each component addresses different aspects of market structure. The adaptive MA system provides trend direction with minimal lag, dynamic zones reveal real-time support/resistance levels, volume profile shows where institutions are most active, and liquidity detection identifies areas where price reversals are likely. Together, they create a multi-dimensional view of market flow and structure.
Core Components Explained
1. Advanced Moving Average Engine
The indicator offers seven different moving average types, each optimized for specific market conditions:
Hull MA (HMA): wma(2 * wma(src, length/2) - wma(src, length), sqrt(length))
TEMA: 3 * ema1 - 3 * ema2 + ema3 (Triple smoothed)
DEMA: 2 * ema1 - ema2 (Double smoothed)
ZEMA: Zero-lag EMA with lag compensation
VWMA: Volume-weighted for institutional flow tracking
The system uses three MA periods: Fast (default 20), Slow (default 50), and Trend (default 200). Trend direction is determined when Fast MA > Slow MA and price > Trend MA for bullish conditions, with the inverse for bearish conditions.
2. Dynamic Support/Resistance Zone System
Unlike static pivot levels, these zones adapt to current market volatility:
Resistance Zone: HMA(high, length) + (ATR * deviation) to HMA(high, length)
Support Zone: HMA(low, length) to HMA(low, length) - (ATR * deviation)
The zones automatically adjust width based on ATR, making them more relevant during high volatility periods and tighter during consolidation. This adaptive nature provides more accurate entry and exit levels compared to fixed percentage-based zones.
3. Volume Profile Integration
The indicator calculates a real-time volume profile over a specified lookback period:
- Divides the price range into configurable bins (default 20)
- Accumulates volume for each price level
- Identifies Point of Control (POC) - the price level with highest volume
- Displays POC as a dynamic level where institutional activity is concentrated
This helps traders understand where the majority of trading activity occurred and where price is likely to find support or resistance based on volume acceptance.
4. Liquidity Pool Detection System
The system identifies multiple types of liquidity pools:
Equal Highs/Lows: Price levels where multiple highs or lows form at similar levels, creating liquidity pools for institutional players to target
Swing Points: Pivot highs and lows that represent areas where retail stops are likely clustered
Liquidity Sweeps: Instances where price briefly moves beyond recent highs/lows but fails to sustain, indicating stop hunting activity
These areas often precede significant price moves as institutions clear retail positions before establishing their own.
5. Trend Strength Calculation
The indicator calculates trend strength as:
Trend Strength = abs((Fast MA - Slow MA) / Slow MA) * 100
This provides a quantitative measure of trend momentum, helping traders distinguish between strong trending moves and weak corrective phases.
Visual Elements
Moving Average Cloud: Fill between Fast and Slow MAs with gradient coloring based on trend direction
Dynamic Zones: Support zones in green, resistance zones in red with glowing borders
POC Line: Golden cross marking the highest volume price level
Liquidity Markers: Triangles for equal highs/lows, diamonds for swing points
Signal Arrows: BUY/SELL labels for trend changes and zone touches
Trend Background: Subtle background coloring indicating overall market bias
Dashboard: Real-time display of trend status, strength, and distances to key levels
How Components Work Together
The integration creates a layered analysis approach:
Layer 1 - Trend Identification: Adaptive MAs determine primary trend direction with minimal lag
Layer 2 - Dynamic Levels: Support/resistance zones provide entry and exit levels that adapt to volatility
Layer 3 - Volume Confirmation: POC shows where institutions are most active
Layer 4 - Liquidity Mapping: Equal highs/lows and swing points reveal where reversals are likely
Layer 5 - Signal Synthesis: All components combine to generate high-probability trade signals
Example scenario: Price approaches a dynamic support zone (Layer 2) in an uptrend (Layer 1), near the POC level (Layer 3), with equal lows nearby (Layer 4). This confluence suggests a high-probability bounce location.
Input Parameters
Trend Settings:
Fast MA Length: Period for fast moving average (default: 20)
Slow MA Length: Period for slow moving average (default: 50)
Trend MA Length: Period for trend filter (default: 200)
MA Type: Choose from SMA, EMA, HMA, TEMA, DEMA, ZEMA, VWMA
Show MA Cloud: Toggle cloud fill between fast and slow MAs
Zone Settings:
Zone Calculation Length: Period for HMA zone calculation (default: 50)
Zone Deviation: ATR multiplier for zone width (default: 1.5)
Show Support/Resistance Zones: Toggle zone display
Volume Profile Settings:
Volume Profile Length: Lookback period for volume calculation (default: 100)
Number of Price Bins: Granularity of volume profile (default: 20)
Show Volume Profile: Toggle POC display
Liquidity Settings:
Show Liquidity Zones: Toggle liquidity markers
Liquidity Lookback: Period for swing point detection (default: 50)
How to Use This Indicator
Step 1: Identify Trend Direction
Check the MA cloud color and trend background. Green indicates bullish trend, red indicates bearish trend.
Step 2: Locate Dynamic Zones
Identify current support and resistance zones. These adapt to volatility and provide better levels than static pivots.
Step 3: Check Volume Profile
Note the POC level - this shows where most institutional activity occurred and often acts as magnetic price level.
Step 4: Map Liquidity Pools
Look for equal highs/lows and swing points. These areas often see stop hunting before major moves.
Step 5: Wait for Confluence
Best setups occur when multiple elements align: trend direction + zone touch + POC proximity + liquidity pool.
Step 6: Monitor Dashboard
Use the dashboard to track trend strength, distances to key levels, and current signal status.
Best Practices
Use on 15-minute to daily timeframes for optimal signal quality
Combine with proper risk management - zones provide levels, not exact entries
Pay attention to trend strength - stronger trends have higher continuation probability
Watch for zone touches in trending markets as continuation signals
Liquidity sweeps often provide excellent risk:reward entries when they fail
POC acts as magnetic level - price often returns to test these areas
Volume confirmation is critical - avoid signals during low volume periods
Indicator Limitations
Does not provide exact entry/exit signals - requires trader interpretation
Can generate false signals in choppy, sideways markets
Dynamic zones may adjust too quickly in highly volatile conditions
Volume profile requires sufficient lookback data to be meaningful
Liquidity pools don't always get tested - not every level provides opportunity
Trend strength can remain elevated longer than expected during strong moves
Performance varies across different markets and timeframes
Requires understanding of institutional order flow concepts for effective use
Technical Implementation
Built with Pine Script v6 using:
Advanced moving average calculations with zero-lag techniques
Real-time volume profile computation with dynamic binning
Adaptive support/resistance zone calculation using HMA and ATR
Pivot-based liquidity pool detection with swing analysis
Dynamic color gradients based on trend strength and direction
Comprehensive dashboard with real-time statistics
Anti-overlap signal filtering to prevent signal clustering
The code is fully open-source and can be modified to suit individual trading styles and preferences.
Originality Statement
This indicator is original in its integration approach. While individual components (moving averages, support/resistance, volume profile, liquidity detection) are established concepts, this integration is justified because:
It synthesizes four distinct methodologies that address different market aspects
The adaptive zone calculation provides dynamic levels that adjust to current volatility
Volume profile integration shows institutional activity concentration in real-time
Liquidity pool detection reveals areas where institutional stop hunting typically occurs
The combination helps identify confluence zones where multiple factors align
Anti-overlap filtering and trend strength calculation provide quantitative edge
Each component contributes unique information: adaptive MAs provide trend direction with minimal lag, dynamic zones offer volatility-adjusted levels, volume profile reveals institutional activity, and liquidity detection identifies reversal zones. The integration's value lies in presenting these complementary perspectives simultaneously with unified signal generation.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss and is not suitable for all investors.
Technical indicators are tools for analysis, not guarantees of future performance. Past performance and backtested results do not guarantee future results. Market conditions change, and strategies that worked historically may not work in the future.
Always use proper risk management, including stop losses and position sizing appropriate for your account size and risk tolerance. Never risk more than you can afford to lose. Consider consulting with a qualified financial advisor before making investment decisions.
The author is not responsible for any losses incurred from using this indicator. Users assume full responsibility for all trading decisions made using this tool.
-Made with passion by officialjackofalltrades Indicator

Quasimodo (QML) Pattern [UAlgo]Quasimodo (QML) Pattern is a market structure pattern detector that identifies Quasimodo formations using confirmed swing pivots and then visualizes the full structure directly on the chart. The Quasimodo concept is often described as a stop run and reversal model where price first violates a prior swing point, then breaks structure in the opposite direction. This script formalizes that idea into a strict pivot sequence and draws the key structural components so the pattern can be reviewed consistently.
The indicator maintains a rolling history of pivot highs and pivot lows, then checks the most recent four pivots for a valid Quasimodo sequence. When a bullish or bearish QML is confirmed, the script draws a connected structure, highlights the pattern area with a fill, plots a Market Structure Break reference line, and marks a QML zone derived from the left shoulder and the head. The most recent pattern zone is extended forward to keep it visible for potential retests.
This tool is intended to support structured analysis of reversal setups, with visual anchors that make it easy to locate left shoulder, reaction, head, and MSB points without manual drawing.
🔹 Features
1) Pivot Based Swing Engine
The script uses pivot highs and pivot lows to define swings. Left Bars and Right Bars control how many bars are required to confirm each pivot. This creates stable swing points and reduces noise compared to raw candle comparisons.
Confirmed pivots are stored as PivotPoint objects with price, bar index, and direction (high or low). The pivot history is capped to keep memory efficient while retaining enough context for detection.
2) Strict Four Pivot Pattern Validation
Detection uses the most recent four pivots, enforcing an alternating sequence so the structure follows a zig zag pattern. Only sequences that alternate high and low consistently are eligible for classification.
This avoids false detections where multiple highs or multiple lows occur in a row.
3) Bullish QML Detection Logic
The bullish model requires:
Left shoulder is a low
Reaction is a high
Head is a lower low than the left shoulder
MSB is a higher high than the reaction
This represents a liquidity grab below the prior swing low followed by a break above the reaction high, which is treated as the structure break confirmation.
4) Bearish QML Detection Logic
The bearish model requires:
Left shoulder is a high
Reaction is a low
Head is a higher high than the left shoulder
MSB is a lower low than the reaction
This represents a liquidity grab above the prior swing high followed by a break below the reaction low.
5) Full Pattern Visualization with Structural Labels
When a pattern is detected, the script draws:
Three visible connector lines linking left shoulder to reaction, reaction to head, and head to MSB
A filled highlight over the core structure area to emphasize the liquidity grab geometry
Point labels at left shoulder, head, and MSB for quick reading
A descriptive pattern label showing Bullish QML or Bearish QML
Visual styling, colors, and label sizing are user configurable.
6) MSB Break Reference Line
A dotted horizontal line is drawn from the reaction point to the MSB point at the reaction price level. This acts as a clear market structure break reference and helps validate that the break level was actually exceeded in the required direction.
7) QML Zone Projection
The script draws a QML zone box that spans the price range between the left shoulder and the head. This zone is extended forward in time so it remains visible for potential retests and reactions.
8) Efficient Execution and Update Behavior
Pattern checks run only when a new pivot is confirmed, reducing repeated evaluation. The script also extends the most recent QML zone and repositions the main label forward for better ongoing visibility.
🔹 Calculations
1) Pivot Detection
Pivot highs and pivot lows are confirmed using Left Bars and Right Bars:
float ph = ta.pivothigh(leftLen, rightLen)
float pl = ta.pivotlow(leftLen, rightLen)
When a pivot is confirmed, the bar index is aligned to the pivot location using the rightLen offset:
if not na(ph)
pivotArray.pushPivot(ph, bar_index , true)
if not na(pl)
pivotArray.pushPivot(pl, bar_index , false)
Each pivot is stored as:
price
index
isHigh flag
2) Alternating Sequence Requirement
The script evaluates the last four pivots p0 through p3 and requires strict alternation:
bool correctSequence =
(p0.isHigh != p1.isHigh) and (p1.isHigh != p2.isHigh) and (p2.isHigh != p3.isHigh)
This ensures the sequence forms a valid zig zag structure.
3) Bullish Quasimodo Conditions
Bullish QML is evaluated when p0 is a low:
if not p0.isHigh
if p2.price < p0.price and p3.price > p1.price
Quasimodo qml = Quasimodo.new(p0, p1, p2, p3, true)
Interpretation:
Head is a lower low relative to the left shoulder
MSB is a higher high relative to the reaction
This produces a sweep and reversal structure with confirmation
4) Bearish Quasimodo Conditions
Bearish QML is evaluated when p0 is a high:
if p0.isHigh
if p2.price > p0.price and p3.price < p1.price
Quasimodo qml = Quasimodo.new(p0, p1, p2, p3, false)
Interpretation:
Head is a higher high relative to the left shoulder
MSB is a lower low relative to the reaction
5) Pattern Drawing Components
When a pattern is confirmed, the script draws connecting lines:
line.new(LS.index, LS.price, R.index, R.price)
line.new(R.index, R.price, H.index, H.price)
line.new(H.index, H.price, MSB.index, MSB.price)
It also draws a horizontal MSB reference at the reaction price:
line.new(reaction.index, reaction.price, msb.index, msb.price, style=line.style_dotted)
A QML zone box is created using left shoulder and head prices and extended forward:
qml.qmlZone := box.new(LS.index, LS.price, bar_index + 10, H.price, bgcolor=color.new(col, 85))
On each bar, the most recent zone is extended further to remain visible:
box.set_right(lastQml.qmlZone, bar_index + 5)
label.set_x(lastQml.lbl, bar_index + 5)
6) Pivot History Management
To keep execution efficient, the pivot array is capped:
if pivots.size() > 50
pivots.shift()
Pattern checking is triggered only when a new pivot is found, which reduces redundant processing on bars where no structural update occurred. Indicator

Wedge Pattern [UAlgo]Overview
Wedge Pattern is a chart overlay that detects rising and falling wedge formations using strict pivot based rules and a validation engine that enforces classic technical analysis requirements. The script builds two trendlines from confirmed pivot highs and pivot lows, verifies that both boundaries converge toward an apex in the future, and ensures that price remains contained within the wedge until a valid breakout occurs.
The indicator is designed to reduce subjective pattern drawing. It requires a minimum number of touches on each boundary, checks that no candle closes outside the wedge during formation, and treats the wedge as invalid if price breaks in the wrong direction or if the two boundaries collapse into each other. When a breakout is confirmed, the script updates the wedge label and can project a measured target based on the initial wedge width.
This tool is meant for traders who want automatic, rules driven wedge identification with clear status states, breakout confirmation, and optional target projection on the chart.
🔹 Features
1) Pivot Based Wedge Construction
The script identifies swing highs and swing lows using pivot detection. Each confirmed pivot is stored as a Coordinate containing bar index and price. When enough pivots exist, the script forms:
An upper trendline from the earliest required pivot high to the most recent pivot high
A lower trendline from the earliest required pivot low to the most recent pivot low
Pivot Left and Pivot Right control swing sensitivity. Larger values produce fewer but stronger pivots. Smaller values react faster but may include minor swings.
2) Minimum Touch Requirement Per Boundary
A wedge is only considered valid when there are at least a user defined number of pivot touches for both the upper and lower boundary. This aligns with standard charting practice where two points draw a line, but three points validate it.
Min Touches per Line controls the minimum pivot count required before a wedge can be formed.
3) Objective Wedge Type Classification
After calculating slopes for the upper and lower trendlines, the script classifies wedge type using slope direction and relative steepness:
Rising wedge requires both slopes to be positive and the lower slope to be steeper than the upper slope
Falling wedge requires both slopes to be negative and the upper slope to be steeper than the lower slope in the negative direction
This ensures convergence and distinguishes wedges from simple channels.
4) Apex Projection and Future Convergence Rule
The wedge apex is computed as the intersection point of the two trendlines. A valid wedge requires the apex index to be in the future. This confirms that the boundaries are converging and that the pattern is not already expired at detection time.
5) Mandatory Containment Rule During Formation
A core validation rule enforces that no closes occur outside the wedge boundaries while the wedge is forming. If any close is above the upper boundary or below the lower boundary by at least one tick, the candidate wedge is rejected. This prevents premature breakouts from being treated as valid patterns.
6) Live Updating Boundaries
Once a wedge becomes active, the script extends both boundary lines on every bar by updating their end coordinates using the trendline slope. This keeps the wedge aligned with current time and allows breakout checks to remain accurate.
7) Breakout Detection and Status Labeling
The script defines correct breakouts by wedge type:
Rising wedge is bearish biased, so a valid breakout is a close below the lower boundary
Falling wedge is bullish biased, so a valid breakout is a close above the upper boundary
When a valid breakout occurs, the wedge status is updated to BROKEOUT and the label color reflects direction. If price breaks the opposite boundary, or if boundaries collapse, the wedge is marked FAILED.
8) Target Projection Using Measured Move
If enabled, the script projects a target line after breakout. The target distance is based on the wedge width measured near the start of the pattern, then projected from the breakout boundary:
For a rising wedge breakdown, the target is placed below the lower boundary by the measured width
For a falling wedge breakout, the target is placed above the upper boundary by the measured width
A target label prints the projected price level.
🔹 Calculations
1) Pivot Detection and Coordinate Storage
Swing points are detected using symmetric pivots:
float ph = ta.pivothigh(high, INPUT_PIVOT_LEFT, INPUT_PIVOT_RIGHT)
float pl = ta.pivotlow(low, INPUT_PIVOT_LEFT, INPUT_PIVOT_RIGHT)
Confirmed pivots are stored using the pivot right offset so the bar index matches where the pivot actually formed:
if not na(ph)
pivot_highs.push(Coordinate.new(bar_index - INPUT_PIVOT_RIGHT, ph))
if not na(pl)
pivot_lows.push(Coordinate.new(bar_index - INPUT_PIVOT_RIGHT, pl))
Arrays are capped to keep only recent pivot history.
2) Trendline Construction and Slope Calculation
When enough pivots exist, the script picks the earliest required touch and the most recent touch for both highs and lows, then builds trendlines:
Coordinate p1h = pivot_highs.get(pivot_highs.size() - MIN_TOUCHES_PER_LINE)
Coordinate pNh = pivot_highs.get(pivot_highs.size() - 1)
Trendline tl_up = Trendline.new(p1h, pNh, 0.0, na)
tl_up.slope := tl_up.calc_slope()
Slope is defined as:
(this.end.price - this.start.price) / (this.end.index - this.start.index)
The same logic is used for the lower trendline from pivot lows.
3) Wedge Type Rules
Wedge type is derived from slope sign and convergence:
Rising wedge:
if tl_up.slope > 0 and tl_lo.slope > 0 and tl_lo.slope > tl_up.slope
w_type := 1
Falling wedge:
if tl_up.slope < 0 and tl_lo.slope < 0 and tl_up.slope < tl_lo.slope
w_type := 2
This ensures both boundaries move in the same direction while converging.
4) Apex Index Calculation
The apex index is calculated from the line intersection of the two trendlines:
float apex_x = (y2 - y1 + m1 * x1 - m2 * x2) / (m1 - m2)
math.round(apex_x)
A candidate wedge is only accepted if apex index is greater than the current bar index.
5) Containment Validation Using Close Prices
The script checks each bar from the wedge start to the current bar to ensure that close remains within boundaries:
float up_p = this.upper.get_price_at(i)
float lo_p = this.lower.get_price_at(i)
float c_p = close
if c_p > up_p + syminfo.mintick or c_p < lo_p - syminfo.mintick
violated := true
If violated is true, the wedge is rejected.
6) Live Boundary Update and Breakout Checks
For active wedges, end coordinates are updated each bar using the projected boundary price:
line.set_y2(w.upper.line_id, w.upper.get_price_at(bar_index))
line.set_y2(w.lower.line_id, w.lower.get_price_at(bar_index))
Breakout checks use the current close against projected boundary prices:
bool b_up = close > u_p
bool b_dn = close < l_p
Correct breakout:
Rising wedge requires b_dn
Falling wedge requires b_up
Invalidation:
Rising wedge fails if b_up
Falling wedge fails if b_dn
Any wedge fails if upper boundary price is less than or equal to lower boundary price
7) Target Projection
Measured width is derived from the initial distance between boundaries near the start of the wedge, then projected from the breakout side:
float m = math.abs(w.upper.start.price - w.lower.get_price_at(w.upper.start.index))
float t = w.is_rising ? l_p - m : u_p + m
The target line and label are drawn forward a fixed number of bars to provide a clear reference after breakout. Indicator

Auto Harmonic Pattern Recognition [UAlgo]Auto Harmonic Pattern Recognition is an overlay indicator that automatically scans price action for classical harmonic structures using a ZigZag style pivot engine. It continuously builds swing points, validates Fibonacci relationships across the last five pivots, and prints a confirmed pattern as soon as a valid X A B C D sequence is detected.
The script is engineered for practical chart use. It prioritizes clear geometry, a visible Potential Reversal Zone around point D, and an RR focused projection set that includes stop placement and multiple take profit levels. A compact dashboard also tracks how many patterns have been confirmed during the session, helping you understand how active the market has been for harmonic setups.
This tool is best used as a structure and planning layer. It provides harmonic recognition and a consistent measurement framework so you can focus on confirmation, execution timing, and risk management.
Features
1) Pivot Engine With Depth Control
The foundation of detection is a pivot system that identifies local swing highs and lows using a user defined Pivot Depth. Depth controls how strict the swing points are. Lower values react faster and produce more pivots. Higher values react slower and produce cleaner swings.
The engine maintains an internal pivot list, updates the last pivot when a more extreme value appears in the same direction, and keeps the stored history lightweight by limiting the array size.
2) Fully Automated Harmonic Recognition
Once at least five pivots exist, the script evaluates the most recent X A B C D sequence and checks it against multiple harmonic templates. The current build includes:
Gartley
Bat
Butterfly
Crab
Deep Crab
Cypher
Shark
5 0
Nen Star
Leonardo
Bullish and bearish variants are supported. The direction is decided by the high low sequence of X A B C D, so the same ratio logic can be applied to either side of the market.
3) Ratio Tolerance Control
Harmonics require ratios to land within acceptable bounds rather than exact values. Ratio Tolerance allows you to define how strict the matching is. A tighter tolerance reduces pattern count and increases selectivity. A wider tolerance increases pattern frequency and is more permissive.
The tolerance rule is applied as a symmetric band around target ratios where appropriate.
4) Elite Visualization Suite
The renderer draws a premium style structure that emphasizes readability:
Neon geometry lines connecting X A B C D
Soft internal fills to visually frame the legs
A PRZ glow zone around point D to highlight the decision area
Optional live ratio tags placed near relevant legs
A pattern label at point D with bull or bear styling
You can toggle PRZ, ratios, glow geometry, and the stats panel independently.
5) RR Focused Trade Projection
When a pattern prints, the script projects a complete planning scaffold:
A tight stop level placed slightly beyond the extreme point
Three take profit levels derived from AD expansion factors
Live RR values for each take profit based on the computed risk distance
This approach standardizes structure based exits and allows you to compare opportunities objectively across symbols and timeframes.
6) Performance Dashboard
A compact table panel can be displayed on the chart. It shows system status and the total number of patterns detected. This is useful for quickly verifying the script is active and for tracking how often the engine has confirmed structures in the current run.
Calculations
1) Pivot Detection Using Depth Window
A pivot is confirmed when the candle at index is the highest high or lowest low within a symmetric window:
Window size equals depth times 2 plus 1
float h = ta.highest(high, zz_depth * 2 + 1)
float l = ta.lowest(low, zz_depth * 2 + 1)
bool is_h = high == h
bool is_l = low == l
If a pivot is found, the engine pushes a new Pivot object containing bar index, price, and direction. If the direction has not changed, it upgrades the last pivot when a more extreme price appears.
2) X A B C D Selection
Detection always uses the most recent five pivots:
D is the latest pivot
C is the pivot before D
B is the pivot before C
A is the pivot before B
X is the pivot before A
Pivot d = zz_points.get(sz - 1)
Pivot c = zz_points.get(sz - 2)
Pivot b = zz_points.get(sz - 3)
Pivot a = zz_points.get(sz - 4)
Pivot x = zz_points.get(sz - 5)
3) Leg Length Measurements
All harmonic ratios are derived from absolute swing distances:
XA is distance from X to A
AB is distance from A to B
BC is distance from B to C
CD is distance from C to D
XD is distance from X to D
AC is distance from A to C
float xa = math.abs(a.price - x.price)
float ab = math.abs(b.price - a.price)
float bc = math.abs(c.price - b.price)
float cd = math.abs(d.price - c.price)
float xd = math.abs(d.price - x.price)
float ac = math.abs(c.price - a.price)
4) Ratio Set Computation
The script computes key ratios used by harmonic templates. Divisions are protected so a zero leg does not break the logic.
r_xb measures AB relative to XA
r_ac measures BC relative to AB
r_bd measures CD relative to BC
r_xd measures XD relative to XA
r_xa_c measures AC relative to XA
float r_xb = ab / (xa == 0 ? 1 : xa)
float r_ac = bc / (ab == 0 ? 1 : ab)
float r_bd = cd / (bc == 0 ? 1 : bc)
float r_xd = xd / (xa == 0 ? 1 : xa)
float r_xa_c = ac / (xa == 0 ? 1 : xa)
5) Bull and Bear Structure Validation
Before applying template ratios, the script verifies the pivot sequence forms a valid alternating swing structure.
Bullish sequence requires:
X low, A high, B low, C high, D low
Bearish sequence requires:
X high, A low, B high, C low, D high
bool is_bull = not x.is_high and a.is_high and not b.is_high and c.is_high and not d.is_high
bool is_bear = x.is_high and not a.is_high and b.is_high and not c.is_high and d.is_high
6) Tolerance Based Ratio Check
For ratios with a target value, the script uses a tolerance band:
actual must be within target times 1 minus tol and target times 1 plus tol
method check(float actual, float target, float tol) =>
actual >= target * (1 - tol) and actual <= target * (1 + tol)
7) Template Matching Logic
After structure is confirmed, the script assigns a pattern name when the ratio set fits known templates. Examples:
Gartley uses r_xb near 0.618 and r_xd near 0.786
Bat uses r_xb between 0.382 and 0.5 and r_xd near 0.886
Butterfly uses r_xb near 0.786 and r_xd between 1.27 and 1.618
Crab uses r_xb between 0.382 and 0.618 and r_xd near 1.618
Deep Crab uses r_xb near 0.886 and r_xd near 1.618
Additional templates are evaluated with their own ratio windows, including Cypher, Shark, 5 0, Nen Star, and Leonardo.
8) PRZ Glow Zone Construction
PRZ is rendered as a small box centered around point D. Its size is a percentage of the X to A amplitude, which scales the zone to market volatility:
float prz_size = math.abs(h_p.x.price - h_p.a.price) * 0.05
float prz_h = h_p.d.price + prz_size
float prz_l = h_p.d.price - prz_size
This creates a consistent glow zone width that adapts to the pattern’s overall magnitude.
9) RR Focused Stop and Take Profit Projection
The script calculates AD length and XA length to derive risk and targets.
Stop is placed beyond the extreme point by a small fraction of XA:
Extreme is min of X and D for bullish structures
Extreme is max of X and D for bearish structures
Stop offset equals XA length times 0.02
float ad_len = math.abs(h_p.a.price - h_p.d.price)
float xa_len = math.abs(h_p.a.price - h_p.x.price)
float extreme = h_p.bull ? math.min(h_p.x.price, h_p.d.price) : math.max(h_p.x.price, h_p.d.price)
float sl = h_p.bull ? extreme - (xa_len * 0.02) : extreme + (xa_len * 0.02)
float risk = math.max(math.abs(h_p.d.price - sl), syminfo.mintick)
Targets are projected from point D using AD expansion factors:
0.786
1.272
1.618
float tp1 = h_p.bull ? h_p.d.price + (ad_len * 0.786) : h_p.d.price - (ad_len * 0.786)
float tp2 = h_p.bull ? h_p.d.price + (ad_len * 1.272) : h_p.d.price - (ad_len * 1.272)
float tp3 = h_p.bull ? h_p.d.price + (ad_len * 1.618) : h_p.d.price - (ad_len * 1.618)
RR values are computed as reward divided by risk for each target:
float rr1 = math.abs(tp1 - h_p.d.price) / risk
float rr2 = math.abs(tp2 - h_p.d.price) / risk
float rr3 = math.abs(tp3 - h_p.d.price) / risk
10) Duplicate Print Prevention and Alerts
To prevent repeated drawings on the same D pivot, the script tracks the last D index and only renders when a new D is confirmed. When a new pattern prints, an alert is fired once per bar.
11) Analytics Panel Update
When enabled and on the last bar, the table updates with status and the total pattern count. This keeps the UI lightweight and avoids unnecessary per bar table writes. Indicator

Indicator

Harmonic Confluence Wave Detector [JOAT]Harmonic Confluence Wave Detector
Introduction
The Harmonic Confluence Wave Detector is an open-source oscillator-based indicator that combines WaveTrend, Money Flow Index (MFI), RSI, MACD, and Stochastic RSI into a unified momentum analysis system. This mashup creates a multi-layered oscillator framework designed to identify momentum shifts, overbought/oversold conditions, and divergence patterns across multiple timeframes and calculation methods.
The indicator addresses a common trading challenge: single oscillators can give conflicting or premature signals. By synthesizing five different momentum calculations that use distinct mathematical approaches, this tool provides confluence-based signals that occur when multiple momentum indicators align, significantly reducing false signals compared to using any single oscillator alone.
Chart showing WaveTrend oscillator, MACD histogram, and multi-signal system on 1H timeframe
Why This Mashup Exists
This indicator combines five oscillators that complement each other through different calculation methodologies:
WaveTrend: Smoothed momentum oscillator based on price deviation from exponential moving average
Money Flow Index (MFI): Volume-weighted RSI showing buying/selling pressure
RSI: Classic momentum oscillator measuring speed and magnitude of price changes
MACD: Trend-following momentum indicator showing relationship between two EMAs
Stochastic RSI: Stochastic calculation applied to RSI for enhanced sensitivity
Each oscillator has unique strengths: WaveTrend excels at identifying wave-like momentum cycles, MFI incorporates volume for institutional flow analysis, RSI provides reliable overbought/oversold readings, MACD shows trend strength and direction, and Stochastic RSI catches early momentum shifts. Together, they create a comprehensive momentum picture that no single oscillator can provide.
The mashup is justified because these oscillators use fundamentally different calculations (price-based, volume-weighted, moving average convergence, stochastic) that respond to different market conditions. When they align, it indicates genuine momentum shift rather than noise.
Core Components Explained
1. WaveTrend Oscillator (Primary Signal Generator)
WaveTrend is the primary oscillator, calculated using this methodology:
// Calculate exponential average of HLC3
esa = ta.ema(hlc3, channelLength)
// Calculate deviation
d = ta.ema(abs(hlc3 - esa), channelLength)
// Calculate channel index
ci = (hlc3 - esa) / (0.015 * d)
// Apply smoothing to create WaveTrend 1
wt1 = ta.ema(ci, averageLength)
// Create WaveTrend 2 as simple moving average of WT1
wt2 = ta.sma(wt1, 4)
WaveTrend oscillates around zero, with:
Values above +60: Overbought zone
Values above +80: Extreme overbought
Values below -60: Oversold zone
Values below -80: Extreme oversold
Crossovers between WT1 and WT2: Momentum shift signals
The indicator plots WT1 and WT2 as lines with dynamic coloring based on momentum direction and strength.
2. Money Flow Index (MFI) - Volume-Weighted Momentum
MFI calculation incorporates both price and volume:
// Calculate typical price
typicalPrice = (high + low + close) / 3
// Calculate raw money flow
rawMoneyFlow = typicalPrice * volume
// Separate positive and negative money flow
positiveFlow = close > close ? rawMoneyFlow : 0
negativeFlow = close < close ? rawMoneyFlow : 0
// Sum over MFI period
positiveSum = sum(positiveFlow, mfiLength)
negativeSum = sum(negativeFlow, mfiLength)
// Calculate MFI
mfi = 100 - (100 / (1 + positiveSum / negativeSum))
MFI ranges from 0-100, with readings above 80 indicating buying pressure and below 20 indicating selling pressure. The indicator plots MFI as a line and uses it for confluence scoring.
3. RSI - Classic Momentum Oscillator
Standard RSI calculation over 14 periods (configurable):
RSI > 70: Overbought
RSI < 30: Oversold
RSI > 65 with other bearish signals: Potential reversal
RSI < 35 with other bullish signals: Potential reversal
RSI provides reliable baseline momentum readings and is used for divergence detection.
4. MACD - Trend Momentum Indicator
MACD uses standard 12/26/9 settings:
= ta.macd(close, 12, 26, 9)
The indicator displays MACD histogram with enhanced width (linewidth 8) for visibility. Histogram color changes based on:
Green: Positive and increasing (bullish momentum)
Light green: Positive but decreasing (weakening bulls)
Red: Negative and decreasing (bearish momentum)
Light red: Negative but increasing (weakening bears)
MACD histogram provides visual confirmation of momentum strength and direction.
5. Stochastic RSI - Enhanced Sensitivity
Stochastic calculation applied to RSI values:
stochRSI = ta.stoch(rsi, rsi, rsi, 14)
Stochastic RSI oscillates between 0-100 and is more sensitive than regular RSI, catching momentum shifts earlier. The indicator plots both K and D lines for crossover analysis.
Example showing all oscillators with divergence markers and signal labels
Multi-Signal System
The indicator generates six tiers of signals based on confluence strength:
BUY Signals:
BUY: WT1 crosses above WT2 in oversold zone (WT1 < -40)
STRONG BUY: BUY + volume above average + MACD histogram positive
MEGA BUY: STRONG BUY + WT1 < -60 (extreme oversold) + RSI < 35
ULTRA BUY: MEGA BUY + MFI < 30 + Stoch RSI oversold + bullish divergence
SELL Signals:
SELL: WT1 crosses below WT2 in overbought zone (WT1 > 40)
STRONG SELL: SELL + volume above average + MACD histogram negative
MEGA SELL: STRONG SELL + WT1 > 60 (extreme overbought) + RSI > 65
ULTRA SELL: MEGA SELL + MFI > 70 + Stoch RSI overbought + bearish divergence
Signal labels appear on chart with size proportional to signal strength (tiny for BUY/SELL, normal for ULTRA).
Divergence Detection System
The indicator detects divergences across multiple oscillators:
RSI Divergence:
Bullish: Price makes lower low, RSI makes higher low
Bearish: Price makes higher high, RSI makes lower high
WaveTrend Divergence:
Bullish: Price makes lower low, WT1 makes higher low
Bearish: Price makes higher high, WT1 makes lower high
MACD Divergence:
Bullish: Price makes lower low, MACD histogram makes higher low
Bearish: Price makes higher high, MACD histogram makes lower high
Divergences are marked with bright orange/yellow "D" labels (color.rgb(255, 200, 0)) with black text for maximum visibility. When multiple oscillators show divergence simultaneously, it signals strong momentum exhaustion and potential reversal.
Confluence Scoring System
The indicator calculates a real-time confluence score (0-100) by evaluating:
Confluence Components:
- WaveTrend Position: Up to 25 points (extreme zones add more weight)
- WaveTrend Momentum: Up to 15 points (WT1-WT2 relationship)
- RSI Level: Up to 15 points (extreme readings add weight)
- MFI Level: Up to 15 points (volume pressure confirmation)
- MACD Histogram: Up to 15 points (trend momentum)
- Stochastic RSI: Up to 10 points (early momentum detection)
- Divergence Presence: Up to 5 points (any divergence detected)
The dashboard displays the current confluence score with color coding:
Green (80-100): Strong bullish confluence
Light green (60-79): Moderate bullish confluence
Yellow (40-59): Neutral/mixed signals
Light red (20-39): Moderate bearish confluence
Red (0-19): Strong bearish confluence
Visual Elements
WaveTrend Lines: WT1 (blue) and WT2 (orange) with dynamic coloring
Overbought/Oversold Zones: Horizontal lines at +60/-60 and +80/-80
Zero Line: Reference line at 0
MACD Histogram: Large bars (linewidth 8) with gradient coloring
MFI Line: Purple line showing volume-weighted momentum
RSI Line: Green line with overbought/oversold reference levels
Stochastic RSI: K (blue) and D (red) lines
Signal Labels: BUY/SELL markers with size based on signal strength
Divergence Labels: Bright orange "D" markers at divergence points
Dashboard: Top-right table showing confluence score and oscillator readings
Chart demonstrating signal hierarchy from BUY to ULTRA BUY with divergence markers
How Components Work Together
The mashup creates a layered momentum analysis:
Layer 1 - Primary Momentum: WaveTrend identifies wave cycles and crossover signals
Layer 2 - Volume Confirmation: MFI validates moves with volume-weighted pressure
Layer 3 - Baseline Momentum: RSI provides reliable overbought/oversold context
Layer 4 - Trend Strength: MACD histogram shows underlying trend momentum
Layer 5 - Early Detection: Stochastic RSI catches momentum shifts before other oscillators
Layer 6 - Exhaustion Signals: Divergences across oscillators indicate momentum exhaustion
Example scenario: WT1 crosses above WT2 in oversold zone (Layer 1), MFI shows buying pressure increasing (Layer 2), RSI is below 35 (Layer 3), MACD histogram turns positive (Layer 4), Stochastic RSI crosses up (Layer 5), and RSI shows bullish divergence (Layer 6). This generates an ULTRA BUY signal with 90+ confluence score.
Input Parameters
WaveTrend Settings:
Channel Length: Period for EMA calculation (default: 10)
Average Length: Smoothing period for WT1 (default: 21)
Overbought Level: Upper threshold (default: 60)
Oversold Level: Lower threshold (default: -60)
Extreme OB Level: Extreme upper threshold (default: 80)
Extreme OS Level: Extreme lower threshold (default: -80)
Oscillator Settings:
RSI Length: Period for RSI calculation (default: 14)
MFI Length: Period for MFI calculation (default: 14)
MACD Fast: Fast EMA period (default: 12)
MACD Slow: Slow EMA period (default: 26)
MACD Signal: Signal line period (default: 9)
Stochastic RSI Length: Period for Stoch RSI (default: 14)
Signal Settings:
Show Signals: Toggle signal labels (default: enabled)
Show Divergences: Toggle divergence markers (default: enabled)
Volume Confirmation: Require volume for STRONG signals (default: enabled)
Min Confluence for Signals: Minimum score to display signals (default: 60)
Display Options:
Show Dashboard: Toggle confluence score table (default: enabled)
Show MACD Histogram: Toggle MACD display (default: enabled)
Show MFI Line: Toggle MFI display (default: enabled)
Show RSI Line: Toggle RSI display (default: enabled)
Show Stochastic RSI: Toggle Stoch RSI display (default: enabled)
Color Theme: Choose between multiple color schemes
How to Use This Indicator
Step 1: Monitor WaveTrend Oscillator
Watch for WT1/WT2 crossovers in extreme zones. Crossovers in oversold zone (< -60) suggest bullish reversals, crossovers in overbought zone (> 60) suggest bearish reversals.
Step 2: Check Confluence Score
Review the dashboard. Scores above 70 indicate strong momentum alignment. Higher scores generally produce more reliable signals.
Step 3: Identify Signal Strength
Pay attention to signal labels. ULTRA signals have highest probability but occur less frequently. STRONG signals offer good balance between frequency and reliability.
Step 4: Look for Divergences
Divergence markers indicate momentum exhaustion. When divergences appear with extreme oscillator readings, reversal probability increases significantly.
Step 5: Confirm with MACD Histogram
Check MACD histogram direction and strength. Large histogram bars confirm strong momentum, shrinking bars suggest momentum loss.
Step 6: Validate with Volume (MFI)
Ensure MFI supports the move. Bullish signals with rising MFI are stronger, bearish signals with falling MFI are stronger.
Best Practices
Use on 15-minute to 4-hour timeframes for optimal signal quality
Wait for STRONG or MEGA signals rather than acting on every BUY/SELL
Divergences work best when combined with extreme oscillator readings
Multiple oscillator divergences (RSI + WT + MACD) are most reliable
Use confluence score as filter - avoid signals below 60 score
MACD histogram size indicates momentum strength - larger bars = stronger moves
MFI divergence from price often precedes reversals (volume leads price)
Combine with price action and support/resistance for best results
Indicator Limitations
Oscillators can remain overbought/oversold longer than expected in strong trends
Divergences can persist for multiple bars before reversal occurs
Multiple signals in choppy markets can lead to whipsaws
Confluence score is mathematical calculation, not prediction of future movement
ULTRA signals are rare - waiting only for these may miss opportunities
Volume data quality varies across markets and can affect MFI reliability
Stochastic RSI is very sensitive and can generate premature signals
No indicator combination eliminates false signals entirely
Requires understanding of oscillator behavior for effective interpretation
Technical Implementation
Built with Pine Script v6 using:
Custom WaveTrend calculation with dual-line system
Proper MFI formula with volume-weighted money flow
Multi-oscillator divergence detection with pivot analysis
Confluence scoring algorithm with weighted components
Enhanced MACD histogram visualization (linewidth 8)
Dynamic color gradients for momentum visualization
Anti-overlap logic for signal labels
Real-time dashboard with oscillator readings
The code is fully open-source and can be modified to adjust oscillator weights, signal thresholds, and visual preferences.
Originality Statement
This indicator is original in its multi-oscillator integration approach. While individual components (WaveTrend, MFI, RSI, MACD, Stochastic RSI) are established oscillators, this mashup is justified because:
It combines five oscillators using fundamentally different calculation methods
The tiered signal system (BUY to ULTRA) provides graduated confidence levels
Multi-oscillator divergence detection catches momentum exhaustion across different timeframes
Confluence scoring quantifies momentum alignment across all oscillators
Volume integration through MFI adds institutional flow perspective
Enhanced visualization (large MACD histogram, bright divergence markers) improves usability
Each oscillator contributes unique information: WaveTrend provides wave-cycle analysis, MFI incorporates volume, RSI offers reliable baseline, MACD shows trend strength, and Stochastic RSI catches early shifts. The mashup's value lies in identifying when these different momentum calculations align, significantly reducing false signals compared to any single oscillator.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss and is not suitable for all investors.
Oscillator-based indicators are lagging tools that analyze past price data. They do not predict future price movement. Overbought conditions can persist in strong uptrends, and oversold conditions can persist in strong downtrends. Divergences can continue for extended periods before reversals occur.
The confluence score is a mathematical calculation, not a guarantee of trade success. High confluence scores do not ensure profitable trades. Past signal performance does not guarantee future results. Market conditions change, and oscillator behavior varies across different market regimes.
Always use proper risk management, including stop losses and position sizing appropriate for your account size and risk tolerance. Never risk more than you can afford to lose. Consider consulting with a qualified financial advisor before making investment decisions.
The author is not responsible for any losses incurred from using this indicator. Users assume full responsibility for all trading decisions made using this tool.
-Made with passion by officialjackofalltrades Indicator

Indicator

Indicator

Indicator

Folded RSIFolded RSI: Spectral-Adaptive Momentum Oscillator
A cycle-responsive RSI that automatically tunes its calculation period based on real-time spectral correlation analysis, featuring gradient-visualized momentum extremes.
Overview
The Folded RSI revolutionizes traditional momentum analysis by replacing static periods with dynamic, data-driven adaptation. Using phase-invariant spectral correlation , the indicator measures how closely price action aligns with theoretical cyclical patterns, then adjusts the RSI length accordingly. When markets exhibit strong cyclical structure, the RSI compresses to capture rapid oscillations; during chaotic or trendless periods, it expands to filter noise.
Key Features
Phase-Invariant Cycle Detection: Calculates Pearson correlation against pure sine/cosine waves to detect cyclical strength regardless of phase position (uses quadrature sum of sin/cos correlations)
Dual-Harmonic Analysis: Optionally evaluates both the target period and its 2× harmonic, automatically selecting the stronger correlation for optimal adaptation
Nonlinear Length Mapping: Maps correlation magnitude (0-1) to RSI length through a power function—strong cycles produce fast, responsive RSI; weak cycles produce smooth, lagged readings
Pure Mathematical Implementation: Custom Wilder RSI using dynamic smoothing factors (alpha = 1/length) and custom EMA—zero dependency on built-in TA functions
Gradient Visual System: Dynamic color transitions from neutral blue to hot red (overbought) or cool green (oversold) with gradient fills showing momentum intensity
Extreme Level Markers: Automatic visual alerts when RSI crosses above 70 (red markers) or below 30 (green markers)
Real-Time Diagnostics: On-chart table displaying current correlation magnitude, adaptive length, and detected dominant period
How It Works
1. Spectral Analysis
The indicator computes correlation between price returns and synthetic sinusoidal basis functions over the Cycle Window . By testing both sine and cosine components simultaneously, it achieves phase-invariance —detecting cyclical presence regardless of whether the cycle is currently at a peak, trough, or zero-crossing.
2. Harmonic Selection
When enabled, the algorithm compares correlation strength at both the Target Period and its octave (2× length), selecting whichever exhibits stronger statistical alignment with price action.
3. Adaptive Length Calculation
The correlation magnitude determines the RSI period through the formula:
High correlation → Shorter length (minimum setting)
Low correlation → Longer length (maximum setting)
Adjustable nonlinearity (power) curve to emphasize or flatten the response
4. Dynamic RSI Computation
A custom Wilder-style RSI calculates using the adaptive length, with optional post-smoothing EMA to reduce whipsaws.
Settings Guide
Cycle Window: Lookback bars for correlation calculation (40+ recommended for statistical significance)
Target Sine Period: Expected dominant cycle in bars (e.g., 20 for monthly cycles on daily charts)
RSI Length Min/Max: Bounds for adaptive calculation (5-50 standard range)
Nonlinearity (Power): Response curve shape—>1.0 emphasizes strong cycles, <1.0 creates more gradual transitions
Invert Mapping: Reverses logic (strong cycles → longer RSI) for contrarian strategies
Post Smoothing: EMA period applied to raw RSI output (1 = no smoothing)
Visual Interpretation
▼ Red Markers: RSI above 70 (potential overbought)
▲ Green Markers: RSI below 30 (potential oversold)
Diagnostics Table: Top-right display showing:
Current RSI value
Correlation magnitude (higher % = stronger cyclical structure)
Current adaptive length
Best detected period (base or harmonic)
Monitor the correlation magnitude in the diagnostics table to gauge indicator confidence—values above 60% indicate strong cyclical behavior where the adaptive length is optimized for current market conditions. Values below 30% suggest the market is in a non-cyclical state (trending or chaotic), triggering longer, smoother RSI periods.
Indicator

Adaptive Harmonic Forecast [LuxAlgo]The Adaptive Harmonic Forecast indicator decomposes price action into multiple cyclical components and a linear trend to forecast future market movement.
By extracting the most dominant frequencies from recent price data, the tool projects a multi-harmonic model into the future to identify potential reversal points and trend continuations.
🔶 USAGE
The indicator provides a mathematical projection of price action based on the assumption that markets exhibit cyclical behavior. Users can utilize the forecast to anticipate upcoming shifts in momentum or to identify the underlying trend direction.
It is important to note that the forecast is dynamic and recalculates on the most recent bar; therefore, it is best used to confirm momentum shifts when price action aligns with the projected harmonic direction.
🔹 Historical Fit & Forecast
The script displays a solid line over the historical lookback period, representing how well the harmonic model fits the actual price data. Beyond the current bar, a dotted line extends the forecast. This forecast is color-coded: green represents projected upward movement, while red represents projected downward movement. The forecast should be viewed primarily as a timing tool rather than an exact price target, as it projects where the "rhythm" of the market is heading based on current harmonics.
🔹 Trend Line & Reversal Markers
A linear trend line is calculated alongside the sinusoids to show the overall bias (slope) of the lookback period. Additionally, the indicator can plot reversal markers (dots) at the specific points where the forecasted cycles reach a peak or trough. These markers highlight potential future turning points where the composite cycles converge to create a local maximum or minimum.
🔹 Detected Cycles Table
The "Detected Cycles" dashboard allows traders to identify if current price action is dominated by short-term "noise" cycles or larger "structural" cycles. By observing the period lengths (in bars), users can determine the frequency of market swings. If the detected periods are small relative to the lookback, the market is in a high-frequency state; if they are large, the market is exhibiting more stable, long-term cyclicality.
🔶 DETAILS
The script operates through a two-step mathematical process involving spectral analysis and matrix-based regression:
Periodogram Logic (Cycle Detection): The indicator first detrends the data within the lookback window using a linear fit. It then performs a spectral analysis by scanning a range of periods to calculate "spectral power" (the correlation between price and a specific frequency). It identifies "spectral peaks" where price variance is most concentrated, ensuring that only the most meaningful cycles are selected for modeling rather than random noise.
Multi-Harmonic OLS Regression: Once the dominant periods are identified, the script uses Ordinary Least Squares (OLS) regression to solve for the coefficients of a linear combination of basis functions. Specifically, it constructs a model consisting of multiple sine and cosine waves (representing the cycles) and a first-order polynomial (representing the trend). By solving the normal equation using matrix math, the script finds the optimal amplitudes and phases that minimize the squared error against historical price. This composite model is then solved for future time coordinates to create the extrapolation.
🔶 SETTINGS
🔹 Settings
Fit Lookback (N): Determines the number of historical bars used to analyze cycles and fit the model.
Extrapolation Bars: Sets how many bars into the future the forecast should extend.
Number of Sinusoids: The maximum number of individual cycles to include in the composite model (1-10).
🔹 Automatic Cycle Detection
Min Period: The shortest cycle length (in bars) the algorithm is allowed to detect.
🔹 Visuals
Show Reversal Dots: Toggles the markers at forecasted local highs and lows.
Dot Size: Adjusts the visual scale of the reversal markers.
Show Detected Periods: Toggles the data table showing the lengths of the dominant cycles.
🔹 Trend Line
Show Trend Line: Toggles the display of the underlying linear regression line.
Trend Line Color: Sets the color for the historical and projected trend line.
Indicator

Harmonic Resonance Oscillator [LuxAlgo]The Harmonic Resonance Oscillator indicator provides a specialized oscillator that decomposes price action into multiple harmonic cycles to identify confluence in market rotations.
By isolating short, medium, and long-term frequencies, the tool aims to pinpoint exhausted price movements and potential reversal zones through the concept of cyclic resonance.
🔶 USAGE
The Harmonic Resonance Oscillator can be used to identify market turning points by observing when the aggregate cycle resonance reaches extreme levels. Unlike standard oscillators that rely on a single lookback period, this tool aggregates multiple filtered cycles to provide a more robust view of market momentum and exhaustion.
When the oscillator enters the dynamic overbought (upper) or oversold (lower) zones, it indicates that the various price cycles are aligning at an extreme, often preceding a corrective move or a trend reversal.
🔹 Harmonic Multipliers
The script uses a Reference Period combined with three multipliers to define the cycles:
The Short Multiplier captures fast, intraday-style fluctuations.
The Medium Multiplier focuses on the primary trend rhythm.
The Long Multiplier tracks broader market cycles.
When all three cycles reach peak or trough levels simultaneously, the oscillator displays a "resonance" peak, which is highlighted by background coloring if the signal exceeds the dynamic thresholds.
🔶 DETAILS
The indicator is built upon three primary technical pillars:
🔹 Ehlers' Bandpass Filter
At its core, the indicator uses John Ehlers' Cycle decomposition method. The bandpass filter is designed to pass only price components within a specific frequency range while attenuating everything else. This allows the script to "tune in" to specific market rhythms without the lag typically associated with moving averages.
🔹 Normalization & Resonance
Each isolated cycle is normalized onto a scale of 0 to 100 using a specific lookback length. The final "Harmonic Resonance" signal is the arithmetic mean of these three normalized cycles. A value of 50 represents a neutral state, while values approaching 0 or 100 represent extreme harmonic alignment.
🔹 Dynamic Volatility-Adjusted Zones
The Overbought and Oversold thresholds are not static. They adjust dynamically based on the standard deviation of the resonance signal. During periods of high cyclic volatility, the bands expand to require stronger confluence for a signal; during low volatility, the bands contract to stay sensitive to smaller market rotations.
🔶 SETTINGS
🔹 Harmonic Settings
Reference Period: The base period used to calculate the harmonic cycles.
Short Multiplier: Multiplier applied to the reference period for the short-term cycle.
Medium Multiplier: Multiplier applied to the reference period for the medium-term cycle.
Long Multiplier: Multiplier applied to the reference period for the long-term cycle.
Bandwidth: Controls the "tightness" of the bandpass filter. Lower values isolate specific cycles more precisely.
🔹 Normalization Settings
Normalization Lookback: The window used to scale the cycles and calculate the volatility of the resonance signal.
🔹 Overbought / Oversold Control
Overbought Threshold: The base level for the upper dynamic zone (default 80).
Oversold Threshold: The base level for the lower dynamic zone (default 20).
🔹 Style
Bullish Color: Color of the oscillator when above the 50 midpoint.
Bearish Color: Color of the oscillator when below the 50 midpoint.
Overbought Color: Color of the upper dynamic threshold.
Oversold Color: Color of the lower dynamic threshold.
Show Background Highlighting: Toggles the background coloring when resonance reaches extreme levels.
Indicator

Indicator

Harmonic Frequency Visualizer [BackQuant]Harmonic Frequency Visualizer
Overview
Harmonic Frequency Visualizer is a cycle-analysis and cross-asset resonance tool that uses a simplified Discrete Fourier Transform (DFT) to measure how strongly specific cycle periods are present in price. It is not a “trend indicator” and it is not trying to predict direction by itself. Its job is to quantify rhythm: which repeating periods (in bars) are currently dominant, whether those cycles are expanding or contracting (phase direction), and whether multiple instruments are sharing the same dominant periods at the same time (resonance).
This indicator has two main output modes:
Spectrum : a frequency “snapshot” showing amplitude at each tested period for up to five instruments.
Spectrogram : a history heatmap showing how the spectrum evolves through time (for the chart instrument).
Spectrum
Spectrogram
On top of that, it produces a Dominant Cycle Oscillator derived from the dominant cycle’s phase, which gives a continuous cycle position metric (peak/trough style zones) without repainting.
This is designed for traders who want cycle context the same way they want volatility context: not as a magic signal, but as structure.
What “frequency” and “cycles” mean in trading terms
A cycle period (say 21 bars) means: “a repeating pattern that tends to complete one full oscillation every 21 bars.” If price contains such a pattern, the DFT will detect a strong correlation between price and a 21-bar sine/cosine wave.
Markets do not have perfectly stable periodic motion, but they often show:
Mean-reverting swings around value.
Trend pulses with pullback cadence.
Volatility clustering that creates rhythmic expansions and contractions.
Cycle tools are trying to measure those repeating components, and DFT is the standard mathematical way to do it.
Where DFT comes from (the core idea)
The Discrete Fourier Transform comes from Fourier analysis, a foundational signal processing concept:
Fourier’s idea : any sufficiently well-behaved signal can be expressed as a sum of sine and cosine waves at different frequencies, each with:
An amplitude (how strong that wave is).
A phase (where you are within the wave cycle).
In continuous math you get the Fourier Transform. In sampled data (like candles) you use the Discrete Fourier Transform. It converts a time series (price over time) into a frequency description (strength of different cycles).
In markets:
Time domain: candles and price series.
Frequency domain: cycle periods and their strengths.
Why sine and cosine, not just sine
A sine wave alone cannot represent every phase alignment cleanly. DFT uses both cosine and sine components because together they form an orthogonal basis that can represent any phase shift.
You can think of it like this:
Cosine component captures “in-phase” alignment with the cycle.
Sine component captures “quadrature” (90-degree shifted) alignment.
Combining them gives full information: amplitude + phase.
Mathematically, a single frequency component can be written as:
A * cos(ωt + φ)
But DFT estimates A and φ by separately accumulating cosine and sine projections.
How this script implements the DFT (and what it is actually measuring)
This is not a full-spectrum FFT across every frequency. It is a targeted DFT across a fixed set of cycle periods:
Tested periods
The script tests 8 predefined periods:
5, 8, 13, 21, 34, 55, 89, 120
These are Fibonacci-like cycle candidates commonly used in cycle/market structure work. The point is not that Fibonacci is magic. The point is that these represent a reasonable spread from short to long rhythms without needing hundreds of frequencies (which would be heavy in Pine).
Normalization step (important)
Before computing the DFT, the script normalizes the series:
mn = SMA(src, lookback)
sd = stdev(src, lookback)
norm = (src - mn) / sd (if sd != 0)
Why normalize:
DFT amplitude depends on the scale of the input series.
If you compare BTC and TLT raw prices, the magnitude is meaningless.
Z-score normalization makes amplitude more comparable across instruments and regimes.
So the spectrum is measuring “cyclical structure in standardized deviations,” not raw dollars.
Projection onto cosine and sine
For each tested period P:
ω = 2π / P (angular frequency for that period)
Compute:
- sCos = Σ(norm * cos(ωk))
- sSin = Σ(norm * sin(ωk))
Interpretation:
You are correlating the last window of normalized price with a cosine wave of period P.
And also correlating it with a sine wave of period P.
If the price has a strong P-bar rhythm, these sums grow in magnitude.
Window length detail
The script uses:
window = min(lookback - 1, 99)
So even if lookback is 200, the internal DFT accumulation caps at 100 bars for performance stability. This is a deliberate trade: stable computation in Pine, while still letting you define normalization lookback and overall context.
Amplitude computation
Once sCos and sSin are computed:
raw magnitude = sqrt(sCos² + sSin²)
This is the length of the vector (sCos, sSin). That vector length is the standard way to combine the orthogonal components into one strength metric.
Then it scales it into a 0–100 “display amplitude”:
amp = sqrt(sCos² + sSin²) / lookback * 100 * sensitivity
amp is capped to 100
So:
Higher amplitude means stronger alignment with that cycle period.
Sensitivity is a user control to amplify or damp the display scaling.
Important: amplitude here is not a probability, and it is not guaranteed “signal quality.” It is a standardized “how much of that cycle exists in the recent window” metric.
Phase computation
Phase is computed using atan2(sSin, sCos). That matters because:
A simple atan(sin/cos) fails in different quadrants.
atan2 correctly resolves the angle from -π to +π.
Phase tells you where you are within the cycle:
Two cycles can have same amplitude but opposite phase.
Phase is what lets you infer “approaching peak vs trough” behavior.
Dominant cycle selection
The script chooses the dominant cycle as the period with the highest amplitude among the tested periods:
domIdx = argmax(amp )
domAmp = max amplitude
domPhase = phase at domIdx
This dominant cycle is used for:
Spectrogram history matrix (chart symbol).
Dominant cycle oscillator.
Data window outputs (dominant period, oscillator value).
Spectrum View: what you see and how to read it
In Spectrum mode, the indicator draws a frequency snapshot for up to five instruments. Each instrument gets a spectrum line (or bars/area depending on style) plotted across the 8 periods on the x-axis, with amplitude (0–100) on the y-axis.
X-axis meaning
Each x position corresponds to a period (5 → 120 bars). You are not looking at “frequency in Hz.” You are looking at “period in bars,” which is more intuitive in trading.
Y-axis meaning
Amplitude is a scaled measure of how strongly that period is present in the recent normalized data. Higher means stronger.
Plot styles
Waveform: connects amplitude points into a continuous shape, best for seeing spectrum shape.
Bars: draws vertical bars per period, best for quick comparison.
Area: similar to waveform but filled toward baseline for emphasis.
Dominant peaks and phase direction labels
The script highlights dominant cycles per symbol (if enabled):
If max amplitude > 20, it labels that peak with the symbol name.
If Show Phase Direction is enabled, it appends ▲ or ▼.
Phase direction logic:
rising = sin(phase) < 0
▲ means cycle is in a “rising” phase segment
▼ means cycle is in a “falling” phase segment
This is not “price will rise now.” It is “the dominant cycle’s instantaneous phase suggests you are on the upward vs downward half of that oscillation.” In real markets, you use this as context, not as a standalone trade trigger.
It also draws small ▲/▼ markers on secondary peaks (amp > 15) to show phase direction of other meaningful cycles, giving you a richer picture than “one dominant period.”
Resonance Zones: cross-asset harmonic alignment
Resonance is where this tool becomes more than a single-chart curiosity.
What resonance means here
A resonance zone is flagged when at least 3 out of 5 instruments have strong amplitude at the same tested period. Mechanically:
For each period i:
- Count instruments with amp > 30
- If count >= 3, mark resonance at that period
When resonance is detected:
A vertical highlight box is drawn behind that period.
A ⚡ marker is printed at the top.
Interpretation:
Multiple assets are expressing a similar cycle length at the same time.
This can indicate macro rhythm, shared liquidity timing, or cross-market synchronization.
This is especially useful when your instrument set includes:
Rates proxy (TLT), commodities (oil, gold), and crypto indices.
You can visually spot when markets are “vibrating” together at a shared period.
Resonance is not automatically bullish or bearish. It is telling you “cycle length agreement,” which can help with timing models and contextual trade planning.
Spectrogram View: frequency over time
Spectrum mode is a snapshot. Spectrogram mode adds time evolution.
What a spectrogram is
A spectrogram is a 2D heatmap where:
Rows = different periods (frequency bands).
Columns = time history (bars ago → now).
Color = amplitude strength.
This allows you to see:
Which cycles are persistent vs fleeting.
When dominant cycle shifts occur (energy moves from one period to another).
Cycle regime transitions (short cycles dominating in chop vs longer cycles dominating in trend).
How the script builds the spectrogram matrix
It maintains a matrix with:
NUM_PERIODS rows (8 periods)
histBars columns (history length)
Each bar:
Remove the oldest column.
Append the newest amplitude array from chartSpec.
So the spectrogram is always a rolling history of the chart symbol’s cycle amplitudes. It does not attempt to store five symbols (too heavy), it focuses on the active chart for time evolution.
Heat coloring
Amplitude values map to a custom gradient:
Low = dark blue
Mid = blue/cyan to orange
High = yellow
This makes dominant energy bands visually obvious. A stable bright band means persistent cycle dominance.
Dominant Cycle Oscillator: phase mapped to a 0–100 oscillator
The oscillator is derived from the dominant cycle phase (chart symbol):
oscRaw = cos(domPhase)
oscValue = 50 + 50 * oscRaw (maps -1..1 into 0..100)
Interpretation:
When cos(phase) ≈ +1, oscillator near 100 (cycle peak zone).
When cos(phase) ≈ -1, oscillator near 0 (cycle trough zone).
Midline 50 corresponds to the quarter-cycle transition points.
It also colors the oscillator by phase direction:
oscRising = sin(domPhase) < 0
Rising phase = green-ish
Falling phase = red-ish
This gives you a clean timing reference:
The dominant period tells you the cycle length.
The oscillator tells you where you are within that cycle.
It is not forecasting price. It is telling you the current phase position of the strongest detected cycle component.
Alerts and practical timing usage
Alerts are based on the oscillator:
Cross above 80: dominant cycle entering peak zone.
Cross below 20: dominant cycle entering trough zone.
Cross 50: midline cross (phase transition).
In practice, you use these as “timing context” alerts, for example:
If your trend model is bullish and cycle oscillator enters trough zone, it can hint at a favorable pullback timing window.
If you are mean-reversion trading and cycle peak zone aligns with resistance, that confluence matters.
Again: cycle timing needs structure confirmation. The oscillator alone is not a trade system.
Multi-instrument design and non-repaint behavior
The indicator requests five external instruments via request.security. It uses:
close with lookahead_on
This forces the data to be “previous confirmed close” so the spectral calculations do not repaint intra-bar. That matters because cycle measures can change drastically within a bar if you let them use live values.
So:
Spectra for external symbols are based on confirmed historical closes.
Chart symbol spectrogram and oscillator are also stable in the sense they depend on confirmed series values (dominant phase updates bar-to-bar).
Key parameters and how they change behavior
Analysis Lookback
Affects normalization and the DFT window cap:
Higher lookback stabilizes mean/stdev normalization and reduces random shifts.
Lower lookback makes the tool more reactive but more prone to regime noise.
Because the inner DFT accumulation caps at 100 bars, very high lookback mostly affects normalization rather than the raw projection length.
Sensitivity
Scales displayed amplitude:
Higher sensitivity makes peaks stand out more.
Lower sensitivity compresses amplitude.
It is a display control, not a physics constant.
View Mode
Spectrum: cross-asset snapshot comparison, resonance detection.
Spectrogram: time evolution of cycle energy for chart symbol.
Show Phase Direction
Adds ▲/▼ markers derived from sin(phase). Useful for quick cycle position intuition, but do not treat ▲ as “buy.”
Show Resonance Zones
Marks periods where many instruments share strong energy. Useful for macro rhythm alignment.
Highlight Dominant Cycles
Labels peaks. If you disable it, the chart becomes cleaner but less informative.
Spectrogram History
Controls how many columns are stored. Higher makes a longer heatmap but costs more drawing.
Limitations and what not to assume
This tool is honest DSP applied to market data, but market data is not a stationary sine wave generator. Key limitations:
Cycles drift. Dominant period can shift as regime changes.
The tool only tests 8 candidate periods. If the true dominant period is 30, it will express as energy near 34 or distributed across neighbors.
Normalization helps comparability, but does not make amplitude “absolute truth.”
DFT assumes a stable frequency over the window. Markets often violate that.
Phase-based oscillators are timing aids, not predictors.
This is why the indicator is best used as:
Context for entries/exits, not a standalone system.
A way to see when cycle energy concentrates or disperses.
A way to detect when multiple markets share a timing rhythm.
How to use it properly (workflows)
1) Cycle regime identification
If short periods (5–13) dominate, market is often choppy, reactive, and mean-reverting.
If mid periods (21–55) dominate, market often shows swing structure.
If long periods (89–120) dominate, market can be in slower macro drift, trend legs, or compressed volatility regimes.
2) Timing layer for an existing strategy
Use your trend model to decide direction.
Use dominant cycle oscillator to decide timing within that direction.
Use spectrogram to avoid trading when dominant period is unstable or flipping rapidly.
3) Cross-asset confirmation
If you see resonance at a period, watch whether your main instrument is also showing strength there.
Resonance can justify holding a cycle-based timing thesis with more confidence because it is not isolated.
4) Expectation management
If the spectrum is flat (no peaks above threshold), that is information:
No clean dominant cycle, randomness dominates.
Cycle-based timing will be unreliable.
Summary
Harmonic Frequency Visualizer uses a targeted Discrete Fourier Transform across predefined cycle periods to measure amplitude and phase of cyclical components in price. It supports multi-instrument spectrum comparison, resonance detection when several markets share strong energy at the same periods, and a spectrogram heatmap for the chart instrument showing how cycle dominance evolves over time. A dominant cycle oscillator maps phase into a 0–100 timing readout with alerts for peak/trough/midline transitions. It is a cycle context engine designed to complement trend, structure, and risk models, not replace them. Indicator

TS Pressure OscillatorThis indicator is a TS Pressure Oscillator. Its job is to turn a lot of small “TS events” (liquidity sweeps + rejection) into a single, easy-to-read curve that helps you spot short-term exhaustion and possible trend shifts.
What it detects (TS events)
A “TS” here means a candle that:
briefly breaks the previous candle’s high and then closes back below it (bearish rejection), or
briefly breaks the previous candle’s low and then closes back above it (bullish rejection).
In simple words: price tried to continue, failed, and got rejected.
What the oscillator measures
Instead of counting every TS equally, this version gives each event a score based on its quality:
Wick size vs ATR (how meaningful the sweep was)
Body size vs ATR (how strong the rejection candle was)
Then it filters events by context:
bearish TS only matter most near the top of a recent range
bullish TS only matter most near the bottom of a recent range
After that, it combines multiple timeframes (M15 / M5 / M1) into one curve:
If bearish TS pressure dominates, the oscillator tends to move up (more rejection from above).
If bullish TS pressure dominates, the oscillator tends to move down (more rejection from below).
Why there are two lines (Main vs EMA)
Main line shows the current pressure.
EMA line is the smoothed version (the “trend” of the pressure).
The gap between them is useful: when the Main line pulls away from the EMA, it often means pressure is accelerating.
The most important part: parameters
This indicator is only as good as its tuning. The key settings control what it considers “relevant” TS events:
Zone lookback (HH/LL): defines what “top” and “bottom” mean
Zone thresholds (zoneHi / zoneLo): how strict the “extreme area” filter is
Window lengths per timeframe: how much history you’re measuring
ATR length + caps: how sensitive the scoring is
Baseline: prevents the oscillator from sticking at extremes
If your parameters are too loose, you’ll get noise.
If they’re too strict, you’ll miss opportunities.
Dialing them in for each asset/session is the difference between a “nice curve” and a useful signal.
If you want, tell me the asset (e.g., XAUUSD) and your main chart timeframe, and I’ll suggest a solid starting preset for the parameters. Indicator

Indicator

Indicator

Strategy
