PROTECTED SOURCE SCRIPT
Multi-Period Charts

This Pine Script v6 indicator is titled "Multi-Period Charts" and is designed to provide traders with dynamic support/resistance levels, momentum-based trendlines, and shaded areas representing higher timeframes—all layered over the current chart to offer multi-timeframe market context.
🔍 Overview
The script offers a comprehensive view of market structure, combining:
Pivot-based support and resistance
Momentum-driven trendlines
MACD-style candle coloring
Higher-timeframe box overlays
Each element is modular and can be customized through inputs for different strategies and timeframes.
🧱 Key Features
1. Pivot-Based Support & Resistance Lines
Uses ta.pivothigh and ta.pivotlow to detect significant swing highs/lows.
A dynamic centerline is calculated from recent pivots.
Generates TUp and TDown bands that evolve with price action.
Determines the trend direction based on whether the price is above or below these bands.
2. Trendline Signal Support
Based on moving averages of high/low and close prices across a long period.
Draws a support line with a slope-check to determine if the market is bullish or bearish.
Support lines are color-coded to reflect the directional bias (bullish, bearish, or neutral).
3. Candle Coloring Logic
Candles are categorized into:
LongCandles (above both trend and support lines)
ShortCandles (below both lines)
NeutralCandle (between them)
Candles can also be shaded differently when they are downward candles, even within a bullish setup.
4. Multi-Timeframe Box Overlays
Automatically selects a higher timeframe (HTF) based on the current chart.
Draws boxes that represent the range of the selected HTF bar (e.g., day, week, month).
Boxes are colored based on whether price closed up or down.
Supports multiple methods to determine the top/bottom of the box:
High/Low Range (HLR)
True Range (TR)
Heikin Ashi Range (HAR)
5. Period Line
Calculates a smoothed line from the average of each HTF box’s top/bottom.
Useful for identifying long-term trend alignment.
⚙️ Inputs & Customizations
Pivot settings: Number of bars to look back and forward, factor, and spread.
Trendline settings: Moving average lengths and slope sensitivity.
HTF box settings: Resolution (manual or auto), color options, calculation method.
📈 Visual Output
Trendline and support line (optional display).
HTF range boxes (highlighting bullish or bearish sessions).
Color-coded candles indicating alignment or divergence from trend.
Invisible PeriodLine for advanced strategy developers.
💡 Use Case
This indicator is ideal for:
Swing and intraday traders who want to trade in the direction of larger trends.
Traders who rely on multi-timeframe analysis to find confluence.
Users looking to combine price structure (pivot-based) and momentum (moving average-based) for trend validation.
🔍 Overview
The script offers a comprehensive view of market structure, combining:
Pivot-based support and resistance
Momentum-driven trendlines
MACD-style candle coloring
Higher-timeframe box overlays
Each element is modular and can be customized through inputs for different strategies and timeframes.
🧱 Key Features
1. Pivot-Based Support & Resistance Lines
Uses ta.pivothigh and ta.pivotlow to detect significant swing highs/lows.
A dynamic centerline is calculated from recent pivots.
Generates TUp and TDown bands that evolve with price action.
Determines the trend direction based on whether the price is above or below these bands.
2. Trendline Signal Support
Based on moving averages of high/low and close prices across a long period.
Draws a support line with a slope-check to determine if the market is bullish or bearish.
Support lines are color-coded to reflect the directional bias (bullish, bearish, or neutral).
3. Candle Coloring Logic
Candles are categorized into:
LongCandles (above both trend and support lines)
ShortCandles (below both lines)
NeutralCandle (between them)
Candles can also be shaded differently when they are downward candles, even within a bullish setup.
4. Multi-Timeframe Box Overlays
Automatically selects a higher timeframe (HTF) based on the current chart.
Draws boxes that represent the range of the selected HTF bar (e.g., day, week, month).
Boxes are colored based on whether price closed up or down.
Supports multiple methods to determine the top/bottom of the box:
High/Low Range (HLR)
True Range (TR)
Heikin Ashi Range (HAR)
5. Period Line
Calculates a smoothed line from the average of each HTF box’s top/bottom.
Useful for identifying long-term trend alignment.
⚙️ Inputs & Customizations
Pivot settings: Number of bars to look back and forward, factor, and spread.
Trendline settings: Moving average lengths and slope sensitivity.
HTF box settings: Resolution (manual or auto), color options, calculation method.
📈 Visual Output
Trendline and support line (optional display).
HTF range boxes (highlighting bullish or bearish sessions).
Color-coded candles indicating alignment or divergence from trend.
Invisible PeriodLine for advanced strategy developers.
💡 Use Case
This indicator is ideal for:
Swing and intraday traders who want to trade in the direction of larger trends.
Traders who rely on multi-timeframe analysis to find confluence.
Users looking to combine price structure (pivot-based) and momentum (moving average-based) for trend validation.
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。