OPEN-SOURCE SCRIPT
Predictive SMA & BB

■ Overview
Most technical indicators are strictly lagging—they only tell you what has already happened. The "Predictive SMA & BB" flips this paradigm by projecting the Simple Moving Average (SMA) and Bollinger Bands (BB) into the future space of your chart.
This tool allows you to visualize where dynamic support and resistance (the statistical walls) will be in the future, giving you a massive edge in planning limit orders and understanding the element of "time" in your trades.
■ The Core Logic: Forward Fill & Sliding Window
How do we plot the future without a crystal ball?
This script uses a quantitative approach known as "Forward Fill". It simulates the passing of time by assuming the current price remains perfectly flat (sideways).
As it projects bars into the future, the algorithm drops the oldest historical data points from the calculation window (e.g., a 200-period window) and sequentially fills the new future slots with the current close price.
This reveals a powerful mathematical truth: Even if the price doesn't move, moving averages and standard deviations will shift based on the decay of historical data.
■ Key Features & How to Use
Future Baseline Projection: See exactly when a downward-sloping SMA will mathematically curl upwards as old, extreme price data is dropped from the calculation.
Time-Based Squeeze Anticipation: As future bars are populated with flat prices, the projected Bollinger Bands will naturally squeeze, visualizing the expected statistical boundaries if volatility dies down.
Custom UI: Fully customizable from the inputs panel. Toggle the future SMA, BB lines, and cloud fills, and adjust colors/opacity without touching the code.
■ ⚠️ Crucial Limitations & Disclaimers
To use this tool effectively, you must understand its mathematical limitations:
Not a Crystal Ball: This indicator projects a statistical baseline based on the assumption that current prices will maintain a zero-volatility trajectory.
Vulnerability to Volatility Expansion: The projected ±2σ bands do NOT account for sudden, explosive price movements (e.g., macroeconomic news, central bank interventions). If high-impact news hits and volatility expands, the actual bands will violently widen, overriding the projected squeeze.
Decreasing Confidence: The further you project into the future, the more the calculation relies on the "Forward Fill" assumption, naturally decreasing the statistical confidence of the extreme ends of the projection.
Use these projected lines as strategic zones for "waiting in ambush" during normal market conditions, not as absolute guarantees. Combine this with multi-timeframe analysis and your own price action strategies.
Most technical indicators are strictly lagging—they only tell you what has already happened. The "Predictive SMA & BB" flips this paradigm by projecting the Simple Moving Average (SMA) and Bollinger Bands (BB) into the future space of your chart.
This tool allows you to visualize where dynamic support and resistance (the statistical walls) will be in the future, giving you a massive edge in planning limit orders and understanding the element of "time" in your trades.
■ The Core Logic: Forward Fill & Sliding Window
How do we plot the future without a crystal ball?
This script uses a quantitative approach known as "Forward Fill". It simulates the passing of time by assuming the current price remains perfectly flat (sideways).
As it projects bars into the future, the algorithm drops the oldest historical data points from the calculation window (e.g., a 200-period window) and sequentially fills the new future slots with the current close price.
This reveals a powerful mathematical truth: Even if the price doesn't move, moving averages and standard deviations will shift based on the decay of historical data.
■ Key Features & How to Use
Future Baseline Projection: See exactly when a downward-sloping SMA will mathematically curl upwards as old, extreme price data is dropped from the calculation.
Time-Based Squeeze Anticipation: As future bars are populated with flat prices, the projected Bollinger Bands will naturally squeeze, visualizing the expected statistical boundaries if volatility dies down.
Custom UI: Fully customizable from the inputs panel. Toggle the future SMA, BB lines, and cloud fills, and adjust colors/opacity without touching the code.
■ ⚠️ Crucial Limitations & Disclaimers
To use this tool effectively, you must understand its mathematical limitations:
Not a Crystal Ball: This indicator projects a statistical baseline based on the assumption that current prices will maintain a zero-volatility trajectory.
Vulnerability to Volatility Expansion: The projected ±2σ bands do NOT account for sudden, explosive price movements (e.g., macroeconomic news, central bank interventions). If high-impact news hits and volatility expands, the actual bands will violently widen, overriding the projected squeeze.
Decreasing Confidence: The further you project into the future, the more the calculation relies on the "Forward Fill" assumption, naturally decreasing the statistical confidence of the extreme ends of the projection.
Use these projected lines as strategic zones for "waiting in ambush" during normal market conditions, not as absolute guarantees. Combine this with multi-timeframe analysis and your own price action strategies.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.