OPEN-SOURCE SCRIPT
SwiftTrend

█ 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
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
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.