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 อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน