Indicator · Pine Script v6 · On the chart

H1 Bollinger Bands on M15 (Forward Shifted)

by Tim1l

This indicator calculates 1-hour Bollinger Bands and overlays them directly on lower timeframe price charts, such as M15.

View on GitHub

Repaints

GitHub stars6on the repository
Pine versionv6current
Lines of code21
Settings2inputs
LicenceMIT
Last update1 year ago23 Jul 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

21 lines of Pine Script v6 from h1_bb_on_m15_shifted.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

h1_bb_on_m15_shifted.pine
//@version=6
indicator("H1 Bollinger Bands on M15 (Forward Shifted)", shorttitle="H1 BB Shifted", overlay=true)

bbLength = input.int(24, "BB Length", minval=1)
bbStdDev = input.float(2.0, "BB Std Deviation", minval=0.1, step=0.1)

[bb_middle, bb_upper, bb_lower] = request.security(syminfo.tickerid, "60", ta.bb(close, bbLength, bbStdDev), barmerge.gaps_off, barmerge.lookahead_on)

var float fixed_bb_upper = na
var float fixed_bb_middle = na
var float fixed_bb_lower = na
changedH = ta.change(time("60"))

if changedH != 0
    fixed_bb_upper := bb_upper
    fixed_bb_middle := bb_middle
    fixed_bb_lower := bb_lower

plot(fixed_bb_upper, "BB Upper H1", color=color.red, linewidth=1)
plot(fixed_bb_middle, "BB Middle H1", color=color.yellow, linewidth=1)
plot(fixed_bb_lower, "BB Lower H1", color=color.green, linewidth=1)

Overview

H1 Bollinger Bands on M15 (Forward Shifted) fetches hourly middle, upper, and lower band values and locks them until the next hourly bar opens to provide higher-timeframe volatility context. Users can configure the length and standard deviation settings for the Bollinger Bands calculation. Because the underlying higher-timeframe data is fetched using lookahead on historical bars, historical plots reference future hourly close prices.

Details

Published by

Tim1l on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Volatility & bands, Support & resistance, Moving averages

Markets

Crypto, Forex, Stocks

Timeframes

M1-M5, M15-H1

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
BB Lengthint24bbLength
BB Std Deviationfloat2.0bbStdDev
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.

Similar Pine Scripts

Snag - VWAP

by dearvn
257 stars

This indicator plots a custom Anchored Volume-Weighted Average Price (VWAP) directly on the price chart along with optional standard deviation bands. Users can anchor the VWAP to standard time periods like sessions, weeks, or months, or to corporate events suc

Indicator v5 Moving averagesVolatility & bands Repaints
Updated 6 weeks ago · None stated GitHub repository of Snag - VWAP

MA Envelope (MAE)

by mihakralj
99 stars

The MA Envelope indicator calculates upper and lower channel bands shifted by a user-defined percentage around a baseline moving average. It supports Simple Moving Average, Exponential Moving Average, and Weighted Moving Average calculation types. The script p

Indicator v6 Moving averagesSupport & resistance
Updated 4 weeks ago · Apache-2.0 GitHub repository of MA Envelope (MAE)

Moon Dev GEX Walls & Trap

by moondevonyt
92 stars

This indicator estimates gamma exposure levels and intraday context for index instruments like SPY and ES. It calculates VWAP with standard deviation bands as a gamma flip proxy, highlighting market regimes through background colors. It plots prior day high, l

Indicator v5 Support & resistanceSessions & time
Updated 8 weeks ago · Custom licence GitHub repository of Moon Dev GEX Walls & Trap

Median

by TWODS-CAPITAL
37 stars

The Median indicator calculates the median of a selected source series such as the high-low average over a user-defined length and plots it as a red line on the price chart. It draws an EMA of the median as a blue line and fills the space between them, changin

Indicator v5 Moving averagesVolatility & bands
Updated 3 years ago · MIT GitHub repository of Median
20 stars

This indicator calculates a base moving average (EMA, SMA, WMA, or HMA) and projects multiple symmetrical envelope bands around it directly on the price chart. Users can adjust the length, source, moving average type, and initial envelope multiplier. Additiona

Indicator v5 Moving averagesVolatility & bands
Updated 1 year ago · None stated GitHub repository of Multiple Moving Average Envelope

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers