Multi-Timeframe Continuity Custom Candle Confirmation

Overview
The Timeframe Continuity Indicator is a versatile tool designed to help traders identify alignment between their current chart’s candlestick direction and higher timeframes of their choice. By coloring bars on the current chart (e.g., 1-minute) based on the directional alignment with selected higher timeframes (e.g., 10-minute, daily), this indicator provides a visual cue for confirming trends across multiple timeframes—a concept known as Timeframe Continuity. This approach is particularly useful for day traders, swing traders, and scalpers looking to ensure their trades align with broader market trends, reducing the risk of trading against the prevailing momentum.
Originality and Usefulness
This indicator is an original creation, built from scratch to address a common challenge in trading: ensuring that price action on a lower timeframe aligns with the trend on higher timeframes. Unlike many trend-following indicators that rely on moving averages, oscillators, or other lagging metrics, this script directly compares the bullish or bearish direction of candlesticks across timeframes. It introduces the following unique features:
- Customizable Timeframes: Users can select from a range of higher timeframes (5m, 10m, 15m, 30m, 1h, 2h, 4h, 1d, 1w, 1M) to check for alignment, making it adaptable to various trading styles.
- Neutral Candle Handling: The script accounts for neutral candles (where close == open) on the current timeframe by allowing them to inherit the direction of the higher timeframe, ensuring continuity in trend visualization.
- Table: A table displays the direction of each selected timeframe and the current timeframe, helping identify direction in the event you don't want to color bars.
- Toggles for Flexibility: Options to disable bar coloring and the debug table allow users to customize the indicator’s visual output for cleaner charts or focused analysis.
This indicator is not a mashup of existing scripts but a purpose-built tool to visualize timeframe alignment directly through candlestick direction, offering traders a straightforward way to confirm trend consistency.
What It Does
The Timeframe Continuity Indicator colors bars on your chart when the direction of the current timeframe’s candlestick (bullish, bearish, or neutral) aligns with the direction of the selected higher timeframes:
- Lime: The current bar (e.g., 1m) is bullish or neutral, and all selected higher timeframes (e.g., 10m) are bullish.
- Pink: The current bar is bearish or neutral, and all selected higher timeframes are bearish.
- Default Color: If the directions don’t align (e.g., 1m bar is bearish but 10m is bullish), the bar remains the default chart color.
The indicator also includes a debug table (toggleable) that shows the direction of each selected timeframe and the current timeframe, helping traders diagnose alignment issues.
How It Works
The script uses the following methodology:
1. Direction Calculation: For each timeframe (current and selected higher timeframes), the script determines the candlestick’s direction:
- Bullish (1): close > open / Bearish (-1): close < open /
- Neutral (0): close == open
- Higher timeframe directions are fetched using Pine Script’s request.security function, ensuring accurate data retrieval.
2. Alignment Check: The script checks if all selected higher timeframes are uniformly bullish (full_bullish) or bearish (full_bearish).
- o A higher timeframe must have a clear direction (bullish or bearish) to trigger coloring. If any selected timeframe is neutral, alignment fails, and no coloring occurs.
3. Coloring Logic: The current bar is colored only if its direction aligns with the higher timeframes:
- Lime if the higher timeframes are bullish and the current bar is bullish or neutral.
- Maroon if the higher timeframes are bearish and the current bar is bearish or neutral.
- If the current bar’s direction opposes the higher timeframe (e.g., 1m bearish, 10m bullish), the bar remains uncolored.
- Users can disable bar coloring entirely via the settings, leaving bars in their default chart color.
4. Direction Table:
- A table in the top-right corner (toggleable) displays the direction of each selected timeframe and the current timeframe, using color-coded labels (green for bullish, red for bearish, gray for neutral).
- This feature helps traders understand why a bar is or isn’t colored, making the indicator accessible to users unfamiliar with Pine Script.
How to Use
1. Add the Indicator: Add the "Timeframe Continuity Indicator" to your chart in TradingView (e.g., a 1m chart of SPY).
2. Configure Settings:
- Timeframe Selection: Check the boxes for the higher timeframes you want to compare against (default: 10m). Options include 5m, 10m, 15m, 30m, 1h, 2h, 4h, 1D, 1W, and 1M. Select multiple timeframes if you want to ensure alignment across all of them (e.g., 10m and 1d).
- Enable Bar Coloring: Default: true (bars are colored lime or maroon when aligned). Set to false to disable coloring and keep the default chart colors.
- Show Table: Default: true (table is displayed in the top-right corner). Set to false to hide the table for a cleaner chart.
3. Interpret the Output:
- Colored Bars: Lime bars indicate the current bar (e.g., 1m) is bullish or neutral, and all selected higher timeframes are bullish. Maroon bars indicate the current bar is bearish or neutral, and all selected higher timeframes are bearish. Uncolored bars (default chart color) indicate a mismatch (e.g., 1m bar is bearish while 10m is bullish) or no coloring if disabled.
- Direction Table: Check the table to see the direction of each selected timeframe and the current timeframe.
4. Example Use Case:
- On a 1m chart of SPY, select the 10m timeframe.
- If the 10m timeframe is bearish, 1m bars that are bearish or neutral will color maroon, confirming you’re trading with the higher timeframe’s trend.
- If a 1m bar is bullish while the 10m is bearish, it remains uncolored, signaling a potential misalignment to avoid trading.
Underlying Concepts
The indicator is based on the concept of Timeframe Continuity, a strategy used by traders to ensure that price action on a lower timeframe aligns with the trend on higher timeframes. This reduces the risk of entering trades against the broader market direction. The script directly compares candlestick directions (bullish, bearish, or neutral) rather than relying on lagging indicators like moving averages or RSI, providing a real-time, price-action-based confirmation of trend alignment. The handling of neutral candles ensures that minor indecision on the lower timeframe doesn’t interrupt the visualization of the higher timeframe’s trend.
Why This Indicator?
- Simplicity: Directly compares candlestick directions, avoiding complex calculations or lagging indicators.
- Flexibility: Customizable timeframes and toggles cater to various trading strategies.
- Transparency: The debug table makes the indicator’s logic accessible to all users, not just those who can read Pine Script.
- Practicality: Helps traders confirm trend alignment, a key factor in successful trading across timeframes.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.