OPEN-SOURCE SCRIPT
Madrid Ribbon with ST/TEMA Filter + Hourly Trend

Madrid Moving Average Ribbon with SuperTrend/TEMA Filter + Hourly Trend Open Line
This advanced technical indicator combines three powerful trading tools into one comprehensive system for identifying trend direction, momentum, and key support/resistance levels.
📊 What's Included:
1. Madrid Moving Average Ribbon (18 EMAs/SMAs)
Displays 18 configurable moving averages (5-100 periods) creating a visual "ribbon" effect
Color-coded system: LIME (strong bullish), GREEN (bullish), MAROON (weak bearish), RED (strong bearish), GRAY (neutral/filtered)
Choose between Exponential (EMA) or Simple (SMA) moving averages
The ribbon helps identify trend strength, direction, and potential reversals
2. SuperTrend/TEMA Filter System
Zero-lag Triple Exponential Moving Average (TEMA) for fast trend detection
SuperTrend indicator using ATR-based volatility bands
Combined filter logic: Only displays ribbon colors when BOTH SuperTrend AND TEMA confirm the trend direction
Reduces false signals and whipsaw during choppy market conditions
Fully customizable parameters (Fast/Slow TEMA periods, ATR multiplier, MA length)
Can be toggled ON/OFF to see unfiltered Madrid Ribbon
3. Hourly Trend Open Line
Plots the opening price of your selected higher timeframe (default: 1-hour)
Acts as dynamic support/resistance and trend bias indicator
Background coloring: Green when price is above the line (bullish bias), Red when below (bearish bias)
Customizable timeframe from 1-minute to Daily
Great for multi-timeframe analysis and confirming trade direction
🎯 How to Use:
Trend Following: Enter long when ribbon turns LIME/GREEN, enter short when MAROON/RED
Trend Confirmation: Use the Hourly Trend Open Line to confirm direction - trade longs above the line, shorts below
Filter Noise: Enable SuperTrend/TEMA filter to remove low-probability setups in ranging markets
Exit Signals: Watch for ribbon color changes or price crossing the Hourly Trend Open Line
⚡ Alert System:
Filtered Buy Signal: When trend changes to bullish (confirmed by both SuperTrend and TEMA)
Filtered Sell Signal: When trend changes to bearish (confirmed by both SuperTrend and TEMA)
Filtered Trend Change: Any trend direction change
⚙️ Customization Options:
Toggle SuperTrend/TEMA filter on/off
Adjust TEMA periods (Fast: 22, Slow: 144 default)
Modify SuperTrend settings (ATR multiplier, MA length)
Change Hourly Trend timeframe
Customize all colors and line widths
Choose EMA or SMA for ribbon calculation
💡 Best Practices:
Works on all timeframes and instruments
Use higher timeframe Trend Open Line for swing trading
Combine with volume analysis for confirmation
Best suited for trending markets; consider disabling in tight ranges
Test settings on your specific instrument for optimal performance
📝 Note: This indicator requires the 'loxx/loxxexpandedsourcetypes/4' library for TEMA calculations.
This indicator is ideal for traders who want a comprehensive, all-in-one solution for trend identification, momentum analysis, and multi-timeframe confluence.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.