OPEN-SOURCE SCRIPT
Madrid Ribbon with ST/TEMA Filter

How the Combination Works
The script is combined by:
Porting to Pine Script v6: The Madrid Ribbon code was updated from v4 to v6 syntax (mainly changing study() to indicator(), change() to ta.change(), and using ta. prefixes for built-in functions like ema and sma).
Integrating SuperTrend Logic: The full calculation for the Zero-lag TEMA filtered SuperTrend's final_trend was copied into the combined script. This logic determines if the market is in a confirmed 1 (Uptrend) or -1 (Downtrend) based on the combined signal of the TEMA cross and the SuperTrend.
Filtering the Ribbon Color: The Madrid Ribbon's custom coloring function, maColor, was modified to include the final_trend as a filter:
If i_st_enabled is true, the original Madrid Ribbon color (LIME/GREEN for bullish, RUBI/MAROON for bearish) is only displayed if the final_trend confirms that direction.
If the final_trend is neutral or contradicts the ribbon's direction, the MA is colored GRAY.
Input Simplification: The numerous input options for the SuperTrend's source and MA type were simplified to use close and EMA by default to avoid excessive complexity, but the main parameters like TEMA periods, ATR Multiplier, and MA length were kept as inputs.
This results in a Madrid Ribbon that only shows its standard color signals when the longer-term, double-filtered SuperTrend confirms the same trend.
The script is combined by:
Porting to Pine Script v6: The Madrid Ribbon code was updated from v4 to v6 syntax (mainly changing study() to indicator(), change() to ta.change(), and using ta. prefixes for built-in functions like ema and sma).
Integrating SuperTrend Logic: The full calculation for the Zero-lag TEMA filtered SuperTrend's final_trend was copied into the combined script. This logic determines if the market is in a confirmed 1 (Uptrend) or -1 (Downtrend) based on the combined signal of the TEMA cross and the SuperTrend.
Filtering the Ribbon Color: The Madrid Ribbon's custom coloring function, maColor, was modified to include the final_trend as a filter:
If i_st_enabled is true, the original Madrid Ribbon color (LIME/GREEN for bullish, RUBI/MAROON for bearish) is only displayed if the final_trend confirms that direction.
If the final_trend is neutral or contradicts the ribbon's direction, the MA is colored GRAY.
Input Simplification: The numerous input options for the SuperTrend's source and MA type were simplified to use close and EMA by default to avoid excessive complexity, but the main parameters like TEMA periods, ATR Multiplier, and MA length were kept as inputs.
This results in a Madrid Ribbon that only shows its standard color signals when the longer-term, double-filtered SuperTrend confirms the same trend.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。