OPEN-SOURCE SCRIPT

Flux-Tensor Singularity [FTS]

64
Flux-Tensor Singularity - Multi-Factor Market Pressure Indicator

The Flux-Tensor Singularity (FTS) is an advanced multi-factor oscillator that combines volume analysis, momentum tracking, and volatility-weighted normalization to identify critical market inflection points. Unlike traditional single-factor indicators, FTS synthesizes price velocity, volume mass, and volatility context into a unified framework that adapts to changing market regimes.

This indicator identifies extreme market conditions (termed "singularities") where multiple confirming factors converge, then uses a sophisticated scoring system to determine directional bias. It is designed for traders seeking high-probability setups with built-in confluence requirements.

THEORETICAL FOUNDATION

The indicator is built on the premise that market time is not constant - different market conditions contain varying levels of information density. A 1-minute bar during a major news event contains far more actionable information than a 1-minute bar during overnight low-volume trading. Traditional indicators treat all bars equally; FTS does not.

The theoretical framework draws conceptual parallels to physics (purely as a mental model, not literal physics):

Volume as Mass: Large volume represents significant market participation and "weight" behind price moves. Just as massive objects have stronger gravitational effects, high-volume moves carry more significance.

Price Change as Velocity: The rate of price movement through price space represents momentum and directional force.

Volatility as Time Dilation: When volatility is high relative to its historical norm, the "information density" of each bar increases. The indicator weights these periods more heavily, similar to how time dilates near massive objects in physics.

This is a pedagogical metaphor to create a coherent mental model - the underlying mathematics are standard financial calculations combined in a novel way.

MATHEMATICAL FRAMEWORK
The indicator calculates a composite singularity value through four distinct steps:
Step 1: Raw Singularity Calculation

S_raw = (ΔP × V) × γ²

Where:
ΔP = Price Velocity = close - close[1]
V = Volume Mass = log(volume + 1)
γ² = Time Dilation Factor = (ATR_local / ATR_global)²
Volume Transformation: Volume is log-transformed because raw volume can have extreme outliers (10x-100x normal). The logarithm compresses these spikes while preserving their significance. This is standard practice in volume analysis.

Volatility Weighting: The ratio of short-term ATR (5 periods) to long-term ATR (user-defined lookback) is squared to create a volatility amplification factor. When local volatility exceeds global volatility, this ratio increases, amplifying the raw singularity value. This makes the indicator regime-aware.

Step 2: Normalization
The raw singularity values are normalized to a 0-100 scale using a stochastic-style calculation:
S_normalized = ((S_raw - S_min) / (S_max - S_min)) × 100
Where S_min and S_max are the lowest and highest raw singularity values over the lookback period.

Step 3: Epsilon Compression
S_compressed = 50 + ((S_normalized - 50) / ε)
This is the critical innovation that makes the sensitivity control functional. By applying compression AFTER normalization, the epsilon parameter actually affects the final output:
ε < 1.0: Expands range (more signals)
ε = 1.0: No change (default)
ε > 1.0: Compresses toward 50 (fewer, higher-quality signals)
For example, with ε = 2.0, a normalized value of 90 becomes 70, making threshold breaches rarer and more significant.

Step 4: Smoothing
S_final = EMA(S_compressed, smoothing_period)
An exponential moving average removes high-frequency noise while preserving trend.

SIGNAL GENERATION LOGIC
When the tensor crosses above the upper threshold (default 90) or below the lower threshold (default 10), an extreme event is detected. However, the indicator does NOT immediately generate a buy or sell signal. Instead, it analyzes market context through a multi-factor scoring system:

Scoring Components:
Price Structure (+1 point): Current bar bullish/bearish
Momentum (+1 point): Price higher/lower than N bars ago
Trend Context (+2 points): Fast EMA above/below slow EMA (weighted heavier)
Acceleration (+1 point): Rate of change increasing/decreasing
Volume Multiplier (×1.5): If volume > average, multiply score
The highest score (bullish vs bearish) determines signal direction. This prevents the common indicator failure mode of "overbought can stay overbought" by requiring directional confirmation.

Signal Conditions:

A BUY signal requires:
Extreme event detection (tensor crosses threshold)
Bullish score > Bearish score
Price confirmation: Bullish candle (optional, user-controlled)
Volume confirmation: Volume > average (optional, user-controlled)
Momentum confirmation: Positive momentum (optional, user-controlled)
A SELL signal requires the inverse conditions.

