OPEN-SOURCE SCRIPT
Supertrend Confirmed Close | forexs

# Supertrend Confirmed Close
Supertrend Confirmed Close is an open source modification of the classic ATR based Supertrend indicator. Its main purpose is to confirm trend reversals only after the current bar has closed, so temporary intrabar crossings do not create confirmed Buy or Sell signals.
## How it works
The indicator builds trailing volatility bands from Average True Range and a user selected price source.
Default settings:
ATR Period: 10
ATR Multiplier: 3.0
Source: HL2
ATR Method: Wilder ATR
An SMA of True Range can also be selected as an alternative ATR calculation.
During a bullish state, the lower Supertrend band trails price. During a bearish state, the upper Supertrend band trails price.
A bullish reversal is confirmed when the previous trend state is bearish and a completed bar closes above the previous bearish Supertrend band.
A bearish reversal is confirmed when the previous trend state is bullish and a completed bar closes below the previous bullish Supertrend band.
## What is different in this version
This implementation adds explicit closed bar confirmation to the reversal logic. The trend state, Buy signal, Sell signal, and direction change alerts are not confirmed until the bar is complete.
It also includes an optional "Freeze Supertrend Line Until Candle Close" setting. When enabled, the displayed active Supertrend line remains at its previous confirmed value while the realtime bar is forming, then updates when the bar closes.
Other additions include Pine Script v6 compatibility, organized inputs, optional trend change circles, trend highlighting, and separate alert conditions for bullish, bearish, and any confirmed direction change.
## Signals and alerts
BUY marks a confirmed change from a bearish Supertrend state to a bullish Supertrend state.
SELL marks a confirmed change from a bullish Supertrend state to a bearish Supertrend state.
These labels describe the indicator's trend state. They are not forecasts or guarantees of future price direction.
Alert conditions are provided for confirmed Buy, confirmed Sell, and confirmed direction changes. Users may also select TradingView's Once Per Bar Close frequency when creating an alert.
## Settings
Users can adjust the ATR period, ATR multiplier, source, and ATR calculation method. Buy and Sell labels, trend change circles, trend highlighting, and realtime line freezing can also be enabled or disabled.
## Limitations
Supertrend is a trend following method. In sideways or choppy markets it can change direction frequently and produce false or late signals.
Closed bar confirmation intentionally waits until the bar is complete. This avoids treating temporary intrabar crossings as confirmed reversals, but it can also make signals occur later than an intrabar implementation.
ATR settings materially affect sensitivity. Different symbols, market conditions, and timeframes can produce different behavior.
This indicator does not include position sizing, stop loss rules, profit targets, trade management, or performance guarantees. It should not be treated as a complete trading system.
For signal based use, apply it to standard price charts such as regular candles or bars rather than synthetic chart types whose prices do not represent directly traded market prices.
## Credits and open source reuse
This script reuses and modifies the open source SuperTrend implementation published by TradingView author KivancOzbilgic. That publication also credits everget, Alex Orekhov, for inspiration related to highlighting, signals, and alerts.
The reused Supertrend logic is credited here in accordance with TradingView's open source reuse requirements. This modified publication should remain open source unless the necessary permission for another publication mode has been obtained from the original author.
## Disclaimer
This indicator is provided for technical analysis and educational purposes only. It is not financial or investment advice. No signal or indicator can guarantee a profitable outcome.
Supertrend Confirmed Close is an open source modification of the classic ATR based Supertrend indicator. Its main purpose is to confirm trend reversals only after the current bar has closed, so temporary intrabar crossings do not create confirmed Buy or Sell signals.
## How it works
The indicator builds trailing volatility bands from Average True Range and a user selected price source.
Default settings:
ATR Period: 10
ATR Multiplier: 3.0
Source: HL2
ATR Method: Wilder ATR
An SMA of True Range can also be selected as an alternative ATR calculation.
During a bullish state, the lower Supertrend band trails price. During a bearish state, the upper Supertrend band trails price.
A bullish reversal is confirmed when the previous trend state is bearish and a completed bar closes above the previous bearish Supertrend band.
A bearish reversal is confirmed when the previous trend state is bullish and a completed bar closes below the previous bullish Supertrend band.
## What is different in this version
This implementation adds explicit closed bar confirmation to the reversal logic. The trend state, Buy signal, Sell signal, and direction change alerts are not confirmed until the bar is complete.
It also includes an optional "Freeze Supertrend Line Until Candle Close" setting. When enabled, the displayed active Supertrend line remains at its previous confirmed value while the realtime bar is forming, then updates when the bar closes.
Other additions include Pine Script v6 compatibility, organized inputs, optional trend change circles, trend highlighting, and separate alert conditions for bullish, bearish, and any confirmed direction change.
## Signals and alerts
BUY marks a confirmed change from a bearish Supertrend state to a bullish Supertrend state.
SELL marks a confirmed change from a bullish Supertrend state to a bearish Supertrend state.
These labels describe the indicator's trend state. They are not forecasts or guarantees of future price direction.
Alert conditions are provided for confirmed Buy, confirmed Sell, and confirmed direction changes. Users may also select TradingView's Once Per Bar Close frequency when creating an alert.
## Settings
Users can adjust the ATR period, ATR multiplier, source, and ATR calculation method. Buy and Sell labels, trend change circles, trend highlighting, and realtime line freezing can also be enabled or disabled.
## Limitations
Supertrend is a trend following method. In sideways or choppy markets it can change direction frequently and produce false or late signals.
Closed bar confirmation intentionally waits until the bar is complete. This avoids treating temporary intrabar crossings as confirmed reversals, but it can also make signals occur later than an intrabar implementation.
ATR settings materially affect sensitivity. Different symbols, market conditions, and timeframes can produce different behavior.
This indicator does not include position sizing, stop loss rules, profit targets, trade management, or performance guarantees. It should not be treated as a complete trading system.
For signal based use, apply it to standard price charts such as regular candles or bars rather than synthetic chart types whose prices do not represent directly traded market prices.
## Credits and open source reuse
This script reuses and modifies the open source SuperTrend implementation published by TradingView author KivancOzbilgic. That publication also credits everget, Alex Orekhov, for inspiration related to highlighting, signals, and alerts.
The reused Supertrend logic is credited here in accordance with TradingView's open source reuse requirements. This modified publication should remain open source unless the necessary permission for another publication mode has been obtained from the original author.
## Disclaimer
This indicator is provided for technical analysis and educational purposes only. It is not financial or investment advice. No signal or indicator can guarantee a profitable outcome.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.