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.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。