INPUTS EXPLAINED - Core Parameters:
Global Horizon (Context): Default 20. Lookback period for normalization and volatility comparison. Higher values = smoother but less responsive. Lower values = more signals but potentially more noise.

Tensor Smoothing: Default 3. EMA period applied to final output. Removes "quantum foam" (high-frequency noise). Range 1-20.

Singularity Threshold: Default 90. Values above this (or below 100-threshold) trigger extreme event detection. Higher = rarer, stronger signals.

Signal Sensitivity (Epsilon): Default 1.0. Post-normalization compression factor. This is the key innovation - it actually works because it's applied AFTER normalization. Range 0.1-5.0.

Signal Interpreter Toggles:
Require Price Confirmation: Default ON. Only generates buy signals on bullish candles, sell signals on bearish candles. Reduces false signals but may delay entry.

Require Volume Confirmation: Default ON. Only signals when volume > average. Critical for stocks/crypto, less important for forex (unreliable volume data).

Use Momentum Filter: Default ON. Requires momentum agreement with signal direction. Prevents counter-trend signals.

Momentum Lookback: Default 5. Number of bars for momentum calculation. Shorter = more responsive, longer = trend-following bias.

Visual Controls:
Colors: Customizable colors for bullish flux, bearish flux, background, and event horizon.

Visual Transparency: Default 85. Master control for all visual elements (accretion disk, field lines, particles, etc.). Range 50-99. Signals and dashboard have separate controls.

Visibility Toggles: Individual on/off switches for:

Gravitational field lines (trend EMAs)
Field reversals (trend crossovers)
Accretion disk (background gradient)
Singularity diamonds (neutral extreme events)
Energy particles (volume bursts)
Event horizon flash (extreme event background)
Signal background flash
Signal Size: Tiny/Small/Normal triangle size

Signal Offsets: Separate controls for buy and sell signal vertical positioning (percentage of price)

Dashboard Settings:
Show Dashboard: Toggle on/off
Position: 9 placement options (all corners, centers, middles)
Text Size: Tiny/Small/Normal/Large
Background Transparency: 0-50, separate from visual transparency

VISUAL ELEMENTS EXPLAINED
1. Accretion Disk (Background Gradient):
A three-layer gradient background that intensifies as the tensor approaches extremes. The outer disk appears at any non-neutral reading, the inner disk activates above 70 or below 30, and the core layer appears above 85 or below 15. Color indicates direction (cyan = bullish, red = bearish). This provides instant visual feedback on market pressure intensity.

2. Gravitational Field Lines (EMAs):
Two trend-following EMAs (10 and 30 period) visualized as colored lines. These represent the "curvature" of market trend - when they diverge, trend is strong; when they converge, trend is weakening. Crossovers mark potential trend reversals.

3. Field Reversals (Circles):
Small circles appear when the fast EMA crosses the slow EMA, indicating a potential trend change. These are distinct from extreme events and appear at normal market structure shifts.

4. Singularity Diamonds:
Small diamond shapes appear when the tensor reaches extreme levels (>90 or <10) but doesn't meet the full signal criteria. These are "watch" events - extreme pressure exists but directional confirmation is lacking.

5. Energy Particles (Dots):
Tiny dots appear when volume exceeds 2× average, indicating significant participation. Color matches bar direction. These highlight genuine high-conviction moves versus low-volume drifts.

6. Event Horizon Flash:
A golden background flash appears the instant any extreme threshold is breached, before directional analysis. This alerts you to pay attention.

7. Signal Background Flash:
When a full buy/sell signal is confirmed, the background flashes cyan (buy) or red (sell). This is your primary alert that all conditions are met.

8. Signal Triangles:
The actual buy (▲) and sell (▼) markers. These only appear when ALL selected confirmation criteria are satisfied. Position is offset from bars to avoid overlap with other indicators.

DASHBOARD METRICS EXPLAINED
The dashboard displays real-time calculated values:

Event Density: Current tensor value (0-100). Above 90 or below 10 = critical. Icon changes: 🔥 (extreme high), ❄️ (extreme low), ○ (neutral).

Time Dilation (γ): Current volatility ratio squared. Values >2.0 indicate extreme volatility environments. >1.5 = elevated, >1.0 = above average. Icon: ⚡ (extreme), ⚠ (elevated), ○ (normal).

Mass (Vol): Log-transformed volume value. Compared to volume ratio (current/average). Icon: ● (>2× avg), ◐ (>1× avg), ○ (below avg).

Velocity (ΔP): Raw price change. Direction arrow indicates momentum direction. Shows the actual price delta value.

Bullish Flux: Current bullish context score. Displayed as both a bar chart (visual) and numeric value. Brighter when bullish score dominates.

Bearish Flux: Current bearish context score. Same visualization as bullish flux. These scores compete - the winner determines signal direction.

Field: Trend direction based on EMA relationship. "Repulsive" (uptrend), "Attractive" (downtrend), "Neutral" (ranging). Icon: ⬆⬇↔

State: Current market condition:
🚀 EJECTION: Buy signal active
💥 COLLAPSE: Sell signal active
⚠ CRITICAL: Extreme event, no directional confirmation
● STABLE: Normal market conditions
HOW TO USE THE INDICATOR

1. Wait for Extreme Events:
The indicator is designed to be selective. Don't trade every fluctuation - wait for tensor to reach >90 or <10. This alone is not a signal.

2. Check Context Scores:
Look at the Bullish Flux vs Bearish Flux in the dashboard. If scores are close (within 1-2 points), the market is indecisive - skip the trade.

3. Confirm with Signals:
Only act when a full triangle signal appears (▲ or ▼). This means ALL your selected confirmation criteria have been met.

4. Use with Price Structure:
Combine with support/resistance levels. A buy signal AT support is higher probability than a buy signal in the middle of nowhere.

5. Respect the Dashboard State:
When State shows "CRITICAL" (⚠), it means extreme pressure exists but direction is unclear. These are the most dangerous moments - wait for resolution.

6. Volume Matters:
Energy particles (dots) and the Mass metric tell you if institutions are participating. Signals without volume confirmation are lower probability.

MARKET AND TIMEFRAME RECOMMENDATIONS
Scalping (1m-5m):

Lookback: 10-14
Smoothing: 5-7
Threshold: 85
Epsilon: 0.5-0.7
Note: Expect more noise. Confirm with Level 2 data. Best on highly liquid instruments.
Intraday (15m-1h):

Lookback: 20-30 (default settings work well)
Smoothing: 3-5
Threshold: 90
Epsilon: 1.0
Note: Sweet spot for the indicator. High win rate on liquid stocks, forex majors, and crypto.
Swing Trading (4h-1D):

Lookback: 30-50
Smoothing: 3
Threshold: 90-95
Epsilon: 1.5-2.0
Note: Signals are rare but high conviction. Combine with higher timeframe trend analysis.
Position Trading (1D-1W):

Lookback: 50-100
Smoothing: 5-7
Threshold: 95
Epsilon: 2.0-3.0
Note: Extremely rare signals. Only trade the most extreme events. Expect massive moves.
Market-Specific Settings:

Forex (EUR/USD, GBP/USD, etc.):

Volume data is unreliable (spot forex has no centralized volume)
Disable "Require Volume Confirmation"
Focus on momentum and trend filters
News events create extreme singularities
Best on 15m-1h timeframes
Stocks (High-Volume Equities):

Volume confirmation is CRITICAL - keep it ON
Works excellently on AAPL, TSLA, SPY, etc.
Morning session (9:30-11:00 ET) shows highest event density
Earnings announcements create guaranteed extreme events
Best on 5m-1h for day trading, 1D for swing trading
Crypto (BTC, ETH, major alts):

Reduce threshold to 85 (crypto has constant high volatility)
Volume spikes are THE primary signal - keep volume confirmation ON
Works exceptionally well due to 24/7 trading and high volatility
Epsilon can be reduced to 0.7-0.8 for more signals
Best on 15m-4h timeframes
Commodities (Gold, Oil, etc.):

Gold responds to macro events (Fed announcements, geopolitical events)
Oil responds to supply shocks
Use daily timeframe minimum
Increase lookback to 50+
These are slow-moving markets - be patient
Indices (SPX, NDX, etc.):

Institutional volume matters - keep volume confirmation ON
Opening hour (9:30-10:30 ET) = highest singularity probability
Strong correlation with VIX - high VIX = more extreme events
Best on 15m-1h for day trading
WHAT MAKES THIS INDICATOR UNIQUE

1. Post-Normalization Sensitivity Control:
Unlike most oscillators where sensitivity controls don't actually work (they're applied before normalization, which then rescales everything), FTS applies epsilon compression AFTER normalization. This means the sensitivity parameter genuinely affects signal frequency. This is a novel implementation not found in standard oscillators.

2. Multi-Factor Confluence Requirement:
The indicator doesn't just detect "overbought" or "oversold" - it detects extreme conditions AND THEN analyzes context through five separate factors (price structure, momentum, trend, acceleration, volume). Most indicators are single-factor; FTS requires confluence.

3. Volatility-Weighted Normalization:
By squaring the ATR ratio (local/global), the indicator adapts to changing market regimes. A 1% move in a low-volatility environment is treated differently than a 1% move in a high-volatility environment. Traditional indicators treat all moves equally regardless of context.

4. Volume Integration at the Core:
Volume isn't an afterthought or optional filter - it's baked into the fundamental equation as "mass." The log transformation handles outliers elegantly while preserving significance. Most price-based indicators completely ignore volume.

5. Adaptive Scoring System:
Rather than fixed buy/sell rules ("RSI >70 = sell"), FTS uses competitive scoring where bullish and bearish evidence compete. The winner determines direction. This solves the classic problem of "overbought markets can stay overbought during strong uptrends."

6. Comprehensive Visual Feedback:
The multi-layer visualization system (accretion disk, field lines, particles, flashes) provides instant intuitive feedback on market state without requiring dashboard reading. You can see pressure building before extreme thresholds are hit.

7. Separate Extreme Detection and Signal Generation:
"Singularity diamonds" show extreme events that don't meet full criteria, while "signal triangles" only appear when ALL conditions are met. This distinction helps traders understand when pressure exists versus when it's actionable.

COMPARISON TO EXISTING INDICATORS

vs. RSI/Stochastic:
These normalize price relative to recent range. FTS normalizes (price change × log volume × volatility ratio) - a composite metric, not just price position.

vs. Chaikin Money Flow:
CMF combines price and volume but lacks volatility context and doesn't use adaptive normalization or post-normalization compression.

vs. Bollinger Bands + Volume:
Bollinger Bands show volatility but don't integrate volume or create a unified oscillator. They're separate components, not synthesized.

vs. MACD:
MACD is pure momentum. FTS combines momentum with volume weighting and volatility context, plus provides a normalized 0-100 scale.

The specific combination of log-volume weighting, squared volatility amplification, post-normalization epsilon compression, and multi-factor directional scoring is unique to this indicator.

LIMITATIONS AND PROPER DISCLOSURE

Not a Holy Grail:
No indicator is perfect. This tool identifies high-probability setups but cannot predict the future. Losses will occur. Use proper risk management.

Requires Confirmation:
Best used in conjunction with price action analysis, support/resistance levels, and higher timeframe trend. Don't trade signals blindly.

Volume Data Dependency:
On forex (spot) and some low-volume instruments, volume data is unreliable or tick-volume only. Disable volume confirmation in these cases.

Lagging Components:
The EMA smoothing and trend filters are inherently lagging. In extremely fast moves, signals may appear after the initial thrust.

Extreme Event Rarity:
With conservative settings (high threshold, high epsilon), signals can be rare. This is by design - quality over quantity. If you need more frequent signals, reduce threshold to 85 and epsilon to 0.7.

Not Financial Advice:
This indicator is an analytical tool. All trading decisions and their consequences are solely your responsibility. Past performance does not guarantee future results.

BEST PRACTICES
Don't trade every singularity - wait for context confirmation
Higher timeframes = higher reliability
Combine with support/resistance for entry refinement
Volume confirmation is CRITICAL for stocks/crypto (toggle off only for forex)
During major news events, singularities are inevitable but direction may be uncertain - use wider stops
When bullish and bearish flux scores are close, skip the trade
Test settings on your specific instrument/timeframe before live trading
Use the dashboard actively - it contains critical diagnostic information

Taking you to school. — Dskyz, Trade with insight. Trade with anticipation.

Penafian

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.