PROTECTED SOURCE SCRIPT
FIB 21/8 EMA Logic HyperTrend w/ ATR Bands & Buy/Sell Indicators

EMA LOGIC SUPERTREND
────────────────────────────────────────────
EMA Logic SuperTrend is a SuperTrend-style overlay that replaces traditional
price/ATR trend logic with a stateful, debounced EMA momentum engine.
It preserves the classic SuperTrend visuals:
- Trend bands
- Buy/Sell markers
- Background shading
But ALL trend direction is determined strictly by EMA behavior.
────────────────────────────────────────────
CORE TREND LOGIC
────────────────────────────────────────────
• Uses two EMAs (default: 8 & 21)
• GREEN (Buy Trend):
- Both EMAs rising for 2 consecutive candles
• RED (Sell Trend):
- Fast EMA falling for 2 consecutive candles
• Includes a 2-bar debounce filter to reduce whipsaw
• Uses a state machine for clean flips:
- Buy only on RED → GREEN
- Sell only on GREEN → RED
────────────────────────────────────────────
ATR BANDS (VISUAL ONLY)
────────────────────────────────────────────
• ATR is NOT used for entries or exits
• ATR ONLY controls how far the bands sit from price
• High volatility → wider bands
• Low volatility → tighter bands
• Green band = visual support guide
• Red band = visual resistance guide
────────────────────────────────────────────
VISUAL FEATURES
────────────────────────────────────────────
• SuperTrend-style trend bands
• Translucent background shading
• Buy/Sell labels shifted back one candle
• Adjustable band opacity
• Optional signal labels
• Optional background highlighting
────────────────────────────────────────────
ADJUSTABLE INPUTS
────────────────────────────────────────────
• Fast EMA Length (default: 8)
• Slow EMA Length (default: 21)
• ATR Period
• ATR Multiplier
• Band Opacity
• Show/Hide Buy & Sell Labels
• Show/Hide Background Highlighting
────────────────────────────────────────────
BEST USED FOR
────────────────────────────────────────────
• EMA-based trend following
• Momentum regime confirmation
• Clean directional bias
• Trend continuation trading
• Visual volatility-aware support/resistance
────────────────────────────────────────────
IMPORTANT NOTES
────────────────────────────────────────────
• This indicator does NOT use standard SuperTrend logic
• Price crossing the bands does NOT trigger signals
• ATR does NOT affect trade direction
• All trend changes are EMA-driven
────────────────────────────────────────────
────────────────────────────────────────────
EMA Logic SuperTrend is a SuperTrend-style overlay that replaces traditional
price/ATR trend logic with a stateful, debounced EMA momentum engine.
It preserves the classic SuperTrend visuals:
- Trend bands
- Buy/Sell markers
- Background shading
But ALL trend direction is determined strictly by EMA behavior.
────────────────────────────────────────────
CORE TREND LOGIC
────────────────────────────────────────────
• Uses two EMAs (default: 8 & 21)
• GREEN (Buy Trend):
- Both EMAs rising for 2 consecutive candles
• RED (Sell Trend):
- Fast EMA falling for 2 consecutive candles
• Includes a 2-bar debounce filter to reduce whipsaw
• Uses a state machine for clean flips:
- Buy only on RED → GREEN
- Sell only on GREEN → RED
────────────────────────────────────────────
ATR BANDS (VISUAL ONLY)
────────────────────────────────────────────
• ATR is NOT used for entries or exits
• ATR ONLY controls how far the bands sit from price
• High volatility → wider bands
• Low volatility → tighter bands
• Green band = visual support guide
• Red band = visual resistance guide
────────────────────────────────────────────
VISUAL FEATURES
────────────────────────────────────────────
• SuperTrend-style trend bands
• Translucent background shading
• Buy/Sell labels shifted back one candle
• Adjustable band opacity
• Optional signal labels
• Optional background highlighting
────────────────────────────────────────────
ADJUSTABLE INPUTS
────────────────────────────────────────────
• Fast EMA Length (default: 8)
• Slow EMA Length (default: 21)
• ATR Period
• ATR Multiplier
• Band Opacity
• Show/Hide Buy & Sell Labels
• Show/Hide Background Highlighting
────────────────────────────────────────────
BEST USED FOR
────────────────────────────────────────────
• EMA-based trend following
• Momentum regime confirmation
• Clean directional bias
• Trend continuation trading
• Visual volatility-aware support/resistance
────────────────────────────────────────────
IMPORTANT NOTES
────────────────────────────────────────────
• This indicator does NOT use standard SuperTrend logic
• Price crossing the bands does NOT trigger signals
• ATR does NOT affect trade direction
• All trend changes are EMA-driven
────────────────────────────────────────────
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.