PROTECTED SOURCE SCRIPT

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

23
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
────────────────────────────────────────────

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.