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
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.