SENTINEL SHIFT ViprasolOverview
The Sentinel Shift is an original market structure and trend analysis indicator that combines Kaufman Adaptive Moving Average (KAMA) for trend detection with Break of Structure (BOS) and Change of Character (CHoCH) identification for institutional market structure shifts. It is designed for traders seeking clear trend confirmation on all timeframes, from scalping to swing trading.
How It Works
Core Trend Engine (KAMA)
Sentinel Shift uses Kaufman Adaptive Moving Average (KAMA) as its foundation. KAMA is a self-adjusting moving average that measures directional efficiency:
ER = abs(close - close ) / sum(abs(close - close ), n)
fastSC = 2.0 / (fast + 1)
slowSC = 2.0 / (slow + 1)
SC = (ER * (fastSC - slowSC) + slowSC)^2
KAMA = KAMA + SC * (close - KAMA )
KAMA responds dynamically to market conditions:
- When price moves efficiently (trending), the efficiency ratio approaches 1.0, causing KAMA to use faster smoothing constants and hug price more closely
- When price chops (ranging), the efficiency ratio approaches 0.0, causing KAMA to use slower smoothing and filter noise
Trend Detection
The current trend is determined by comparing close to KAMA:
- BULLISH: close > KAMA
- BEARISH: close < KAMA
Preset Configurations (Fast / Default / Smooth)
Three built-in presets auto-tune KAMA parameters for different timeframes:
Fast Preset (optimized for 1-15 minute scalping):
KAMA Length: 6
Fast Smoothing: 2
Slow Smoothing: 20
Default Preset (balanced for swing trading):
KAMA Length: 10
Fast Smoothing: 2
Slow Smoothing: 30
Smooth Preset (optimized for position/daily trading):
KAMA Length: 16
Fast Smoothing: 2
Slow Smoothing: 40
Pivot Detection
The indicator detects swing highs and lows using configurable lookback periods (pivLeft and pivRight):
pivHigh = ta.pivothigh(high, pivLeft, pivRight)
pivLow = ta.pivotlow(low, pivLeft, pivRight)
These pivot points form the reference levels for structure breaks.
Market Structure Tracking
Sentinel Shift maintains a continuous market structure state (bullish, bearish, or forming) by tracking the most recent swing high and swing low. A structure variable records the current directional bias:
structTrend = 1 (bullish), -1 (bearish), or 0 (neutral)
Break of Structure (BOS)
A BOS is a directional continuation that breaks a recent swing level within the same trend:
Bullish BOS: price closes above the most recent swing high while structTrend >= 0
Bearish BOS: price closes below the most recent swing low while structTrend <= 0
When a BOS fires, the indicator draws a dashed line at the structural level with a "BOS" label, and the signal is available as an alert condition.
Change of Character (CHoCH) — Trend Reversal
A CHoCH signals a reversal of trend direction — price breaks through the opposing structure level. To filter false signals, CHoCH requires a configurable number of BOS events to have fired first in the previous trend direction (BOS Required Before CHoCH Flip). For example, setting this to 1 requires at least one BOS in the prior trend before a CHoCH can flip the structure.
When a CHoCH fires, the indicator:
- Draws a solid line at the structural level with a "CHoCH" label
- Updates structTrend to the new direction
- Resets BOS counters for the new trend
- Generates a trend reversal signal (triangular plotshape at KAMA +/- 0.5 ATR)
Visualization
KAMA Line and Cloud Fill
- The KAMA line is plotted in the current trend color (bullish green / bearish red)
- A cloud fill extends between close and KAMA, providing visual depth of the trend
Bar Coloring
- All candles are colored by the trend (bullish green / bearish red), making trend direction immediately obvious
Target Pivot Lines
- The most recent swing high and low are drawn as horizontal lines (default gray)
- When price closes above/below these levels, the lines change color and stop extending forward
Dashboard
A real-time table displays:
- Trend (BULLISH / BEARISH indicator)
- Price vs KAMA (ABOVE / BELOW)
- Market Structure (BULL STRUCT / BEAR STRUCT / FORMING)
- BOS status (last event flagged)
- CHoCH status (last event flagged)
- Signal status (BUY / SELL / NONE from the trend reversal detection)
- Color Mode (CLASSIC / CUSTOM)
- Version
The dashboard is repositionable (Top Right, Top Left, Bottom Right, Bottom Left) and resizable (Tiny, Small, Normal).
Key Features
- Kaufman Adaptive Moving Average (KAMA) with self-adjusting smoothing based on directional efficiency
- Three preset timeframe configurations (Fast, Default, Smooth) for quick adaptation to scalping, swing, or position trading
- Market structure detection with configurable pivot lookback periods (pivLeft, pivRight)
- Break of Structure (BOS) identification with dashed level lines and labels
- Change of Character (CHoCH) detection with solid level lines and trend reversal signals
- Configurable BOS requirement before CHoCH flip (filters false reversals)
- KAMA-anchored pivot target lines with color change on break-through
- Cloud fill between close and KAMA for visual trend depth
- Bar coloring by trend direction
- Trend reversal signal (dual-layer triangular plotshape at location.absolute)
- Real-time dashboard with trend, structure, BOS, CHoCH, signal status, and preset mode
- Color preset selection (Classic green/red or Custom via color pickers)
- Four alert conditions (Bullish Reversal, Bearish Reversal, Bull BOS, Bear BOS) with dynamic ticker/interval insertion
- Full input groups with comprehensive tooltips for all parameters
How to Use
1. Apply to a standard candlestick chart
2. Select a Preset (Fast for scalping, Default for swing, Smooth for position trading)
3. Adjust Pivot Left/Right bars for structure sensitivity (lower = more structures, higher = fewer/stronger)
4. Configure the BOS Required Before CHoCH Flip to filter whipsaw (default 0 = immediate reversal possible)
5. Watch for KAMA trend direction and monitor the dashboard for current structure state
6. Trade BOS events within-trend continuation
7. Trade CHoCH events as trend reversals
8. Use the pivot target lines as reference levels for price reversits
Settings
Calculation Parameters
- Preset: Default, Fast, or Smooth — controls KAMA parameters for the selected timeframe
- KAMA Length: efficiency ratio lookback (controls KAMA responsiveness)
- Fast Period: KAMA fast smoothing constant (lower = faster KAMA in trends)
- Slow Period: KAMA slow smoothing constant (higher = slower KAMA in ranges)
Structure Settings
- Pivot Left Bars: bars to the left for swing high/low detection
- Pivot Right Bars: bars to the right for swing high/low detection
- Show BOS: toggle BOS level lines and labels
- Show CHoCH: toggle CHoCH level lines and labels
- Show Trend Reversal Signal: toggle triangular reversal markers
- Max Structure Levels: maximum number of BOS/CHoCH lines retained on chart
- BOS Required Before CHoCH Flip: number of BOS events required before trend can reverse via CHoCH
Target Lines
- Show Pivot Lines: toggle last swing high/low reference lines
- Pivot Line Color: color of the target lines
- Pivot Line Width: line thickness (1 = thin, 2 = medium, 3 = thick)
- Pivot Line Style: Solid, Dashed, or Dotted
Visualization Settings
- Color Preset: Classic (green/red) or Custom (enables color pickers)
- Show Cloud Fill: toggle the cloud between close and KAMA
- Color Candles: toggle bar coloring by trend
- Show KAMA Line: toggle the KAMA plot
- Bull Color: custom bullish color picker (if preset is Custom)
- Bear Color: custom bearish color picker (if preset is Custom)
Dashboard Settings
- Show Dashboard: toggle the dashboard table
- Position: Top Right, Top Left, Bottom Right, or Bottom Left
- Size: Tiny, Small, or Normal
Alerts
Four alert conditions with dynamic message insertion ({{ticker}}, {{exchange}}, {{interval}}):
1. SS — Long: Bullish CHoCH reversal signal
2. SS — Short: Bearish CHoCH reversal signal
3. SS — Bull BOS: Break of structure in bullish direction
4. SS — Bear BOS: Break of structure in bearish direction
Limitations & Disclaimer
- Sentinel Shift is an analytical tool, not a trading system. Always use proper risk management
- KAMA and pivot detection work on historical data; intra-bar updates may vary
- Structure detection depends on accurate pivot identification — results vary with timeframe and pivot sensitivity settings
- This indicator is best used on liquid instruments (stocks, forex, crypto, indices) where order flow is reliable
- Past performance does not guarantee future results. This is not financial advice.
Credits & Attribution
Sentinel Shift is an original indicator created by Viprasol. All logic — KAMA adaptive engine, pivot detection, BOS/CHoCH classification, structure tracking with configurable BOS requirement, reversal signal generation, dashboard layout, and alert conditions — is original work developed specifically for multi-timeframe market structure analysis.
Pine Script® indicator






















