OPEN-SOURCE SCRIPT
SwiftTrend Structure

█ OVERVIEW
SwiftTrend Structure is an extended version of the SwiftTrend indicator, designed to provide more reliable trend filtering.
The biggest enhancement over the original version is the introduction of dual trend confirmation. A price crossing of the SwiftTrend line alone is no longer sufficient to change the trend direction. Instead, the move must also be confirmed by a corresponding pivot breakout (BoS/ChoCh).
This approach significantly reduces false trend reversals during ranging markets and noisy price action.
Pivot breakout detection (BoS/ChoCh) is an integral part of the indicator's logic and serves as the confirmation mechanism for trend changes. At the same time, these breakout signals can also be used independently as trade signals based on market structure.
All features of the indicator are fully optional and can be enabled or disabled independently, allowing the tool to be used either as a clean trend filter or as a more comprehensive market structure analysis tool.
█ CONCEPTS
Traditional trend-following indicators often reverse too early during consolidations or too late after a new trend has already developed.
The original SwiftTrend determines trend direction solely by the relationship between price and its dynamic trend line.
SwiftTrend Structure extends this concept by incorporating market structure analysis.
A trend reversal is confirmed only when two conditions are met:
* price breaks the SwiftTrend line,
* the corresponding pivot breakout (BoS/ChoCh) occurs.
After price crosses the trend line, the indicator does not immediately change direction. Instead, it enters a pending state, waiting for additional confirmation.
The pending state ends in one of two ways:
* the required pivot breakout (BoS/ChoCh) confirms the trend reversal,
* or price returns back into the previous trend range, canceling the pending state and keeping the existing trend unchanged.
This mechanism filters out many temporary breaks of the trend line that would otherwise generate false trend reversals.
Besides confirming trend changes, the indicator simultaneously monitors pivot breakouts using two independent pivot lengths.
This allows traders to observe both short-term and longer-term market structure.
BoS/ChoCh signals can also be used independently from the trend confirmation logic, making the indicator useful for discretionary Price Action trading.
█ FEATURES
SwiftTrend
* Average Body Periods – period used to calculate the average candle body size
* Band Multiplier – width of the SwiftTrend band
* Tolerance Multiplier – additional margin used while waiting for trend confirmation
* Uptrend Color
* Downtrend Color
* Show Trend Line
* Fill Shade
* Color Bars
* Highlight Waiting State (bgcolor)
Signals
* Show BOS/ChoCh Signals – displays pivot breakout signals
* Show Only BOS/ChoCh Signals Aligned With Trend – filters signals according to the current trend
* Show Trend Change Labels – displays Buy/Sell labels after confirmed trend changes
BoS/ChoCh Confirmation
* Confirm Trend Change With Pivot Breakout – enables dual trend confirmation
* Pivot Length #1 – first pivot detection period
* Pivot Length #2 – second pivot detection period
* Show Broken Pivot Lines – displays broken pivot levels
* Pivot Line Transparency
Unbroken Pivot Lines
* Show Unbroken Pivot Lines – displays active unbroken pivot levels
* Unbroken Pivot Lines Transparency
* Unbroken Pivot Lines Style
TP/SL
* Show TP/SL Levels – displays entry, Stop Loss and Take Profit levels
* Use ATR × For SL Instead Of %
* ATR Period For TP/SL
* ATR Multiplier For SL
* Stop Loss %
* Risk/Reward Ratio For TP1
* Risk/Reward Ratio For TP2
* Risk/Reward Ratio For TP3
TP/SL Display
Independent visibility control for:
* SL
* TP1
* TP2
* TP3
█ APPLICATIONS
SwiftTrend Structure is designed primarily as a trend filter, rather than a standalone buy/sell signal generator.
Its primary purpose is to identify the market direction with the highest probability of continuation.
For example, if:
* a momentum indicator shows bullish pressure,
* SwiftTrend Structure confirms an uptrend,
* a bullish BoS signal appears,
* and there is no significant resistance above price,
a long position may be considered based on the confluence of multiple independent factors.
The same logic can be applied when looking for short opportunities.
Using two independent pivot lengths allows simultaneous analysis of both short-term and long-term market structure.
The built-in TP/SL module provides an immediate visual risk/reward framework, making trade planning faster and more consistent.
█ NOTES
* Dual trend confirmation significantly reduces false trend reversals, although it may also delay the detection of new trends. This is a deliberate trade-off between faster reactions and higher signal quality.
* Disabling pivot confirmation makes the indicator behave similarly to the original SwiftTrend.
* Every module of the indicator can be enabled or disabled independently.
* BoS/ChoCh signals can be used both as trend confirmation and as standalone market structure signals.
* Best results are achieved when combined with market structure analysis, support and resistance zones, momentum indicators, and additional confirmation tools.
SwiftTrend Structure is an extended version of the SwiftTrend indicator, designed to provide more reliable trend filtering.
The biggest enhancement over the original version is the introduction of dual trend confirmation. A price crossing of the SwiftTrend line alone is no longer sufficient to change the trend direction. Instead, the move must also be confirmed by a corresponding pivot breakout (BoS/ChoCh).
This approach significantly reduces false trend reversals during ranging markets and noisy price action.
Pivot breakout detection (BoS/ChoCh) is an integral part of the indicator's logic and serves as the confirmation mechanism for trend changes. At the same time, these breakout signals can also be used independently as trade signals based on market structure.
All features of the indicator are fully optional and can be enabled or disabled independently, allowing the tool to be used either as a clean trend filter or as a more comprehensive market structure analysis tool.
█ CONCEPTS
Traditional trend-following indicators often reverse too early during consolidations or too late after a new trend has already developed.
The original SwiftTrend determines trend direction solely by the relationship between price and its dynamic trend line.
SwiftTrend Structure extends this concept by incorporating market structure analysis.
A trend reversal is confirmed only when two conditions are met:
* price breaks the SwiftTrend line,
* the corresponding pivot breakout (BoS/ChoCh) occurs.
After price crosses the trend line, the indicator does not immediately change direction. Instead, it enters a pending state, waiting for additional confirmation.
The pending state ends in one of two ways:
* the required pivot breakout (BoS/ChoCh) confirms the trend reversal,
* or price returns back into the previous trend range, canceling the pending state and keeping the existing trend unchanged.
This mechanism filters out many temporary breaks of the trend line that would otherwise generate false trend reversals.
Besides confirming trend changes, the indicator simultaneously monitors pivot breakouts using two independent pivot lengths.
This allows traders to observe both short-term and longer-term market structure.
BoS/ChoCh signals can also be used independently from the trend confirmation logic, making the indicator useful for discretionary Price Action trading.
█ FEATURES
SwiftTrend
* Average Body Periods – period used to calculate the average candle body size
* Band Multiplier – width of the SwiftTrend band
* Tolerance Multiplier – additional margin used while waiting for trend confirmation
* Uptrend Color
* Downtrend Color
* Show Trend Line
* Fill Shade
* Color Bars
* Highlight Waiting State (bgcolor)
Signals
* Show BOS/ChoCh Signals – displays pivot breakout signals
* Show Only BOS/ChoCh Signals Aligned With Trend – filters signals according to the current trend
* Show Trend Change Labels – displays Buy/Sell labels after confirmed trend changes
BoS/ChoCh Confirmation
* Confirm Trend Change With Pivot Breakout – enables dual trend confirmation
* Pivot Length #1 – first pivot detection period
* Pivot Length #2 – second pivot detection period
* Show Broken Pivot Lines – displays broken pivot levels
* Pivot Line Transparency
Unbroken Pivot Lines
* Show Unbroken Pivot Lines – displays active unbroken pivot levels
* Unbroken Pivot Lines Transparency
* Unbroken Pivot Lines Style
TP/SL
* Show TP/SL Levels – displays entry, Stop Loss and Take Profit levels
* Use ATR × For SL Instead Of %
* ATR Period For TP/SL
* ATR Multiplier For SL
* Stop Loss %
* Risk/Reward Ratio For TP1
* Risk/Reward Ratio For TP2
* Risk/Reward Ratio For TP3
TP/SL Display
Independent visibility control for:
* SL
* TP1
* TP2
* TP3
█ APPLICATIONS
SwiftTrend Structure is designed primarily as a trend filter, rather than a standalone buy/sell signal generator.
Its primary purpose is to identify the market direction with the highest probability of continuation.
For example, if:
* a momentum indicator shows bullish pressure,
* SwiftTrend Structure confirms an uptrend,
* a bullish BoS signal appears,
* and there is no significant resistance above price,
a long position may be considered based on the confluence of multiple independent factors.
The same logic can be applied when looking for short opportunities.
Using two independent pivot lengths allows simultaneous analysis of both short-term and long-term market structure.
The built-in TP/SL module provides an immediate visual risk/reward framework, making trade planning faster and more consistent.
█ NOTES
* Dual trend confirmation significantly reduces false trend reversals, although it may also delay the detection of new trends. This is a deliberate trade-off between faster reactions and higher signal quality.
* Disabling pivot confirmation makes the indicator behave similarly to the original SwiftTrend.
* Every module of the indicator can be enabled or disabled independently.
* BoS/ChoCh signals can be used both as trend confirmation and as standalone market structure signals.
* Best results are achieved when combined with market structure analysis, support and resistance zones, momentum indicators, and additional confirmation tools.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.