OPEN-SOURCE SCRIPT
Multi-TF 👀

### Multi-Timeframe Analysis (MTF-Analysis)
**Overview**
The Multi-Timeframe Analysis indicator is a powerful visualization tool designed for traders who incorporate multi-timeframe (MTF) strategies into their decision-making process. It overlays compact, customizable candle representations from up to four higher timeframes directly on your chart, positioned to the right of the last bar for quick reference. This allows you to monitor price action, momentum via EMAs, and key levels like Fair Value Gaps (FVGs) across multiple resolutions without switching charts. Built with efficiency in mind, it supports automatic timeframe detection, real-time updates, and a clean, non-intrusive design that enhances your trading workflow.
Ideal for day traders, swing traders, and scalpers, this indicator helps identify alignments between timeframes, spot potential reversals or continuations, and validate entries/exits based on higher-timeframe context. It leverages Pine Script v6 for smooth performance, with optimizations to handle up to 5000 bars back and extensive drawing limits.
**Key Features**
- **Multi-Timeframe Candle Display**: Renders recent candles (configurable from 5 to 100 per timeframe) from selected higher timeframes (e.g., 5m, 15m, 1H, 4H) as compact bars with customizable width, spacing, and padding. Bullish and bearish candles are color-coded for instant recognition.
- **Automatic Timeframe Adaptation**: When enabled, the indicator intelligently selects complementary timeframes based on your chart's resolution (e.g., on a 1m chart, it might show 5m, 15m, and 1H). Manual overrides are available for full control.
- **EMA Overlays**: Plots EMA9, EMA21, and EMA50 on each MTF section using a user-defined source (e.g., OHLC/4, close). EMAs can be dashed for clarity and enabled/disabled per timeframe, helping to gauge momentum and trend strength.
- **Fair Value Gaps (FVGs)**: Detects bullish (+FVG) and bearish (-FVG) gaps with a configurable lookback length (5-50 bars). Gaps are visualized as dotted boxes extending from the candle, highlighting potential support/resistance zones or imbalances.
- **Time Labels and Debugging**: Displays timestamp labels under every fourth candle for chronological context. A debug mode expands spacing and adds detailed labels (e.g., OHLC, volume, EMA values) for testing and verification.
- **Customization Options**: Extensive inputs for colors (bodies, wicks, EMAs, FVGs), label sizes/styles, and layout ensure seamless integration with your chart theme. Supports futures symbols with a time offset adjustment.
- **Performance Optimizations**: Uses arrays for efficient data management, clears drawings on realtime updates or timeframe changes, and limits buffer sizes to prevent overload.
**How to Use**
1. Add the indicator to your chart via TradingView's "Indicators" menu.
2. Configure timeframes: Enable/disable up to four TFs and set the number of candles to display. Use "Auto Timeframe" for smart defaults.
3. Adjust EMAs: Select the source type and toggle per TF to focus on relevant momentum signals (e.g., EMA9 crossovers for short-term trades).
4. Enable FVGs: Activate per TF and tweak the length to suit your market (shorter for volatile assets, longer for trends).
5. Fine-tune appearance: Modify padding, candle width, and colors to avoid clutter. Use debug mode during setup.
6. Interpret: Align your chart's price action with MTF candles—look for confluence in trends, FVGs filling as support/resistance, or EMA alignments for high-probability setups.
**Input Settings**
- **General**: Hour offset for time adjustments (useful for futures).
- **Timeframes**: Enable TFs 1-4, select resolutions (e.g., "5m"), and set candle counts. Auto mode simplifies this.
- **FVG/iFVG**: Toggle per TF, customize colors and detection length.
- **EMA**: Enable per TF, choose source, colors, and dashed style.
- **Candle Appearance**: Bull/bear colors for bodies/wicks, width/spacing/padding, label size/color.
- **Debug**: Expands view for detailed inspection.
**Notes**
- This indicator is non-repainting and updates in realtime, but performance may vary on lower timeframes with many candles—reduce counts if needed.
- FVGs are calculated locally on recent bars for efficiency; historical gaps beyond the buffer aren't shown.
- Compatible with all symbols, but best on volatile markets like forex, crypto, or indices.
- Feedback welcome—updates may include more MA types or advanced FVG filters.
Enhance your edge with multi-timeframe insights—try MTF-Analysis today!
**Overview**
The Multi-Timeframe Analysis indicator is a powerful visualization tool designed for traders who incorporate multi-timeframe (MTF) strategies into their decision-making process. It overlays compact, customizable candle representations from up to four higher timeframes directly on your chart, positioned to the right of the last bar for quick reference. This allows you to monitor price action, momentum via EMAs, and key levels like Fair Value Gaps (FVGs) across multiple resolutions without switching charts. Built with efficiency in mind, it supports automatic timeframe detection, real-time updates, and a clean, non-intrusive design that enhances your trading workflow.
Ideal for day traders, swing traders, and scalpers, this indicator helps identify alignments between timeframes, spot potential reversals or continuations, and validate entries/exits based on higher-timeframe context. It leverages Pine Script v6 for smooth performance, with optimizations to handle up to 5000 bars back and extensive drawing limits.
**Key Features**
- **Multi-Timeframe Candle Display**: Renders recent candles (configurable from 5 to 100 per timeframe) from selected higher timeframes (e.g., 5m, 15m, 1H, 4H) as compact bars with customizable width, spacing, and padding. Bullish and bearish candles are color-coded for instant recognition.
- **Automatic Timeframe Adaptation**: When enabled, the indicator intelligently selects complementary timeframes based on your chart's resolution (e.g., on a 1m chart, it might show 5m, 15m, and 1H). Manual overrides are available for full control.
- **EMA Overlays**: Plots EMA9, EMA21, and EMA50 on each MTF section using a user-defined source (e.g., OHLC/4, close). EMAs can be dashed for clarity and enabled/disabled per timeframe, helping to gauge momentum and trend strength.
- **Fair Value Gaps (FVGs)**: Detects bullish (+FVG) and bearish (-FVG) gaps with a configurable lookback length (5-50 bars). Gaps are visualized as dotted boxes extending from the candle, highlighting potential support/resistance zones or imbalances.
- **Time Labels and Debugging**: Displays timestamp labels under every fourth candle for chronological context. A debug mode expands spacing and adds detailed labels (e.g., OHLC, volume, EMA values) for testing and verification.
- **Customization Options**: Extensive inputs for colors (bodies, wicks, EMAs, FVGs), label sizes/styles, and layout ensure seamless integration with your chart theme. Supports futures symbols with a time offset adjustment.
- **Performance Optimizations**: Uses arrays for efficient data management, clears drawings on realtime updates or timeframe changes, and limits buffer sizes to prevent overload.
**How to Use**
1. Add the indicator to your chart via TradingView's "Indicators" menu.
2. Configure timeframes: Enable/disable up to four TFs and set the number of candles to display. Use "Auto Timeframe" for smart defaults.
3. Adjust EMAs: Select the source type and toggle per TF to focus on relevant momentum signals (e.g., EMA9 crossovers for short-term trades).
4. Enable FVGs: Activate per TF and tweak the length to suit your market (shorter for volatile assets, longer for trends).
5. Fine-tune appearance: Modify padding, candle width, and colors to avoid clutter. Use debug mode during setup.
6. Interpret: Align your chart's price action with MTF candles—look for confluence in trends, FVGs filling as support/resistance, or EMA alignments for high-probability setups.
**Input Settings**
- **General**: Hour offset for time adjustments (useful for futures).
- **Timeframes**: Enable TFs 1-4, select resolutions (e.g., "5m"), and set candle counts. Auto mode simplifies this.
- **FVG/iFVG**: Toggle per TF, customize colors and detection length.
- **EMA**: Enable per TF, choose source, colors, and dashed style.
- **Candle Appearance**: Bull/bear colors for bodies/wicks, width/spacing/padding, label size/color.
- **Debug**: Expands view for detailed inspection.
**Notes**
- This indicator is non-repainting and updates in realtime, but performance may vary on lower timeframes with many candles—reduce counts if needed.
- FVGs are calculated locally on recent bars for efficiency; historical gaps beyond the buffer aren't shown.
- Compatible with all symbols, but best on volatile markets like forex, crypto, or indices.
- Feedback welcome—updates may include more MA types or advanced FVG filters.
Enhance your edge with multi-timeframe insights—try MTF-Analysis today!
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.