OPEN-SOURCE SCRIPT
Smart Pivot Trend

█ OVERVIEW
Smart Pivot Trend is a market structure–based trend indicator that combines swing pivots, volatility adaptation (ATR), and dynamic range levels to determine which side of the market is in control — buyers or sellers. Instead of moving averages, trend direction is defined through structural breaks inside pivot ranges.
The indicator visualizes the active trend, evolving market structure, and historical support/resistance levels created at moments of control shifts. It helps identify trend transitions, structure breaks, and areas where price has an increased probability of reaction.
█ CONCEPT
Built around adaptive swing structure. The core idea is that trend emerges from market structure, not from price relative to an average.
- Swing highs and swing lows form the current structural range.
- Two internal percentage-based levels inside this range act as decision zones.
- Break above the upper level → bullish control.
- Break below the lower level → bearish control.
To prevent structure from becoming outdated during strong moves, pivots are dynamically adjusted when price deviates beyond ATR × multiplier. This mechanism makes the structure volatility-aware rather than static.
As a result, the indicator combines:
- a dynamic, living market structure (active pivot trend)
- static “market memory” levels marking previous control shifts
█ FEATURES
Calculations
- Swing pivots as the foundation of market structure
- Internal range levels as structural decision zones
- ATR-based adaptive pivot correction (volatility-aware structure)
- Smooth Factor — controls the degree of structural correction relative to price; defines how fast pivots adapt during strong moves
- Trend change detection through structural range breaks
Visualization
- Active trend line based on current structure
- Historical support/resistance levels plotted at trend flips
- Triangles marking breaks of those levels
- Gradient fill between price and the active trend line
- Trend-based coloring (green = bullish, red = bearish)
- Optional candle coloring based on current structural trend (bullish / bearish control)
Signals
- BUY / SELL — on structural trend changes
- Bullish Break / Bearish Break — when historical levels are broken
- Impulse breaks (when candles break levels with strong momentum)
Alerts
- Trend change to bullish
- Trend change to bearish
- Resistance break
- Support break
█ HOW TO USE
Main settings:
- Swing Length — sensitivity of swing detection
- Lower / Upper Level — internal structural decision levels
- ATR Length / Multiplier — influence of volatility on pivot adaptation
- Smooth Factor — speed of structural adjustment to price
- Visual options — colors, hiding lines, deleting broken levels, color candles by trend
Trend logic:
- Price above active pivot low → bullish structure
- Price below active pivot high → bearish structure
█ APPLICATION
Trend-following
- The indicator can act as a directional filter for signals from other tools.
- Entries are taken only when signals from external indicators (e.g., RSI, MACD, momentum tools, price action setups, breakout systems) align with the current Smart Pivot Trend direction.
- Highest probability occurs when entries happen during pullbacks to the active trend line in the direction of the prevailing structure.
Market structure shifts
- A trend flip represents a transfer of control between buyers and sellers.
- These moments often precede larger moves because the swing structure changes.
Breakout trading
- Historical levels mark areas where control previously changed.
- Their break often leads to volatility expansion and impulsive movement.
Pullback trading
- The active trend line acts as dynamic support/resistance.
- Pullbacks to this line in strong trends often provide favorable risk-to-reward setups.
█ ADAPTATION TO TRADING STYLE
The Swing Length and Smooth Factor parameters allow the indicator to be tailored to different trading styles:
Shorter Swing Length + higher Smooth Factor
- structure reacts faster
- more frequent trend shifts
- suitable for scalping and intraday trading
Longer Swing Length + lower Smooth Factor
- slower structural changes
- filters minor fluctuations
- better suited for swing trading and longer-term positions
This allows the indicator to function both as a fast micro-structure engine and as a stable higher-level trend filter.
█ NOTES
- This is a structural analysis tool, not a standalone trading system
- Best results come when combined with key S/R levels, higher timeframe context, and price action
- In ranging markets, trend flips may occur more frequently — a natural behavior of structure-based systems
Smart Pivot Trend is a market structure–based trend indicator that combines swing pivots, volatility adaptation (ATR), and dynamic range levels to determine which side of the market is in control — buyers or sellers. Instead of moving averages, trend direction is defined through structural breaks inside pivot ranges.
The indicator visualizes the active trend, evolving market structure, and historical support/resistance levels created at moments of control shifts. It helps identify trend transitions, structure breaks, and areas where price has an increased probability of reaction.
█ CONCEPT
Built around adaptive swing structure. The core idea is that trend emerges from market structure, not from price relative to an average.
- Swing highs and swing lows form the current structural range.
- Two internal percentage-based levels inside this range act as decision zones.
- Break above the upper level → bullish control.
- Break below the lower level → bearish control.
To prevent structure from becoming outdated during strong moves, pivots are dynamically adjusted when price deviates beyond ATR × multiplier. This mechanism makes the structure volatility-aware rather than static.
As a result, the indicator combines:
- a dynamic, living market structure (active pivot trend)
- static “market memory” levels marking previous control shifts
█ FEATURES
Calculations
- Swing pivots as the foundation of market structure
- Internal range levels as structural decision zones
- ATR-based adaptive pivot correction (volatility-aware structure)
- Smooth Factor — controls the degree of structural correction relative to price; defines how fast pivots adapt during strong moves
- Trend change detection through structural range breaks
Visualization
- Active trend line based on current structure
- Historical support/resistance levels plotted at trend flips
- Triangles marking breaks of those levels
- Gradient fill between price and the active trend line
- Trend-based coloring (green = bullish, red = bearish)
- Optional candle coloring based on current structural trend (bullish / bearish control)
Signals
- BUY / SELL — on structural trend changes
- Bullish Break / Bearish Break — when historical levels are broken
- Impulse breaks (when candles break levels with strong momentum)
Alerts
- Trend change to bullish
- Trend change to bearish
- Resistance break
- Support break
█ HOW TO USE
Main settings:
- Swing Length — sensitivity of swing detection
- Lower / Upper Level — internal structural decision levels
- ATR Length / Multiplier — influence of volatility on pivot adaptation
- Smooth Factor — speed of structural adjustment to price
- Visual options — colors, hiding lines, deleting broken levels, color candles by trend
Trend logic:
- Price above active pivot low → bullish structure
- Price below active pivot high → bearish structure
█ APPLICATION
Trend-following
- The indicator can act as a directional filter for signals from other tools.
- Entries are taken only when signals from external indicators (e.g., RSI, MACD, momentum tools, price action setups, breakout systems) align with the current Smart Pivot Trend direction.
- Highest probability occurs when entries happen during pullbacks to the active trend line in the direction of the prevailing structure.
Market structure shifts
- A trend flip represents a transfer of control between buyers and sellers.
- These moments often precede larger moves because the swing structure changes.
Breakout trading
- Historical levels mark areas where control previously changed.
- Their break often leads to volatility expansion and impulsive movement.
Pullback trading
- The active trend line acts as dynamic support/resistance.
- Pullbacks to this line in strong trends often provide favorable risk-to-reward setups.
█ ADAPTATION TO TRADING STYLE
The Swing Length and Smooth Factor parameters allow the indicator to be tailored to different trading styles:
Shorter Swing Length + higher Smooth Factor
- structure reacts faster
- more frequent trend shifts
- suitable for scalping and intraday trading
Longer Swing Length + lower Smooth Factor
- slower structural changes
- filters minor fluctuations
- better suited for swing trading and longer-term positions
This allows the indicator to function both as a fast micro-structure engine and as a stable higher-level trend filter.
█ NOTES
- This is a structural analysis tool, not a standalone trading system
- Best results come when combined with key S/R levels, higher timeframe context, and price action
- In ranging markets, trend flips may occur more frequently — a natural behavior of structure-based systems
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.