OPEN-SOURCE SCRIPT
Drunken Bird

Inspiration for the support and resistance plateau lines came from AnotherDAPTrader.
The TSL Drunken Bird is an enhanced technical analysis tool for swing traders on TradingView, based on the original Accurate Swing Trading System by ceyhun. It generates buy and sell signals when price crosses a dynamic Trailing Stop Loss (TSL) level derived from recent highs and lows. This version introduces plateau detection for support and resistance lines, dynamic label expiration to reduce clutter, customizable line styles and decay, and improved HTF confluence for trend-aligned trading. Visual elements include signal labels, horizontal lines, a colored TSL plot, and optional bar/background coloring. Alerts are available for buy/sell crossovers, making it suitable for assets like NASDAQ E-mini futures, stocks, forex, and more.
This script adapts and expands upon ceyhun's original codetradingview.com, adding significant features such as tolerance-based plateau identification for support/resistance, label management with timeframe-aware expiration (~7 days), cross-count decay for lines, and expanded customization options. Inspiration for the support and resistance plateau lines came from AnotherDAPTrader. Released under the Mozilla Public License 2.0.Key
Features
Swing Signals: "BUY" and "SELL" labels on price crossovers/crossunders of the TSL, with a user-defined lookback (default 3).
HTF Confluence: Filters signals based on higher timeframe trend (e.g., "EXIT LONG" instead of "SELL" if HTF is bullish); toggleable.
HTF Options: Select from 5m, 15m, 30m, 1h, 4h, Daily, Weekly, or Monthly.
Plateau Detection: Identifies flat highs/lows (with tolerance) for resistance/support lines, plotted as dotted/solid/dashed with customizable colors, thickness, and decay after crosses (default 2).
Horizontal Lines: Green (buy) and red (sell) lines at signal closes, extending right until crossed; toggle between short (no extension limit) or long visualization.
TSL Visualization: Colored line (green if close >= TSL, red otherwise) for dynamic levels.
Bar/Background Coloring: Optional green/red coloring based on price vs. TSL.
Label Expiration: All labels (signals and plateaus) auto-delete after ~7 days (timeframe-adjusted, default 1008 bars).
Alerts: Triggers for "Buy Signal" and "Sell Signal" on crossovers.
How to Use
Add to Chart: Paste the Pine Script into TradingView's editor and add to your chart.
Configure Settings:
Swing: Lookback for highs/lows (min 1).
Plateau Tolerance: Flatness allowance (default 0.0).
Use HTF Confluence: Enable for trend filtering.
Higher Time Frame: Choose timeframe string.
Barcolor/Bgcolor: Toggle coloring.
Show Plateau Lines: Enable support/resistance.
Line Styles/Colors/Thickness: Customize buy/sell and plateau visuals.
Plateau Line Decay: Crosses before stopping extension.
Label Expiration: Bars for auto-deletion (~7 days).
Interpret Elements:
Labels: "BUY"/"SELL" (green/red), "EXIT SHORT"/"EXIT LONG" (orange) on signals; "Res"/"Sup" on plateaus.
Lines: Extend right until conditions met (cross for buy/sell, decay threshold for plateaus).
TSL Plot: Monitors trend shifts.
Set Alerts: Use "Buy Signal" or "Sell Signal" conditions for notifications.
Testing: Apply to volatile assets; adjust Swing for signal frequency, tolerance for plateau sensitivity.
Ideal Use Cases
Swing trading on 1m–1h charts for entries/exits aligned with HTF trends.
Identifying support/resistance in ranging markets via plateaus.
Scalping with short lookbacks or longer swings with HTF enabled.
Manual or alert-based trading on futures, stocks, or forex.
Why It's Valuable
This indicator builds on ceyhun's core TSL logic with practical enhancements for modern trading: clutter reduction via expiration/decay, visual customization, and plateau-based S/R for better context. It promotes disciplined, trend-aware decisions while maintaining simplicity.
Note: Optimized for any timeframe/asset; test in demo. Not financial advice—use with risk management.
The TSL Drunken Bird is an enhanced technical analysis tool for swing traders on TradingView, based on the original Accurate Swing Trading System by ceyhun. It generates buy and sell signals when price crosses a dynamic Trailing Stop Loss (TSL) level derived from recent highs and lows. This version introduces plateau detection for support and resistance lines, dynamic label expiration to reduce clutter, customizable line styles and decay, and improved HTF confluence for trend-aligned trading. Visual elements include signal labels, horizontal lines, a colored TSL plot, and optional bar/background coloring. Alerts are available for buy/sell crossovers, making it suitable for assets like NASDAQ E-mini futures, stocks, forex, and more.
This script adapts and expands upon ceyhun's original codetradingview.com, adding significant features such as tolerance-based plateau identification for support/resistance, label management with timeframe-aware expiration (~7 days), cross-count decay for lines, and expanded customization options. Inspiration for the support and resistance plateau lines came from AnotherDAPTrader. Released under the Mozilla Public License 2.0.Key
Features
Swing Signals: "BUY" and "SELL" labels on price crossovers/crossunders of the TSL, with a user-defined lookback (default 3).
HTF Confluence: Filters signals based on higher timeframe trend (e.g., "EXIT LONG" instead of "SELL" if HTF is bullish); toggleable.
HTF Options: Select from 5m, 15m, 30m, 1h, 4h, Daily, Weekly, or Monthly.
Plateau Detection: Identifies flat highs/lows (with tolerance) for resistance/support lines, plotted as dotted/solid/dashed with customizable colors, thickness, and decay after crosses (default 2).
Horizontal Lines: Green (buy) and red (sell) lines at signal closes, extending right until crossed; toggle between short (no extension limit) or long visualization.
TSL Visualization: Colored line (green if close >= TSL, red otherwise) for dynamic levels.
Bar/Background Coloring: Optional green/red coloring based on price vs. TSL.
Label Expiration: All labels (signals and plateaus) auto-delete after ~7 days (timeframe-adjusted, default 1008 bars).
Alerts: Triggers for "Buy Signal" and "Sell Signal" on crossovers.
How to Use
Add to Chart: Paste the Pine Script into TradingView's editor and add to your chart.
Configure Settings:
Swing: Lookback for highs/lows (min 1).
Plateau Tolerance: Flatness allowance (default 0.0).
Use HTF Confluence: Enable for trend filtering.
Higher Time Frame: Choose timeframe string.
Barcolor/Bgcolor: Toggle coloring.
Show Plateau Lines: Enable support/resistance.
Line Styles/Colors/Thickness: Customize buy/sell and plateau visuals.
Plateau Line Decay: Crosses before stopping extension.
Label Expiration: Bars for auto-deletion (~7 days).
Interpret Elements:
Labels: "BUY"/"SELL" (green/red), "EXIT SHORT"/"EXIT LONG" (orange) on signals; "Res"/"Sup" on plateaus.
Lines: Extend right until conditions met (cross for buy/sell, decay threshold for plateaus).
TSL Plot: Monitors trend shifts.
Set Alerts: Use "Buy Signal" or "Sell Signal" conditions for notifications.
Testing: Apply to volatile assets; adjust Swing for signal frequency, tolerance for plateau sensitivity.
Ideal Use Cases
Swing trading on 1m–1h charts for entries/exits aligned with HTF trends.
Identifying support/resistance in ranging markets via plateaus.
Scalping with short lookbacks or longer swings with HTF enabled.
Manual or alert-based trading on futures, stocks, or forex.
Why It's Valuable
This indicator builds on ceyhun's core TSL logic with practical enhancements for modern trading: clutter reduction via expiration/decay, visual customization, and plateau-based S/R for better context. It promotes disciplined, trend-aware decisions while maintaining simplicity.
Note: Optimized for any timeframe/asset; test in demo. Not financial advice—use with risk management.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。