MTF Candles [Fadi x MMT]MTF Candles
Overview
The MTF Candles indicator is a powerful tool designed for traders who want to visualize higher timeframe (HTF) candles directly on their current chart. Built with flexibility and precision in mind, this Pine Script indicator displays up to six higher timeframe candles, complete with customizable styling, sweeps, midpoints, fair value gaps (FVGs), volume imbalances, and trace lines. It’s perfect for multi-timeframe analysis, helping traders identify key levels, market structure, and potential trading opportunities with ease.
Key Features
- Multi-Timeframe Candles : Display up to six higher timeframe candles (e.g., 5m, 15m, 30m, 4H, 1D, 1W) on your chart, with configurable timeframes and visibility.
- Sweeps Detection : Identify liquidity sweeps (highs/lows) with customizable line styles, widths, and colors, plus optional alerts for confirmed bullish or bearish sweeps.
- Midpoint Lines : Plot the midpoint (average of high and low) of the previous HTF candle, with customizable color, width, and style for enhanced market analysis.
- Fair Value Gaps (FVGs) : Highlight gaps between non-adjacent candles, indicating potential areas of interest for price action.
- Volume Imbalances : Detect and display volume imbalances between adjacent candles, aiding in spotting significant price levels.
- Trace Lines : Connect HTF candle open, close, high, and low prices to their respective chart bars, with customizable styles and optional price labels.
- Custom Daily Open Times : Support for custom daily candle open times (Midnight, 8:30, or 9:30) to align with specific market sessions.
- Dynamic Labels : Show timeframe names, remaining time until the next HTF candle, and interval labels (e.g., day of the week for daily candles) with adjustable positions and sizes.
- Highly Customizable : Fine-tune candle appearance, spacing, padding, and visual elements to suit your trading style.
How It Works
The indicator renders HTF candles as boxes (bodies) and lines (wicks) on the right side of the chart, with each timeframe offset for clarity. It dynamically updates candles in real-time, tracks their highs and lows, and displays sweeps and midpoints when conditions are met. FVGs and volume imbalances are calculated based on candle relationships, and trace lines link HTF candle levels to their originating bars on the chart.
Sweep Logic
- A bearish sweep occurs when the current candle’s high exceeds the previous candle’s high, but the close is below it.
- A bullish sweep occurs when the current candle’s low falls below the previous candle’s low, but the close is above it.
- Sweeps are visualized as horizontal lines and can trigger alerts when confirmed on the next candle.
Midpoint Logic
- A midpoint line is drawn at the average of the previous HTF candle’s high and low, extending until the next HTF candle forms.
- Useful for identifying potential support/resistance or mean reversion levels.
Imbalance Detection
- FVGs : Identified when a candle’s low is above the next-but-one candle’s high (or vice versa), indicating a price gap.
- Volume Imbalances : Detected between adjacent candles where the body of one candle doesn’t overlap with the next, signaling potential liquidity zones.
Settings
Timeframe Settings
- HTF 1–6 : Enable/disable up to six higher timeframes (default: 5m, 15m, 30m, 4H, 1D, 1W) and set the maximum number of candles to display per timeframe (default: 4).
- Limit to Next HTFs : Restrict the number of active timeframes (1–6).
Styling
- Body, Border, Wick Colors : Customize bull and bear candle colors (default: light gray for bulls, dark gray for bears).
- Candle Width : Adjust the width of HTF candles (1–4).
- Padding and Spacing : Set the offset from the current price action and spacing between candles and timeframes.
Label Settings
- HTF Label : Show/hide timeframe labels (e.g., "15m", "4H") at the top/bottom of candle sets.
- Remaining Time : Display the countdown to the next HTF candle.
Interval Value: Show day of the week for daily candles or time for intraday candles.
- Label Position/Alignment : Choose to display labels at the top, bottom, or both, and align them with the highest/lowest candles or follow individual candle sets.
Imbalance Settings
- Fair Value Gap : Enable/disable FVGs with customizable color (default: semi-transparent gray).
- Volume Imbalance : Enable/disable volume imbalances with customizable color (default: semi-transparent red).
Trace Settings
- Trace Lines : Enable/disable lines connecting HTF candle levels to their chart bars, with customizable colors, styles (solid, dashed, dotted), and sizes.
- Price Labels : Show price levels for open, close, high, and low trace lines.
- Anchor : Choose whether trace lines anchor to the first or last enabled timeframe.
Sweep Settings
- Show Sweeps : Enable/disable sweep detection and visualization.
- Sweep Line : Customize color, width, and style (solid, dashed, dotted).
- Sweep Alert : Enable alerts for confirmed sweeps.
Midpoint Settings
- Show Midpoint : Enable/disable midpoint lines.
- Midpoint Line : Customize color (default: orange), width, and style (solid, dashed, dotted).
Custom Daily Open
Custom Daily Candle Open : Choose between Midnight, 8:30, or 9:30 (America/New_York) for daily candle opens.
Usage
- Add the indicator to your TradingView chart.
- Configure the desired higher timeframes (HTF 1–6) and enable/disable features via the settings panel.
- Adjust styling, labels, and spacing to match your chart preferences.
Use sweeps, midpoints, FVGs, and volume imbalances to identify key levels for trading decisions.
- Enable sweep alerts to receive notifications for confirmed liquidity sweeps.
Notes
Performance: The indicator is optimized for up to 500 boxes, lines, and labels, with a maximum of 5000 bars back. Can be slow at a time
Time Zone: Custom daily opens use the America/New_York time zone for consistency with major financial markets.
Compatibility: Ensure selected HTFs are valid (higher than the chart’s timeframe and divisible by it for intraday periods).