OPEN-SOURCE SCRIPT
3MA Alignment Ribbon [AlgoTraderPro]

3MA Alignment Ribbon [CSJ9] is a clean, visual trend-structure indicator based on the alignment of three moving averages.
Instead of focusing on crossovers, it highlights trend quality and direction by dynamically coloring the moving averages and the ribbon between them.
The goal is simple: See at a glance whether the market structure is bullish, bearish, or neutral.
⸻
How It Works
The indicator plots three moving averages (Fast, Medium, Slow) and evaluates their alignment:
The moving averages and the filled ribbon between them are automatically colored based on this alignment, making trend conditions immediately visible.
⸻
Key Features
✅Multi-MA Support
Choose between:
✅ Alignment Modes
✅ Optional Slope Filter
Filter signals by requiring the slow MA to be rising or falling, helping avoid false trend states during flat conditions.
✅ Higher Timeframe (HTF) Ribbon
Overlay the same 3MA alignment logic from a higher timeframe on your current chart:
✅ Alerts & Visual Signals
✅ Custom Styling
⸻
How to Use It
This indicator works best as:
It does not generate buy/sell signals by itself — instead, it helps you trade aligned with market structure.
⸻
Default Settings
The default lengths (50 / 100 / 200 EMA) are suitable for most markets and timeframes, including crypto, forex, indices, and equities.
Instead of focusing on crossovers, it highlights trend quality and direction by dynamically coloring the moving averages and the ribbon between them.
The goal is simple: See at a glance whether the market structure is bullish, bearish, or neutral.
⸻
How It Works
The indicator plots three moving averages (Fast, Medium, Slow) and evaluates their alignment:
- Bullish → Fast > Medium > Slow
- Bearish → Fast < Medium < Slow
- Neutral → Any other configuration
The moving averages and the filled ribbon between them are automatically colored based on this alignment, making trend conditions immediately visible.
⸻
Key Features
✅Multi-MA Support
Choose between:
- EMA (default)
- SMA
- WMA
- VWMA
- RMA
- HMA
✅ Alignment Modes
- Strict: classic Fast > Medium > Slow logic
- Tolerant: requires a minimum percentage separation between averages to reduce noise in ranging markets
✅ Optional Slope Filter
Filter signals by requiring the slow MA to be rising or falling, helping avoid false trend states during flat conditions.
✅ Higher Timeframe (HTF) Ribbon
Overlay the same 3MA alignment logic from a higher timeframe on your current chart:
- Fully optional
- Correctly calculated on the HTF itself
- Option to use confirmed HTF bars only (reduces repaint confusion)
✅ Alerts & Visual Signals
- Alerts when alignment turns Bullish, Bearish, or Neutral
- Optional on-chart markers when the alignment flips
✅ Custom Styling
- Fully customizable colors and transparency
- Designed to remain readable without cluttering the chart
⸻
How to Use It
This indicator works best as:
- A trend filter for discretionary trading
- A context tool for entries using other setups
- A market structure overlay for scalping, swing trading, or position trading
It does not generate buy/sell signals by itself — instead, it helps you trade aligned with market structure.
⸻
Default Settings
The default lengths (50 / 100 / 200 EMA) are suitable for most markets and timeframes, including crypto, forex, indices, and equities.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Code. Structure. Execution.
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ã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Code. Structure. Execution.
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.