OPEN-SOURCE SCRIPT
Adaptive Trend Sabre [BOSWaves]

Adaptive Trend Sabre [BOSWaves] - Dynamic Trailing Stop System with Tension-Based Support and Resistance Detection
Overview
Adaptive Trend Sabre [BOSWaves] is a tension-aware trend following system that tracks directional price movement through adaptive trailing stops, where band positioning dynamically adjusts based on price tension relative to the trend baseline and automatically generates support and resistance levels when extreme tension conditions are released.

Instead of relying on fixed trailing stop distances or static support/resistance plotting, trend state, band positioning, and level creation are determined through ATR-normalized tension measurement, elastic snap detection, and dynamic level management that maintains only the most relevant price zones.
This creates dynamic trend boundaries that reflect actual price tension rather than arbitrary technical levels - tightening during low-tension conditions when trend conviction is high, maintaining distance during stretched conditions when directional stress builds, and capturing snap levels at extremes to mark future support and resistance zones where price demonstrated significant elasticity.
Price is therefore evaluated relative to bands that adapt to tension dynamics and historically significant stress-release points rather than conventional fixed-distance trails.
Conceptual Framework
Adaptive Trend Sabre is founded on the principle that meaningful trend signals emerge when price maintains position relative to adaptive trailing stops that adjust based on tension dynamics, while significant support and resistance zones form at locations where extreme price tension is released back toward equilibrium.
Traditional trailing stop methods use fixed ATR multipliers that ignore the underlying tension dynamics and stress accumulation that occur during extended moves. This framework replaces static-distance logic with tension-driven band construction informed by actual price elasticity and snap behavior relative to the trend baseline.
Three core principles guide the design:
This shifts trend analysis from fixed-distance trailing stops into adaptive, tension-anchored confidence boundaries with intelligent level detection.
Theoretical Foundation
The indicator combines configurable moving average smoothing, Average True Range volatility measurement, tension-based trailing stop logic, and snap-release level detection methodology.
A user-selected MA type (HMA, EMA, SMA, WMA, DEMA, TEMA, VWMA, ALMA, LSMA) provides the trend baseline for directional reference, while ATR offers volatility-normalized scaling for distance calculation and tension measurement. Tension detection identifies when price has stretched beyond threshold distances relative to the baseline, tracking extremes and triggering level creation upon release. The trailing stop advances in favorable trend direction but never retreats, creating a dynamic risk boundary.
Four internal systems operate in tandem:
This design allows trend boundaries to reflect actual price behavior dynamics rather than reacting mechanically to fixed distance rules.
How It Works
Adaptive Trend Sabre evaluates price through a sequence of tension-aware processes:
Together, these elements form a continuously updating trend framework anchored in tension dynamics and elastic price behavior.
Interpretation
Adaptive Trend Sabre should be interpreted as tension-anchored trend boundaries with automated support/resistance detection:
Tension measurement, snap behavior, and trail dynamics outweigh isolated price movements.
Signal Logic & Visual Cues
Adaptive Trend Sabre presents three primary interaction signals:
Snap level creation provides automatic support/resistance detection when extreme tension conditions release, marking zones of proven price elasticity without manual drawing.
Alert generation covers trend state switches (bullish/bearish signals) and retest occurrences for systematic monitoring.
Strategy Integration
Adaptive Trend Sabre fits within adaptive trend-following and dynamic support/resistance approaches:
Technical Implementation Details
Optimal Application Parameters
Timeframe Guidance:
Suggested Baseline Configuration:
These suggested parameters should be used as a baseline; their effectiveness depends on the asset's volatility profile, trending characteristics, and preferred signal frequency, so fine-tuning is expected for optimal performance.
Parameter Calibration Notes
Use the following adjustments to refine behavior without altering the core logic:
Adjustments should be incremental and evaluated across multiple session types rather than isolated market conditions.
Performance Characteristics
High Effectiveness:
Reduced Effectiveness:
Integration Guidelines
Disclaimer
Adaptive Trend Sabre [BOSWaves] is a professional-grade trend following and dynamic support/resistance detection tool. It uses ATR-normalized trailing stops with tension-based snap level creation but does not predict future price movements. Results depend on market conditions, volatility characteristics, parameter selection, and disciplined execution. BOSWaves recommends deploying this indicator within a broader analytical framework that incorporates price structure, volume context, and comprehensive risk management.
Overview
Adaptive Trend Sabre [BOSWaves] is a tension-aware trend following system that tracks directional price movement through adaptive trailing stops, where band positioning dynamically adjusts based on price tension relative to the trend baseline and automatically generates support and resistance levels when extreme tension conditions are released.
Instead of relying on fixed trailing stop distances or static support/resistance plotting, trend state, band positioning, and level creation are determined through ATR-normalized tension measurement, elastic snap detection, and dynamic level management that maintains only the most relevant price zones.
This creates dynamic trend boundaries that reflect actual price tension rather than arbitrary technical levels - tightening during low-tension conditions when trend conviction is high, maintaining distance during stretched conditions when directional stress builds, and capturing snap levels at extremes to mark future support and resistance zones where price demonstrated significant elasticity.
Price is therefore evaluated relative to bands that adapt to tension dynamics and historically significant stress-release points rather than conventional fixed-distance trails.
Conceptual Framework
Adaptive Trend Sabre is founded on the principle that meaningful trend signals emerge when price maintains position relative to adaptive trailing stops that adjust based on tension dynamics, while significant support and resistance zones form at locations where extreme price tension is released back toward equilibrium.
Traditional trailing stop methods use fixed ATR multipliers that ignore the underlying tension dynamics and stress accumulation that occur during extended moves. This framework replaces static-distance logic with tension-driven band construction informed by actual price elasticity and snap behavior relative to the trend baseline.
Three core principles guide the design:
- Trend direction should be determined by adaptive trailing stop breaches that adjust to maintain optimal distance from the moving average baseline.
- Support and resistance levels should form automatically at points where extreme price tension releases, marking zones of proven price elasticity.
- Tension measurement reveals whether price is operating within normal bounds or building stress that may lead to reversal or continuation acceleration.
This shifts trend analysis from fixed-distance trailing stops into adaptive, tension-anchored confidence boundaries with intelligent level detection.
Theoretical Foundation
The indicator combines configurable moving average smoothing, Average True Range volatility measurement, tension-based trailing stop logic, and snap-release level detection methodology.
A user-selected MA type (HMA, EMA, SMA, WMA, DEMA, TEMA, VWMA, ALMA, LSMA) provides the trend baseline for directional reference, while ATR offers volatility-normalized scaling for distance calculation and tension measurement. Tension detection identifies when price has stretched beyond threshold distances relative to the baseline, tracking extremes and triggering level creation upon release. The trailing stop advances in favorable trend direction but never retreats, creating a dynamic risk boundary.
Four internal systems operate in tandem:
- Trend Baseline Engine: Computes user-selected moving average of price for directional reference and tension calculation anchor point.
- Volatility Measurement System: Calculates 14-period ATR to provide adaptive scaling that normalizes distance and tension across varying market conditions.
- Adaptive Trailing Logic: Maintains trailing stop at configurable ATR distance from baseline, advancing in trend direction but never reversing until price crosses the trail.
- Snap-Level Detection System: Monitors tension thresholds, captures price extremes during stretched conditions, and creates support/resistance lines at release points with automatic extension and break management.
This design allows trend boundaries to reflect actual price behavior dynamics rather than reacting mechanically to fixed distance rules.
How It Works
Adaptive Trend Sabre evaluates price through a sequence of tension-aware processes:
- Baseline Calculation: Selected MA type smoothing of close price creates a directional trend reference that filters short-term noise.
- ATR Distance Scaling: 14-period ATR calculation multiplied by trail factor determines optimal trailing stop distance from baseline.
- Trail Positioning: In bullish trend, trail sits below MA at ATR distance; in bearish trend, trail sits above MA at ATR distance.
- Trail Advancement Logic: Bullish trail can only rise (never fall); bearish trail can only fall (never rise), creating unidirectional risk boundary.
- Trend State Switches: Price closing below bullish trail triggers bearish state switch; price closing above bearish trail triggers bullish state switch.
- Tension Measurement: Distance between close and MA baseline divided by ATR creates normalized tension reading showing price elasticity.
- Snap Detection: When absolute tension exceeds snap threshold (default 2.0 ATR), system enters "snapped" state and begins tracking price extremes.
- Extreme Capture: During bullish snap (tension > +2.0), highest high is recorded; during bearish snap (tension < -2.0), lowest low is recorded.
- Release Identification: When tension returns below half the snap threshold after being snapped, system registers a release event at the captured extreme.
- Level Creation: Release of bullish snap creates resistance line at captured high; release of bearish snap creates support line at captured low.
- Level Management: Lines extend forward in time and are automatically deleted when price closes beyond buffer distance (0.25 ATR), maintaining only 8 most recent levels.
- Retest Detection: Price touching trail or snap levels after cooldown period marks retests, with minimum bar spacing preventing excessive plotting.
Together, these elements form a continuously updating trend framework anchored in tension dynamics and elastic price behavior.
Interpretation
Adaptive Trend Sabre should be interpreted as tension-anchored trend boundaries with automated support/resistance detection:
- Bullish Trend State (Green): Established when price remains above adaptive trailing stop, indicating sustained upward momentum with trail acting as dynamic support.
- Bearish Trend State (Red): Established when price remains below adaptive trailing stop, signaling sustained downward momentum with trail acting as dynamic resistance.
- Elastic Cloud: Visual gradient zone displays between MA baseline and trailing stop, with fill intensity reflecting current tension level - lighter when tension is low, darker when tension builds.
- Tension Dynamics: High tension (>2.0 ATR) indicates price stretched far from baseline; low tension (<1.0 ATR) indicates price operating near equilibrium.
- ◆ Buy Signals: Green diamond markers appear when trend state switches from bearish to bullish at trail crossover, indicating momentum shift to upside.
- ◆ Sell Signals: Red diamond markers appear when trend state switches from bullish to bearish at trail crossunder, signaling momentum shift to downside.
- ✦ Retest Markers: Small diamonds identify price retouching trail or support/resistance levels during bullish/bearish trends after cooldown period.
- Dotted Support Lines (Green): Horizontal levels created at bearish snap releases, marking zones where price demonstrated extreme downward elasticity.
- Dotted Resistance Lines (Red): Horizontal levels created at bullish snap releases, marking zones where price demonstrated extreme upward elasticity.
- Colored Candles: Bar coloring reflects current trend state for immediate visual reference.
Tension measurement, snap behavior, and trail dynamics outweigh isolated price movements.
Signal Logic & Visual Cues
Adaptive Trend Sabre presents three primary interaction signals:
- Buy Signal (◆): Green diamond appears when trend state switches from bearish to bullish via trailing stop crossover, suggesting momentum shift to upside with new dynamic support level established.
- Sell Signal (◆): Red diamond displays when trend state switches from bullish to bearish via trailing stop crossunder, indicating momentum shift to downside with new dynamic resistance level established.
- Retest Confirmation (✦): Small diamonds mark price revisiting trail or snap levels after cooldown period, suggesting trend continuation at established support/resistance zones.
Snap level creation provides automatic support/resistance detection when extreme tension conditions release, marking zones of proven price elasticity without manual drawing.
Alert generation covers trend state switches (bullish/bearish signals) and retest occurrences for systematic monitoring.
Strategy Integration
Adaptive Trend Sabre fits within adaptive trend-following and dynamic support/resistance approaches:
- Trail-Based Position Management: Use trailing stop as primary risk boundary - exit long positions when price closes below bullish trail, exit short positions when price closes above bearish trail.
- Snap Level Entry Refinement: Enter trends on retest of snap support/resistance levels for lower-risk entry points within established directional moves.
- Tension-Aware Sizing: Reduce position sizing during high tension periods (>2.5 ATR) as price operates in stretched conditions with elevated reversal risk.
- Multi-Level Zone Analysis: Monitor density of snap levels - clustered support/resistance zones indicate stronger price memory areas warranting attention.
- Cloud-Aligned Directional Bias: Favor trades aligning with current trend state color rather than counter-trend positions against the trail.
- Retest-Based Re-entry: Use retest signals as continuation confirmation opportunities to add to or re-enter positions within established trends.
- Multi-Timeframe Trail Confirmation: Apply higher-timeframe trend state to filter lower-timeframe entry precision, entering only when trails align across timeframes.
Technical Implementation Details
- Core Engine: Configurable MA baseline (HMA, EMA, SMA, WMA, DEMA, TEMA, VWMA, ALMA, LSMA) with 14-period ATR volatility measurement
- Trail Model: Unidirectional advancing logic with ATR-scaled distance from MA baseline
- Tension System: Normalized distance calculation with threshold-based snap detection (default 2.0 ATR)
- Level Construction: Extreme capture during snap conditions with release-triggered line creation at high/low points
- Level Management: FIFO queue with maximum capacity (default 8 levels), automatic extension, and break-based deletion with buffer zone
- Visualization: Gradient-filled elastic cloud with bar coloring, diamond signals, and extended dotted snap levels
- Signal Logic: State-switch detection with retest buffer (default 5 bars) and cooldown mechanisms
- Performance Profile: Optimized for real-time execution across all timeframes with efficient level management
Optimal Application Parameters
Timeframe Guidance:
- 1 - 5 min: Micro-trend tracking for scalping with responsive trail distance settings
- 15 - 60 min: Intraday momentum following with balanced snap threshold characteristics
- 4H - Daily: Swing-level trend identification with sustained trail protection
Suggested Baseline Configuration:
- MA Type: HMA
- MA Length: 34
- Trail Distance: 3.25 ATR
- Snap Threshold: 2.0 ATR
- Level Break Buffer: 0.25 ATR
- Maximum Levels: 8
- Show Retests: Enabled
- Retest Cooldown: 5 bars
- Bullish Color: Green (#00ff00)
- Bearish Color: Red (#ff0000)
These suggested parameters should be used as a baseline; their effectiveness depends on the asset's volatility profile, trending characteristics, and preferred signal frequency, so fine-tuning is expected for optimal performance.
Parameter Calibration Notes
Use the following adjustments to refine behavior without altering the core logic:
- Trail too close/loose: Adjust Trail Distance multiplier to modify how far the trailing stop sits from MA baseline - lower values create tighter trails with more frequent switches, higher values create looser trails with greater trend persistence.
- Excessive snap levels: Increase Snap Threshold to demand more extreme tension before snap detection activates, reducing level creation frequency.
- Missed important levels: Decrease Snap Threshold toward 1.5 ATR to capture less extreme tension releases as support/resistance zones.
- Levels breaking too easily: Increase Level Break Buffer to require price to close further beyond snap lines before deletion.
- Too many levels cluttering chart: Decrease Maximum Levels to maintain fewer historical snap zones, focusing on most recent tension releases.
- Baseline too reactive: Increase MA Length for smoother trend reference that filters more short-term noise, or switch to slower MA types (SMA, ALMA).
- Baseline too slow: Decrease MA Length for more responsive trend tracking, or switch to faster MA types (HMA, DEMA, TEMA).
- Excessive retest markers: Increase Retest Cooldown to space out retest signals and reduce visual noise.
Adjustments should be incremental and evaluated across multiple session types rather than isolated market conditions.
Performance Characteristics
High Effectiveness:
- Trending markets with clear directional persistence and sustained moves away from baseline
- Instruments with consistent volatility characteristics where ATR scaling normalizes effectively
- Momentum continuation strategies using trail as dynamic support/resistance boundary
- Swing trading approaches benefiting from automated snap level detection at tension extremes
- Breakout strategies where snap levels mark zones of proven elasticity for retest entries
Reduced Effectiveness:
- Choppy, range-bound markets with frequent trail crossovers causing whipsaw signals
- Extremely low volatility environments where snap threshold becomes difficult to breach
- News-driven or gapped markets with discontinuous price action that bypasses trail logic
- High-frequency mean-reversion dominant conditions where price oscillates around MA baseline
- Consolidation and sideways price action where trend-following methodologies inherently struggle due to lack of sustained directional movement
Integration Guidelines
- Confluence: Combine with BOSWaves structure analysis, volume indicators, or traditional support/resistance zones
- Trail Respect: Honor trailing stop as primary risk boundary - close positions when trail is breached regardless of other factors
- Level Awareness: Pay attention to snap level clusters as these represent zones of historical price memory and tension release
- Tension Monitoring: Track tension readings to identify overextended conditions (>2.5 ATR) warranting profit-taking or position reduction
- Retest Utilization: Treat retest signals as continuation confirmation opportunities rather than reversal warnings
- State Discipline: Maintain directional bias aligned with current trend state until trail breach occurs
- Multi-Timeframe Alignment: Use higher timeframe trend state as filter for lower timeframe entries to ensure confluence across time horizons
Disclaimer
Adaptive Trend Sabre [BOSWaves] is a professional-grade trend following and dynamic support/resistance detection tool. It uses ATR-normalized trailing stops with tension-based snap level creation but does not predict future price movements. Results depend on market conditions, volatility characteristics, parameter selection, and disciplined execution. BOSWaves recommends deploying this indicator within a broader analytical framework that incorporates price structure, volume context, and comprehensive risk management.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
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.