OPEN-SOURCE SCRIPT

SwiftTrend

366
█ OVERVIEW
SwiftTrend is a trend-following indicator inspired by the classic SuperTrend, but built on a completely different calculation method — using the average candle body size and the body midpoint (bodyMid). It reacts very dynamically to changes in momentum strength. The indicator is clean, easy to read, and perfect for traders who want fast yet confirmed trend direction. By adjusting the settings, you can make signals extremely sensitive or, conversely, reduce their frequency to almost completely eliminate trend flips on minor price moves.

█ CONCEPT
The indicator was created to strike the perfect balance between signal speed and effective noise filtering.
Instead of using classic ATR and price extremes (high/low), SwiftTrend uses the average candle body size and the midpoint of the previous candle’s body as its core reference. The dynamic trend line (avgLine) is protected by a tolerance zone – the trend only changes after price closes beyond this zone. This approach delivers significantly faster reaction times than many traditional solutions while maintaining excellent resistance to false signals during ranging markets.

█ FEATURES
Data source:
- Average candle body size: SMA(|open – close|, period)
- Reference point: midpoint of the previous candle’s body (bodyMid[1])

Dynamic trend line (avgLine):
- Built using Band Multiplier
- The line is “attracted” toward price movement

Tolerance zone (margin):
- Tolerance = Tolerance Multiplier × avgBody
- Default: 2.5 (for both band and tolerance)

Trend change logic:
- Down → Up: close > avgLine + tolerance
- Up → Down: close < avgLine – tolerance

Visual signals:
- “Buy” label (green upward arrow) and “Sell” label (red downward arrow) only on confirmed trend change
- Optional soft gradient fill between trend line and price
- Optional bar coloring based on current trend
- Trend line with breaks at reversal points

Alerts:
- Buy alert – triggers only when the closing price crosses from below to above the marginLineBase
- Sell alert – triggers only when the closing price crosses from above to below the marginLineBase

█ HOW TO USE
Add to chart → paste the code in Pine Editor or search for “SwiftTrend”.
Main settings:
- Average Body Periods → default 100
- Band Multiplier → default 2.5
- Tolerance Multiplier → default 2.5 (key sensitivity parameter)
- Colors, fill, and bar coloring – fully customizable

Interpretation:
- Green line & shading = uptrend
- Red line & shading = downtrend
- Higher Tolerance Multiplier = fewer but higher-quality signals
- Tolerance Multiplier near 0 = ultra-fast signals (aggressive mode)

█ APPLICATIONS
Excellent for:
- Trend-following (enter with trend, exit on reversal)
- Breakout and momentum strategies
- Filtering consolidation and noise – thanks to the adjustable tolerance zone

Best combined with:
- Classic support/resistance levels
- Fibonacci retracements, Pivot Points, psychological round numbers
- Confirmation from oscillators (RSI, Stochastic, MACD)
- Volume or volume profile analysis

Style adaptation:
- Scalping / daytrading → lower Tolerance Multiplier (0.8–1.8) + shorter period
- Swing / position trading → higher values (2.5–5.0) + longer period

█ NOTES
- Works on all markets and timeframes
- Success depends on matching the Tolerance Multiplier to your strategy and the instrument’s volatility
- Higher multiplier & period values = fewer signals, significantly higher quality
- At Tolerance Multiplier = 0 the indicator becomes extremely responsive – perfect for aggressive momentum trading

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.