Foundation TA

Rather than stacking four separate indicators — consuming four of TradingView's limited indicator slots and producing inconsistent color schemes — this tool unifies them under a shared visual identity system with three color schemes that cascade across all components simultaneously. More importantly, the components are designed to work as an analytical hierarchy: the adaptive trend channel defines the macro regime, VWAP establishes institutional fair-value anchors within that regime, order blocks identify specific institutional entry/exit zones, and moving averages provide dynamic confirmation levels.
█ WHAT MAKES THIS ORIGINAL
This indicator's originality comes from three specific technical implementations that do not exist in standard open-source Pine Script libraries:
1. Adaptive Trend Channel via Pearson's R Optimization
Standard linear regression channels use a single fixed lookback period chosen by the user. This indicator instead evaluates 19 different lookback periods in parallel (100–1000 bars in long-term mode, or 20–200 bars in short-term mode), computes Pearson's correlation coefficient for each using a custom logarithmic regression function, and automatically selects the period that produces the strongest linear fit. This means the channel continuously adapts to the dominant trend structure in the data rather than relying on a manually chosen period that may or may not capture the current trend. The regression is performed in logarithmic price space (not linear), which produces geometrically symmetric bands — a meaningful difference for assets with large price ranges.
2. Volume-Pivot Order Block Detection with Structural Shift Confirmation
Standard supply/demand zone indicators typically draw zones at every swing high or low. This implementation requires two simultaneous conditions: a volume pivot (a bar where volume is the local maximum within a configurable lookback window) must coincide with a structural shift (price making a new range high or low within the same lookback). This dual-condition filter significantly reduces false zones compared to pure price-structure approaches. Order blocks are defined between the HL2 (midpoint) and the high/low of the pivot bar — not the full candle range — producing tighter, more precise zones. Additionally, each order block is tracked in an array and automatically removed when price fully passes through it (wick-based mitigation), keeping only unclaimed zones on the chart.
3. Cross-Component Unified Color Architecture
All four components derive their colors from a single centralized scheme selection (Default, Mono, or Blues). This is not merely cosmetic — it eliminates the visual noise that occurs when four independent indicators use unrelated color palettes, allowing the trader to read the chart as a single coherent analytical layer rather than four overlapping tools.
█ USAGE
Multi-Timeframe Order Blocks
Order blocks are detected across four timeframes simultaneously: Current TF, 1-Hour, 4-Hour, and Daily. Each timeframe can be independently enabled with its own color configuration and maximum display count. Bullish order blocks form when a volume pivot occurs during a bullish structural shift (price making a new range low). Bearish order blocks form during bearish structural shifts (new range high). Zones are automatically removed when price passes through them, indicating the institutional interest has been absorbed.
Multi-Timeframe Moving Averages
Five independently configurable moving averages can be displayed simultaneously, each with its own timeframe, length, type, and color. Supported types include SMA, EMA, DEMA (Double Exponential), VWMA (Volume-Weighted), RMA, and WMA. Labels show the MA type, length, and timeframe for quick identification. This allows setups like a 50 EMA on the 1-hour paired with a 200 EMA on the 4-hour, all visible on a lower timeframe chart.
Multi-Anchor VWAP
Three VWAP calculations are available simultaneously: Session, Weekly, and Monthly. Each anchor provides the core VWAP line plus up to three standard deviation bands. The Session VWAP supports multiple anchor periods (Session, Week, Month, Quarter, Year). Dynamic transparency is applied at period boundaries to prevent visual jumps when the anchor resets.
Adaptive Trend Channel
The trend channel displays a logarithmic linear regression channel with automatic period selection. A confidence table shows the trend strength using the Pearson's R value of the best-fit period, translated into readable labels from "Extremely Weak" (R < 0.2) through 13 tiers to "Ultra Strong" (R > 0.98). Standard deviation bands show the normal volatility envelope around the regression line.
█ DETAILS
Order Block Detection Algorithm
Detection uses ta.pivothigh() on volume to find local volume maxima within a configurable lookback window (default: 5 bars). A structure state variable tracks whether the market is in bullish structure (price made a new range low) or bearish structure (price made a new range high). An order block is only created when both conditions align: a volume pivot coincides with the matching structure state. The zone spans from the bar's HL2 to its extreme (high for bearish, low for bullish). Mitigation checks run every bar using wicks by default, removing blocks when price fully passes through.
Pearson's R Regression Calculation
A custom function computes linear regression statistics in logarithmic price space. For each of the 19 test periods, it calculates:
1 — Slope and intercept via the least-squares method on log(price)
2 — Pearson's R as the normalized covariance between the data and the regression line
3 — Standard deviation of residuals for band width calculation
The period producing the highest absolute Pearson's R is selected. Channel boundaries are computed by exponentiating the regression line ± a configurable multiple of the log-space standard deviation, producing geometrically symmetric bands in price space.
DEMA Calculation
The Double Exponential Moving Average is computed as: DEMA = 2 × EMA(source, length) − EMA(EMA(source, length), length). This reduces lag compared to a standard EMA of equivalent smoothing.
Color Scheme System
Three base color schemes define primary, order block, and trend colors. All derived colors (backgrounds, lines, fills, labels) are computed from these base values using consistent transparency rules, ensuring every component shares a unified visual identity regardless of which scheme is active.
█ SETTINGS
Show
• Color Scheme: Default, Mono, or Blues — applies across all components.
• Show Order Blocks / EMAs / Trend Channel / VWAP: Master toggles for each component.
Order Blocks
• Bullish/Bearish Color: Colors for order block zones.
• Draw Right of Price Only: Hides historical portions for a cleaner chart.
MTF Order Blocks
• Current TF / 1H / 4H / Daily: Enable each timeframe with custom bull/bear colors and maximum count.
Multi-Timeframe EMA
• 5 MA slots: Each with enable toggle, timeframe, length, and type selection.
• Label options: Show type, length, and timeframe labels.
VWAP
• Session VWAP: Source, anchor period, up to 3 standard deviation bands.
• Monthly / Weekly VWAP: Independent enable toggles with separate band configurations.
Trend Channel
• Line Style / Extend Mode: Visual customization.
• Fill / Line / Midline Transparency: Fine-tune visual prominence.
█ METHODOLOGY
The source code is protected because it contains three non-trivial implementations: (1) A parallel Pearson's R optimization system that evaluates 19 regression periods simultaneously in logarithmic price space with custom slope, intercept, standard deviation, and correlation calculations — this auto-adaptation logic is the core differentiator from standard fixed-period regression channels. (2) A volume-pivot order block detection algorithm that requires dual-condition confirmation (volume local maximum + structural shift) with array-based tracking and wick-based mitigation removal — this filtering logic reduces false zones compared to standard supply/demand indicators. (3) A unified color architecture that cascades a single scheme selection across four independent components with derived transparency rules.
This indicator combines multiple technical analysis methods and does not constitute financial advice. Order blocks, VWAP levels, and trend channels reflect historical patterns that may not repeat. Past performance does not guarantee future results.
Invite-only script
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact lost_sol_ directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.
Author's instructions
Disclaimer
Invite-only script
Only users approved by the author can access this script. You'll need to request and get permission to use it. This is typically granted after payment. For more details, follow the author's instructions below or contact lost_sol_ directly.
TradingView does NOT recommend paying for or using a script unless you fully trust its author and understand how it works. You may also find free, open-source alternatives in our community scripts.