1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
110 lines of Pine Script v6 from mt5/GOM_BB_PREDICTION.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
GOM_BB_PREDICTION.pine
//@version=6
// GOM_BB_PREDICTION.pine — Calcule les Bollinger Bands futures (300 bougies)
// À ajouter comme étude separate ou fusionner dans GOM_KOLA_script.pine
indicator("GOM BB Prediction (300 bars)", shorttitle="GOM BB Pred", overlay=false)
// Entrées
pred_horizon = input.int(300, "Horizon prediction (bougies)", minval=50, maxval=500)
pred_method = input.string("linear", "Méthode", options=["linear", "trend", "sma"])
bb_period = input.int(20, "Période Bollinger", minval=5, maxval=50)
bb_dev = input.float(2.0, "Déviation Bollinger", minval=0.5, maxval=4.0)
// Calculer BB actuels
[bb_mid, bb_up, bb_dn] = ta.bb(close, bb_period, bb_dev)
// ═══════════════════════════════════════════════════════════════
// PRÉDICTION LINÉAIRE — extrapolation simple
// ═══════════════════════════════════════════════════════════════
// Pente simple sur les 20 dernières bougies
lookback_slope = 20
// Mid-line trend
slope_mid = 0.0
if bb_period <= bar_index
slope_mid := (bb_mid - bb_mid[lookback_slope]) / lookback_slope
// Upper trend
slope_up = 0.0
if bb_period <= bar_index
slope_up := (bb_up - bb_up[lookback_slope]) / lookback_slope
// Lower trend
slope_dn = 0.0
if bb_period <= bar_index
slope_dn := (bb_dn - bb_dn[lookback_slope]) / lookback_slope
// ─────────────────────────────────────────────────────────────
// Prédictions futures (300 bars)
// ─────────────────────────────────────────────────────────────
var array<float> pred_bb_mid = array.new<float>()
var array<float> pred_bb_up = array.new<float>()
var array<float> pred_bb_dn = array.new<float>()
var array<int> pred_times = array.new<int>()
if barstate.islast
// Effacer anciens
array.clear(pred_bb_mid)
array.clear(pred_bb_up)
array.clear(pred_bb_dn)
array.clear(pred_times)
// Générer 300 points prédits
current_mid = bb_mid
current_up = bb_up
current_dn = bb_dn
for i = 1 to pred_horizon
// Extrapolation linéaire
future_mid = current_mid + slope_mid * i
future_up = current_up + slope_up * i
future_dn = current_dn + slope_dn * i
array.push(pred_bb_mid, future_mid)
array.push(pred_bb_up, future_up)
array.push(pred_bb_dn, future_dn)
array.push(pred_times, bar_index + i)
// ─────────────────────────────────────────────────────────────
// EXPORT JSON pour webhook
// ─────────────────────────────────────────────────────────────
// Construire une chaîne JSON compacte (JSON complet = trop lourd)
pred_json = ""
if barstate.islast and array.size(pred_bb_mid) > 0
// Format compact: "mid:[1,2,3]|up:[1,2,3]|dn:[1,2,3]"
mid_str = ""
up_str = ""
dn_str = ""
// Limiter à 100 points pour rester dans les limites
steps = math.max(1, array.size(pred_bb_mid) / 100)
for i = 0 to array.size(pred_bb_mid) - 1 by steps
if mid_str != ""
mid_str += ","
up_str += ","
dn_str += ","
mid_str += str.tostring(math.round(array.get(pred_bb_mid, i) * 100) / 100)
up_str += str.tostring(math.round(array.get(pred_bb_up, i) * 100) / 100)
dn_str += str.tostring(math.round(array.get(pred_bb_dn, i) * 100) / 100)
pred_json = "PRED_BB|" + syminfo.ticker + "|" + timeframe.period + "|MID:[" + mid_str + "]|UP:[" + up_str + "]|DN:[" + dn_str + "]"
// Plot pour debug (affiche les prédictions)
plot(barstate.islast ? bb_mid : na, "BB Mid Current", color=color.blue, linewidth=2)
plot(barstate.islast ? bb_up : na, "BB Up Current", color=color.red, linewidth=1)
plot(barstate.islast ? bb_dn : na, "BB Down Current", color=color.green, linewidth=1)
// Export via alerte
if barstate.isconfirmed and pred_json != ""
alert(pred_json, alert.freq_once_per_bar_close)
// Affichage debug
var label pred_lbl = na
if barstate.islast
if not na(pred_lbl)
label.delete(pred_lbl)
pred_lbl := label.new(bar_index, bb_mid,
"Pred: " + str.tostring(array.size(pred_bb_mid)) + " points",
color=color.new(color.blue, 80), textcolor=color.white, size=size.small)
Overview
GOM BB Prediction (300 bars) draws these prediction lines in a separate pane below the price chart. Users can adjust the prediction horizon in bars, the Bollinger Bands period and deviation, and the extrapolation method. No entry or exit signals are provided, as it functions purely as a forecasting tool. The main settings control the lookback for slope calculation, the number of predicted bars, and Bollinger parameters. It has a notable limit of using future data for predictions and is intended for separate pane use only.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Horizon prediction (bougies)
int
300
pred_horizon
Méthode
string
linear
pred_method
Période Bollinger
int
20
bb_period
Déviation Bollinger
float
2.0
bb_dev
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
Calculates and plots moving averages on selected VIX volatility terms (VIX9D, VIX, VIX3M, or VIX6M) in a separate pane. The script computes user-defined short and long moving averages using EMA or SMA. It shades the background red when the short-term moving av
MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us
MultiIndicator combines multiple technical indicators into a single separate pane to save chart space. It calculates and displays market regime detection based on ordinary least squares regression, a Holt exponential smoothing crossover, normalized RSI, ADX, a
The AMFM indicator decomposes price movements into amplitude and frequency components using Ehlers' digital signal processing methods. It whitens the derivative as close minus open, then computes AM as the smoothed envelope of the absolute difference over 4 pe
PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l
The 8-Factor Composite Screener evaluates equities across fundamental and technical criteria, including valuation ratios, earnings and revenue growth, 12-month return momentum, proximity to 52-week highs, Stage 2 moving average alignment, benchmark relative st