Indicator · Pine Script v6 · Own pane

Momentum Shift [Bigbeluga]

by theonetrade· code credited to BigBeluga

Calculates smoothed momentum using a Hull Moving Average of price changes over a specified length.

View on GitHub

GitHub stars34on the repository
Pine versionv6current
Lines of code137
Settings5inputs
LicenceMIT
Last update2 weeks ago8 Nov 2026

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

137 lines of Pine Script v6 from assets/indicator/bit-exact/momentum_shift_bigbeluga_frV6xCiE.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

momentum_shift_bigbeluga_frV6xCiE.pine
// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International  
// https://creativecommons.org/licenses/by-nc-sa/4.0/
// © BigBeluga

//@version=6
indicator("Momentum Shift [Bigbeluga]", max_labels_count = 500, max_lines_count = 500)

var lines_up = array.new<line>()
var lines_dn = array.new<line>()
var labels   = array.new<label>()

// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{

length = input.int(50, "Length", group = "Momentum", inline = "mom")
smooth = input.int(50, "Smooth", group = "Momentum", inline = "mom")
mult_dist = input.float(1, step = 0.1, title = "Shift Zone Size")

col_u = input.color(#3ad79b, "", inline = "ccc")
col_d = input.color(#fb6b2e, "", inline = "ccc")

// }


// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
// Smoothed Momentum
mom = ta.hma(close - close[length], smooth)
high_ = ta.highest(mom, 150)
low_ = ta.lowest(mom, 150)
// MoM color
color colorM = color.from_gradient(mom, low_, high_, col_d, col_u)

// Signals
bool rising  = ta.crossover(mom, mom[2])
bool falling = ta.crossunder(mom, mom[2])

float dist = ta.sma(high-low, 100) * mult_dist

// Draw Label
draw_lbl(x, y, txt, col)=>
    var lbl = label(na)

    lbl := label.new(x, y, txt, color = color(na), style = label.style_label_right, textcolor = col, force_overlay = true)

    label.delete(lbl[1])
    labels.push(lbl)


// RISING ZONES
if rising
    label.new(bar_index, low, "▲", color = color(na), textcolor = color.new(col_u, 50), style = label.style_label_up, force_overlay = true)


    if mom < 0 
        label.new(bar_index, mom, "▲", color = color(na), textcolor = col_u, style = label.style_label_up, force_overlay = false)
        label.new(bar_index, low, "△", color = color(na), textcolor = col_u, style = label.style_label_up, force_overlay = true)
    
    if lines_dn.size() > 0
        for i = 0 to lines_dn.size() - 1

            line_id = lines_dn.get(i)

            line.delete(line_id)

    lines_dn.clear()

    for i = 0 to 5
        lines_up.push(line.new(bar_index+i*3, high + dist*i, bar_index + 15+i*3, high + dist*i, force_overlay = true, color = color.new(col_u, 60-10*i)))

        if i > 0
            draw_lbl(bar_index+i*3, high + dist*i, str.tostring(i), color.new(col_u, 60-10*i))

// FALLING ZONES
if falling
    label.new(bar_index, high, "▼", color = color(na), textcolor = color.new(col_d, 50), style = label.style_label_down, force_overlay = true)

    if mom > 0
        label.new(bar_index, mom, "▼", color = color(na), textcolor = col_d, style = label.style_label_down, force_overlay = false)
        label.new(bar_index, high, "▽", color = color(na), textcolor = col_d, style = label.style_label_down, force_overlay = true)

    if lines_up.size() > 0
        for i = 0 to lines_up.size() - 1

            line_id = lines_up.get(i)

            line.delete(line_id)

    lines_up.clear()

    for i = 0 to 5
        lines_dn.push(line.new(bar_index+ i * 3, low - dist * i, bar_index + 15 + i *3, low - dist*i, force_overlay = true, color = color.new(col_d, 60-10*i)))
        if i > 0
            draw_lbl(bar_index+i*3, low - dist*i, str.tostring(i), color.new(col_d, 60-10*i))

// Manage Lines and Labels
if lines_up.size() > 0
    for i = 0 to lines_up.size() - 1

        line_id = lines_up.get(i)
        line_id1 = lines_up.get(i < lines_up.size() - 1 ? i + 1 : i)

        line.set_x2(line_id, bar_index + +5 + i * 3)

        linefill.new(line_id, line_id1, color.new(col_u, 90 - i*5))


        if high >= line_id.get_y2()
            line.set_x2(line_id, bar_index)
            lines_up.set(i, line(na))

if lines_dn.size() > 0
    for i = 0 to lines_dn.size() - 1

        line_id = lines_dn.get(i)
        line_id1 = lines_dn.get(i < lines_dn.size() - 1 ? i + 1 : i)

        line.set_x2(line_id, bar_index + +5 + i * 3)

        linefill.new(line_id, line_id1, color.new(col_d, 90 - i*5))

        if low <= line_id.get_y2()
            line.set_x2(line_id, bar_index)
            lines_dn.set(i, line(na))

// Remove consecutive labels if the number exceeds 5
if labels.size() > 5
    label.delete(labels.shift())
// }

// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{

hline(0)
pm = plot(mom, color = chart.fg_color)
p0 = plot(0, display = display.none)

fill(pm, p0, high_, low_, mom > 0 ? colorM : na, na)
fill(pm, p0, high_, low_, na, mom < 0 ? colorM : na)
// }

Overview

Momentum Shift [Bigbeluga] identifies momentum shifts based on crossovers and crossunders relative to previous values, rendering a gradient-colored momentum oscillator in a separate pane. When momentum shifts occur, the script automatically plots visual projection lines and shift zones directly on the price chart using historical average price range metrics.

Details

Published by

theonetrade on GitHub

Code credit

BigBeluga, as written in the script's header

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

algorithmic-tradingbacktestingbitcoinccxtcrypto-tradingllm-agentoffline-backtestingopen-source-tradingpine-scriptpine-to-pythonpinescriptpynecorepythonquantquantitative-financestrategy-backtestingtechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

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

SettingTypeDefaultVariable
Lengthint50length
Smoothint50smooth
Shift Zone Sizefloat1mult_dist
col_ucolor#3ad79bcol_u
col_dcolor#fb6b2ecol_d
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

MACD Breakout

by jerryinyang
5 stars

MACD Breakout builds a higher-timeframe MACD from preset fast and slow lengths using SMA or EMA, and marks support and resistance zones from histogram sensitivity. Optional filters require zero-line agreement, higher-timeframe direction, and linear-regression

Indicator v4 Oscillators & momentumMoving averages
Updated 2 years ago · None stated GitHub repository of MACD Breakout

Cipher B

by diehardyearone
3 stars

Cipher B is a multi-indicator plotting WaveTrend oscillator lines and signals alongside Stochastic RSI, MFI area with color bars, and buy sell marks. It draws all elements in a separate pane. WaveTrend calculates using SMMA and EMA on source like ohlc4 with ad

Indicator v6 Oscillators & momentumMoving averages
Updated 1 year ago · None stated GitHub repository of Cipher B

Custom Oscillator

by danielbodnar
2 stars

This reference script provides practical Pine Script v6 code examples for creating custom indicators. It includes a smoothed Relative Strength Index oscillator plotted with overbought and oversold background zones, a multi-timeframe moving average overlay with

Indicator v6 Oscillators & momentumMoving averages
Updated 12 days ago · MIT GitHub repository of Custom Oscillator

Uabmacd

by avatar-lavventura
2 stars

The script plots a WaveTrend oscillator in a separate pane, calculating TCI as an EMA of a normalized price deviation and its 4-bar SMA. It displays overbought and oversold levels with colored circles for WT1-WT2 crossovers and bar coloring on crossover bars.

Indicator v4 Oscillators & momentumMoving averages
Updated 8 months ago · None stated GitHub repository of Uabmacd

Composite Market Bias

by mrme000m
1 stars

Composite Market Bias is a separate-pane indicator that scores bullish and bearish conditions from RSI, fast versus slow EMA, MACD histogram, Bollinger Band position, and price versus a 50-period EMA. It plots the resulting bias score with RSI, EMA trend, MACD

Indicator v5 Oscillators & momentumMoving averages
Updated 2 months ago · None stated GitHub repository of Composite Market Bias

More Oscillators & momentum scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers