I've called it the "Sommerfeldsche Indicator" because it algorithmically replicates how I personally approach trades. It is not designed to be a signal generator. Instead, it acts as a dynamic framework to visualize market structure, statistical extremes, and mean reversion targets. It combines rigid mathematics (Standard Deviation) with pivot-based market structure.
The script executes two independent calculation engines to analyze market phases:
This engine identifies local pivots and tracks the immediate reaction. Unlike standard indicators that overwrite previous states, this engine uses Arrays to manage multiple active swing levels simultaneously until they are technically invalidated or reach their statistical target.
- Mechanism: Detects Pivot Highs/Lows -> Validates the structural break -> Projects a channel based on Sigma (Standard Deviation).
- Output: Dashed horizontal lines representing active S/R traces.
This component visualizes the "Path of Least Resistance." It identifies significant structural pivots and projects a probability cone (Triangle) into the future.
- Target Calculation (Point F): The target is not arbitrary. It is calculated using:
- Volatility: 2.5x Standard Deviation (Sigma) from the anchor.
- Market Memory: Scans for historical Support/Resistance within a fixed lookback period.
- Round Numbers: Dynamic adjustment towards psychological levels.
- Logic: If price action remains within the projected triangle, the mean reversion setup remains valid.
Users may observe that anchor points do not always align perfectly with the absolute wick high/low. This is intentional behavior designed to filter market noise.
- The algorithm calculates targets based on Candle Bodies (Open/Close) rather than Wicks.
- This prevents volatility spikes and stop-hunts from distorting the statistical projection.
- Result: A more stable projection representing market consensus rather than momentary panic.
High-probability setups occur when Engine 1 (Dashed Lines) and Engine 2 (Triangle Tip) align at the same price coordinates. This indicates a statistical overlap between short-term swings and medium-term structure.
Not every projection holds - and that is valuable data in itself.
If price momentum breaks the probability cone (as seen below), the "Mean Reversion" setup is technically invalidated. However, Engine v88 (Dashed Lines) remains active and often captures the breakout targets.
- Scenario: Price invalidates the Short-Triangle with strong momentum.
- Result: The indicator detects the breakout, and price perfectly targets the upper structural traces (dashed lines) - already hit and removed in this snapshot - before the system recalculates a new Long-Structure.
Recalculated:
Pro Tip: Switching the timeframe is crucial for a holistic structural analysis. Due to the fractal nature of volatility, a "Mean Reversion" signal on a lower timeframe achieves significantly higher statistical probability when it aligns with the structural bias of a higher timeframe.
- Language: Pine Script v5
- Key Concepts:
- Arrays for persistent signal tracking
- User-Defined Types (UDT) for object-oriented structure
- Standard Deviation & Linear Regression logic
- Dynamic Line/Label management (garbage collection)
Disclaimer: This tool is a visual aid for manual trading analysis. Market structure is dynamic; targets are statistical probabilities, not guarantees.






