Indicator · Pine Script v4 · Own pane

Angular Momentum Heat Map Plot

by mikeyhu70

This indicator calculates a smoothed momentum oscillator from price and plots many offset momentum lines in a separate pane as a colour-graded heat map.

View on GitHub

GitHub stars1on the repository
Pine versionv4older, still runs
Lines of code478
Settings23inputs
LicenceNone statedfile: MPL-2.0
Last update6 months ago15 Apr 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

478 lines of Pine Script v4 from Angular Momentum/Angular Momentum Swing Heat Map Plot with Signal V4.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Angular Momentum Swing Heat Map Plot with Signal V4.txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

//@version=4
study("Angular Momentum Heat Map Plot", shorttitle="AMHMP", overlay=false)

_source = close

src = close
MA =        input(title="MA", options=["SMA", "EMA", "WMA"], defval="EMA")
MA2 =        input(title="MA2", options=["SMA", "EMA", "WMA"], defval="EMA")
sm =        input(true, title="Smooth Momentum")
smp =       input(28, title="Smoothing Period")
Theme =     input(title="Theme", options=["Theme 1", "Theme 2", "Theme 3"], defval="Theme 2")
inc =       input(title="Increment", defval=1)
//inc =       input(title="Increment", defval=1)
smooth =    input(title="Smooth", defval=1, type=input.integer)
smoothSlow= input(title="Smooth Slow", defval=14, type=input.integer)
smoothSlow2= input(title="Smooth Slow Short Term", defval=10, type=input.integer)
//smoothSlow= input(title="Smooth Slow", defval=10, type=input.integer)
//smoothSlow2= input(title="Smooth Slow Short Term", defval=14, type=input.integer)
plotNumber= input(title="Plot Number", defval=18, minval=1, maxval=28, type=input.integer)
PaintBars = input(title="Paint Bars", defval=false, type=input.bool)
IncType =   input(title="Waves", defval=false, type=input.bool)
loopback =  input(title="Loopback Length to Normalize", defval=160, type=input.integer)
lbR = input(title='Oscilator Pivot Lookback Right ST', defval=1)
lbL = input(title='Oscilator Pivot Lookback Left ST', defval=10)
lbR2 = input(title='Oscilator Pivot Lookback Right MT', defval=1)
lbL2 = input(title='Oscilator Pivot Lookback Left MT', defval=30)
lbR3 = input(title='Oscilator Pivot Lookback Right LT', defval=30)
lbL3 = input(title='Oscilator Pivot Lookback Left LT', defval=100)
rangeUpper = input(title='Max of Lookback Range ST/MT', defval=100)
rangeLower = input(title='Min of Lookback Range ST/MT', defval=1)
rangeUpper2 = input(title='Max of Lookback Range LT', defval=800)
rangeLower2 = input(title='Min of Lookback Range LT', defval=100)
bearColor = color.new(color.red, 0)
bullColor = color.new(color.green, 0)
bearColor2 = color.new(color.fuchsia, 0)
bullColor2 = color.new(color.blue, 0)
textColor = color.new(color.white, 0)

nma(src, length1, length2) =>
    lambda = length1 / length2
    alpha = lambda * (length1 - 1) / (length1 - lambda)
    ma1 = ema(src, length1)
    ma2 = ema(ma1, length2)
    nma = (1 + alpha) * ma1 - alpha * ma2
    
dema(src, len) => 
    ma1 = ema(src, len)
    ma2 = ema(ma1, len)
    2 * ma1 - ma2
    
eTma(_src, _len) =>
    _tma = ema(ema(_src, _len), _len)
    
tma(_src, _len) =>
  _tma = sma(sma(_src, _len), _len)
    
noma(_src,_len) =>
    _noma = _src

tema(src, len) => 
    ma1 = ema(src, len)
    ma2 = ema(ma1, len)
    ma3 = ema(ma2, len)
    3 * (ma1 - ma2) + ma3

tdema(src, len) => 
    ma1 = dema(src, len)
    ma2 = dema(ma1, len)
    ma3 = dema(ma2, len)
    3 * (ma1 - ma2) + ma3

ttema(src, len) => 
    ma1 = tema(src, len)
    ma2 = tema(ma1, len)
    ma3 = tema(ma2, len)
    3 * (ma1 - ma2) + ma3

tnma(src, len) => 
    ma1 = nma(src, len, 3)
    ma2 = nma(ma1, len, 3)
    ma3 = nma(ma2, len, 3)
    3 * (ma1 - ma2) + ma3

thma(src, len) => 
    ma1 = hma(src, len)
    ma2 = hma(ma1, len)
    ma3 = hma(ma2, len)
    3 * (ma1 - ma2) + ma3

zlema(src, len) =>
    lag = round((len - 1) / 2)
    zlsrc = src + (src - src[lag])
    ema(zlsrc, len)

zldema(src, len) =>
    lag = round((len - 1) / 2)
    zlsrc = src + (src - src[lag])
    dema(zlsrc, len)
    
zltema(src, len) =>
    lag = round((len - 1) / 2)
    zlsrc = src + (src - src[lag])
    tema(zlsrc, len)
    
dzlema(src, len) => 
    ma1 = zlema(src, len)
    ma2 = zlema(ma1, len)
    2 * ma1 - ma2

tzlema(src, len) => 
    ma1 = zlema(src, len)
    ma2 = zlema(ma1, len)
    ma3 = zlema(ma2, len)
    3 * (ma1 - ma2) + ma3

llema(src, len) =>
    srcnew = 0.25*src + 0.5*src[1] + 0.25*src[2]
    ema(srcnew, len)
    
llsma(src, len) =>
    srcnew = 0.25*src + 0.5*src[1] + 0.25*src[2]
    sma(srcnew, len)
    
llhma(src, len) =>
    srcnew = 0.25*src + 0.5*src[1] + 0.25*src[2]
    hma(srcnew, len)
    
llwma(src, len) =>
    srcnew = 0.25*src + 0.5*src[1] + 0.25*src[2]
    wma(srcnew, len)
    
llrma(src, len) =>
    srcnew = 0.25*src + 0.5*src[1] + 0.25*src[2]
    rma(srcnew, len)
    
lltema(src, len) =>
    srcnew = 0.25*src + 0.5*src[1] + 0.25*src[2]
    tema(srcnew, len)
    
_inRange(cond) =>
    bars = barssince(cond == true)
    rangeLower <= bars and bars <= rangeUpper
    
_inRange3(cond) =>
    bars2 = barssince(cond == true)
    rangeLower2 <= bars2 and bars2 <= rangeUpper2

trans = 0

cp1 = color.new(#01ff00, trans)
cp2 = color.new(#05d904, trans)
cp3 = color.new(#04b504, trans)
cp4 = color.new(#039103, trans)
cp5 = color.new(#027502, trans)

cn1 = color.new(#ff0505, trans)
cn2 = color.new(#d60606, trans)
cn3 = color.new(#b80606, trans)
cn4 = color.new(#910303, trans)
cn5 = color.new(#750202, trans)

cp6 =  color.new(#00ddff, trans)
cp7 =  color.new(#04bcd9, trans)
cp8 =  color.new(#049cb3, trans)
cp9 =  color.new(#047f91, trans)
cp10 = color.new(#046775, trans)

cn6 =  color.new(#d800ff, trans)
cn7 =  color.new(#bb04db, trans)
cn8 =  color.new(#9b05b5, trans)
cn9 =  color.new(#7b038f, trans)
cn10 = color.new(#640275, trans)

cp11 = color.new(#cf0000, trans)
cp12 = color.new(#f22b11, trans)
cp13 = color.new(#f29811, trans)
cp14 = color.new(#eef211, trans)
cp15 = color.new(#3af211, trans)

cn11 = color.new(#02269e, trans)
cn12 = color.new(#0039f5, trans)
cn13 = color.new(#1176f2, trans)
cn14 = color.new(#11aff2, trans)
cn15 = color.new(#11e7f2, trans)

fc1 = color.new(color.white, 0)
sc1 = color.new(color.silver, 0)
//fc2 = color.new(color.white, 0)
fc2 = color.new(color.fuchsia, 0)
//sc2 = color.new(color.blue, 0)
sc2 = color.new(color.white, 0)
fc3 = color.new(color.white, 0)
sc3 = color.new(color.orange, 0)

fastColour = Theme == "Theme 1" ? fc1 : Theme == "Theme 2" ? fc2  : fc3
slowColour = Theme == "Theme 1" ? sc1 : Theme == "Theme 2" ? sc2  : sc3

pColour1 = Theme == "Theme 1" ? cp1 : Theme == "Theme 2" ? cp6  : cp11
pColour2 = Theme == "Theme 1" ? cp2 : Theme == "Theme 2" ? cp7  : cp12
pColour3 = Theme == "Theme 1" ? cp3 : Theme == "Theme 2" ? cp8  : cp13
pColour4 = Theme == "Theme 1" ? cp4 : Theme == "Theme 2" ? cp9  : cp14
pColour5 = Theme == "Theme 1" ? cp5 : Theme == "Theme 2" ? cp10 : cp15

nColour1 = Theme == "Theme 1" ? cn1 : Theme == "Theme 2" ? cn6  : cn11
nColour2 = Theme == "Theme 1" ? cn2 : Theme == "Theme 2" ? cn7  : cn12
nColour3 = Theme == "Theme 1" ? cn3 : Theme == "Theme 2" ? cn8  : cn13
nColour4 = Theme == "Theme 1" ? cn4 : Theme == "Theme 2" ? cn9  : cn14
nColour5 = Theme == "Theme 1" ? cn5 : Theme == "Theme 2" ? cn10 : cn15

getColour(a) =>
    if(a >= 90)
        pColour1
    else
        if(a >= 80)
            pColour2
        else
            if(a >= 70)
                pColour3
            else
                if(a >= 60)
                    pColour4
                else
                    if(a >= 50)
                        pColour5
                    else
                        if(a >= 40)
                            nColour5
                        else
                            if(a >= 30)
                                nColour4
                            else
                                if(a >= 20)
                                    nColour3
                                else
                                    if(a >= 10)
                                        nColour2
                                    else
                                        if(a >= 0)
                                            nColour1
                                            
//getStoch(i, incr) =>
//    c = (i * inc)
//    s = smooth + incr
//    if MA == "SMA"
//        sma(stoch(_source, high, low, c), s)
//    else
//        if MA == "EMA"
//            ema(stoch(_source, high, low, c), s)
//        else
//            if MA == "WMA"
//                wma(stoch(_source, high, low, c), s)
                
getStoch(i, incr) =>
    c = (i * inc)
    p = 2 * c + 1
    ema_1 = tzlema(src, smp)
    //amom = 100 * ((sm ? ema_1 : src) / dema(src, p) - 1)
    amom = (100*((sm ? ema_1 : src) / dema(src, p) - 1))

stoch1 =  plotNumber > 0  ? getStoch(IncType ? 1   : 1 , IncType ? 1  : 0) : 0
stoch2 =  plotNumber > 1  ? getStoch(IncType ? 2   : 2 , IncType ? 2  : 0) : 0
stoch3 =  plotNumber > 2  ? getStoch(IncType ? 3   : 3 , IncType ? 3  : 0) : 0
stoch4 =  plotNumber > 3  ? getStoch(IncType ? 4   : 4 , IncType ? 4  : 0) : 0
stoch5 =  plotNumber > 4  ? getStoch(IncType ? 5   : 5 , IncType ? 5  : 0) : 0
stoch6 =  plotNumber > 5  ? getStoch(IncType ? 6   : 6 , IncType ? 6  : 0) : 0
stoch7 =  plotNumber > 6  ? getStoch(IncType ? 7   : 7 , IncType ? 7  : 0) : 0
stoch8 =  plotNumber > 7  ? getStoch(IncType ? 8   : 8 , IncType ? 8  : 0) : 0
stoch9 =  plotNumber > 8  ? getStoch(IncType ? 9   : 9 , IncType ? 9  : 0) : 0
stoch10 = plotNumber > 9  ? getStoch(IncType ? 10  : 10, IncType ? 10 : 0) : 0
stoch11 = plotNumber > 10 ? getStoch(IncType ? 15  : 11, IncType ? 11 : 0) : 0
stoch12 = plotNumber > 11 ? getStoch(IncType ? 20  : 12, IncType ? 12 : 0) : 0
stoch13 = plotNumber > 12 ? getStoch(IncType ? 25  : 13, IncType ? 13 : 0) : 0
stoch14 = plotNumber > 13 ? getStoch(IncType ? 30  : 14, IncType ? 14 : 0) : 0
stoch15 = plotNumber > 14 ? getStoch(IncType ? 35  : 15, IncType ? 15 : 0) : 0
stoch16 = plotNumber > 15 ? getStoch(IncType ? 40  : 16, IncType ? 16 : 0) : 0
stoch17 = plotNumber > 16 ? getStoch(IncType ? 45  : 17, IncType ? 17 : 0) : 0
stoch18 = plotNumber > 17 ? getStoch(IncType ? 50  : 18, IncType ? 18 : 0) : 0
stoch19 = plotNumber > 18 ? getStoch(IncType ? 55  : 19, IncType ? 19 : 0) : 0
stoch20 = plotNumber > 19 ? getStoch(IncType ? 60  : 20, IncType ? 20 : 0) : 0
stoch21 = plotNumber > 20 ? getStoch(IncType ? 70  : 21, IncType ? 21 : 0) : 0
stoch22 = plotNumber > 21 ? getStoch(IncType ? 80  : 22, IncType ? 22 : 0) : 0
stoch23 = plotNumber > 22 ? getStoch(IncType ? 90  : 23, IncType ? 23 : 0) : 0
stoch24 = plotNumber > 23 ? getStoch(IncType ? 100 : 24, IncType ? 24 : 0) : 0
stoch25 = plotNumber > 24 ? getStoch(IncType ? 110 : 25, IncType ? 25 : 0) : 0
stoch26 = plotNumber > 25 ? getStoch(IncType ? 120 : 26, IncType ? 26 : 0) : 0
stoch27 = plotNumber > 26 ? getStoch(IncType ? 140 : 27, IncType ? 27 : 0) : 0
stoch28 = plotNumber > 27 ? getStoch(IncType ? 160 : 28, IncType ? 28 : 0) : 0

colour1 =  getColour(stoch1) 
colour2 =  getColour(stoch2) 
colour3 =  getColour(stoch3) 
colour4 =  getColour(stoch4) 
colour5 =  getColour(stoch5) 
colour6 =  getColour(stoch6) 
colour7 =  getColour(stoch7) 
colour8 =  getColour(stoch8) 
colour9 =  getColour(stoch9) 
colour10 = getColour(stoch10)
colour11 = getColour(stoch11)
colour12 = getColour(stoch12)
colour13 = getColour(stoch13)
colour14 = getColour(stoch14)
colour15 = getColour(stoch15)
colour16 = getColour(stoch16)
colour17 = getColour(stoch17)
colour18 = getColour(stoch18)
colour19 = getColour(stoch19)
colour20 = getColour(stoch20)
colour21 = getColour(stoch21)
colour22 = getColour(stoch22)
colour23 = getColour(stoch23)
colour24 = getColour(stoch24)
colour25 = getColour(stoch25)
colour26 = getColour(stoch26)
colour27 = getColour(stoch27)
colour28 = getColour(stoch28)

getAverage = (stoch1 + stoch2 + stoch3 + stoch4 + stoch5 + stoch6 + stoch7 + stoch8 + stoch9 + stoch10 + stoch11 + stoch12 + stoch13 + stoch14 + stoch15 + stoch16 + stoch17 + stoch18 + stoch19 + stoch20 + stoch21 + stoch22 + stoch23 + stoch24 + stoch25 + stoch26 + stoch27 + stoch28) / plotNumber
getAverage1 = (stoch1 + stoch2 + stoch3 + stoch4 + stoch5 + stoch6 + stoch7 + stoch8 + stoch9 + stoch10 + stoch11 + stoch12 + stoch13 + stoch14) / plotNumber
getAverage2 = (stoch1 + stoch2 + stoch3 + stoch4 + stoch5 + stoch6 + stoch7) / round(plotNumber)


fast = ((getAverage / 100) * plotNumber)
fast1 = ((getAverage1 / 100) * plotNumber*2)
fast2 = ((getAverage2 / 100) * round(plotNumber*4))


slow = MA == "SMA" ? sma(fast1, smoothSlow) : MA == "EMA" ? zlema(fast1, smoothSlow) : wma(fast1, smoothSlow)
slow2 = MA2 == "SMA" ? sma(fast2, smoothSlow2) : MA2 == "EMA" ? tema(fast2, smoothSlow2) : wma(fast2, smoothSlow2)
barColour = getColour(getAverage)

//plot1 =  plot(plotNumber > 0  ? 0 : na, color=colour1, linewidth=1)
//plot2 =  plot(plotNumber > 1  ? 1 : na, color=colour2, linewidth=1)
//plot3 =  plot(plotNumber > 2  ? 2 : na, color=colour3, linewidth=1)
//plot4 =  plot(plotNumber > 3  ? 3 : na, color=colour4, linewidth=1)
//plot5 =  plot(plotNumber > 4  ? 4 : na, color=colour5, linewidth=1)
//plot6 =  plot(plotNumber > 5  ? 5 : na, color=colour6, linewidth=1)
//plot7 =  plot(plotNumber > 6  ? 6 : na, color=colour7, linewidth=1)
//plot8 =  plot(plotNumber > 7  ? 7 : na, color=colour8, linewidth=1)
//plot9 =  plot(plotNumber > 8  ? 8 : na, color=colour9, linewidth=1)
//plot10 = plot(plotNumber > 9  ? 9 : na, color=colour10, linewidth=1)
//plot11 = plot(plotNumber > 10 ? 10 : na, color=colour11, linewidth=1)
//plot12 = plot(plotNumber > 11 ? 11 : na, color=colour12, linewidth=1)
//plot13 = plot(plotNumber > 12 ? 12 : na, color=colour13, linewidth=1)
//plot14 = plot(plotNumber > 13 ? 13 : na, color=colour14, linewidth=1)
//plot15 = plot(plotNumber > 14 ? 14 : na, color=colour15, linewidth=1)
//plot16 = plot(plotNumber > 15 ? 15 : na, color=colour16, linewidth=1)
//plot17 = plot(plotNumber > 16 ? 16 : na, color=colour17, linewidth=1)
//plot18 = plot(plotNumber > 17 ? 17 : na, color=colour18, linewidth=1)
//plot19 = plot(plotNumber > 18 ? 18 : na, color=colour19, linewidth=1)
//plot20 = plot(plotNumber > 19 ? 19 : na, color=colour20, linewidth=1)
//plot21 = plot(plotNumber > 20 ? 20 : na, color=colour21, linewidth=1)
//plot22 = plot(plotNumber > 21 ? 21 : na, color=colour22, linewidth=1)
//plot23 = plot(plotNumber > 22 ? 22 : na, color=colour23, linewidth=1)
//plot24 = plot(plotNumber > 23 ? 23 : na, color=colour24, linewidth=1)
//plot25 = plot(plotNumber > 24 ? 24 : na, color=colour25, linewidth=1)
//plot26 = plot(plotNumber > 25 ? 25 : na, color=colour26, linewidth=1)
//plot27 = plot(plotNumber > 26 ? 26 : na, color=colour27, linewidth=1)
//plot28 = plot(plotNumber > 27 ? 27 : na, color=colour28, linewidth=1)
//plot29 = plot(plotNumber, color=colour28, linewidth=1)

plot(slow, color=slowColour, linewidth=1, style=plot.style_line, title="slow")
plot(slow2, color=slowColour, linewidth=1, style=plot.style_line, title="slow2", display= display.none)


plot(fast, color=fastColour, linewidth=1, style=plot.style_line, title="fast")
plot(fast2, color=color.silver, style=plot.style_linebr, transp=60, linewidth=2, title="fast2", display= display.none)

//

a_high = highest(fast2, loopback)
a_low = lowest(fast2, loopback)
a_mid = 0
a_upper_increment = a_mid + 85*abs(a_high- a_mid)/100
a_lower_increment = a_mid - 85*abs(a_mid - a_low)/100
a_upper_increment1 = a_mid + 50*abs(a_high- a_mid)/100
a_lower_increment1 = a_mid - 50*abs(a_mid - a_low)/100
a_upper_increment2 = a_mid + 15*abs(a_high- a_mid)/100
a_lower_increment2 = a_mid - 15*abs(a_mid - a_low)/100

//fcolor = (fast2 > slow2) and (fast2 > a_upper_increment) ? color.navy : (fast2 > slow2) and (fast2 < a_lower_increment ) ? color.lime : (fast2 < slow2) and (fast2 > a_upper_increment) ? color.orange : (fast2 < slow2) and (fast2 < a_lower_increment)  ? color.yellow : (fast2 > 0) ? color.aqua : color.silver

//Cross Up ((top to bottom) : navy, darker blue, [#e5e500 dark yellow], cyan, lime
//Cross Down (top to bottom) : darker red, [orange], pink, fushia

// a_upper_increment
// a_upper_increment1
// a_upper_increment2
// 0 line
// a_lower_increment2
// a_lower_increment1
// a_lower_increment

fcolor = (fast2 > slow2) and (fast2 > a_upper_increment) ? color.navy : 
   (fast2 > slow2) and (fast2 < a_upper_increment) and (fast2 > a_upper_increment1) ? #203e90 : 
   (fast2 > slow2) and (fast2 < a_upper_increment1) and (fast2 > a_upper_increment2) ? #294eb4 : 
   (fast2 > slow2) and (fast2 < a_upper_increment2) and (fast2 > 0) ? #3e5fbb :  
   (fast2 > slow2) and (fast2 > a_lower_increment2) and (fast2 <= 0) ? #e5e500  : 
   (fast2 > slow2) and (fast2 > a_lower_increment1) and (fast2 < a_lower_increment2) ? #30adb4 : 
   (fast2 > slow2) and (fast2 > a_lower_increment) and (fast2 < a_lower_increment1) ? #3DD9E1 : 
   (fast2 > slow2) and (fast2 < a_lower_increment) ? color.lime :  
   (fast2 < slow2) and (fast2 > a_upper_increment) ? #7C0000: 
   (fast2 < slow2) and (fast2 < a_upper_increment) and (fast2 > a_upper_increment1) ? #A00000 : 
   (fast2 < slow2) and (fast2 < a_upper_increment1) and (fast2 > a_upper_increment2) ? #b20000 :
   (fast2 < slow2) and (fast2 < a_upper_increment2) and (fast2 > 0) ? #B91919:  
   (fast2 < slow2) and (fast2 > a_lower_increment2) and (fast2 <= 0) ?  color.orange : 
   (fast2 < slow2) and (fast2 > a_lower_increment1) and (fast2 < a_lower_increment2) ? #f27f7f : 
   (fast2 < slow2) and (fast2 > a_lower_increment) and (fast2 < a_lower_increment1) ? #f7b2b2 : 
   (fast2 < slow2) and (fast2 < a_lower_increment) ? color.fuchsia :  
   (fast2 < 0) ? color.yellow : (fast2 > 0) ? color.silver: na

// https://color-hex.org/color/b20000

plot (0, color=fcolor, linewidth=1, transp=0)

barcolor(PaintBars ? barColour : na)

plFound = na(pivotlow(slow, lbL, lbR)) ? false : true
phFound2 = na(pivothigh(slow, lbL2, lbR2)) ? false : true
plFound3 = na(pivotlow(slow, lbL3, lbR3)) ? false : true
phFound = na(pivothigh(slow, lbL, lbR)) ? false : true
plFound2 = na(pivotlow(slow, lbL2, lbR2)) ? false : true
phFound3 = na(pivothigh(slow, lbL3, lbR3)) ? false : true

//------------------------------------------------------------------------------
// Regular Bullish
// Osc: Higher Low

oscHL = slow[lbR] > valuewhen(plFound, slow[lbR], 1) and _inRange(plFound[1])
oscHL2 = slow[lbR2] > valuewhen(plFound2, slow[lbR2], 1) and _inRange(plFound2[1])
oscHL3 = slow[lbR3] > valuewhen(plFound3, slow[lbR3], 1) and _inRange3(plFound3[1])

bullCond = (oscHL and plFound) or (oscHL2 and plFound2)
bullCond2 = oscHL3 and plFound3

plotshape(bullCond ? slow[lbR] : na, offset=-lbR, title='Regular Bullish Label', style=shape.labelup, location=location.absolute, size=size.tiny, color=bullColor, textcolor=textColor, transp=0)
plotshape(bullCond2 ? slow[lbR2] : na, offset=-lbR2, title='Regular Bullish Label LT', style=shape.labelup, location=location.absolute, size=size.tiny, color=bullColor2, textcolor=textColor, transp=0)

//------------------------------------------------------------------------------
// Regular Bearish
// Osc: Lower High

oscLH = slow[lbR] < valuewhen(phFound, slow[lbR], 1) and _inRange(phFound[1])
oscLH2 = slow[lbR2] < valuewhen(phFound2, slow[lbR2], 1) and _inRange(phFound2[1])
oscLH3 = slow[lbR3] < valuewhen(phFound3, slow[lbR3], 1) and _inRange3(phFound3[1])

bearCond = (oscLH and phFound) or (oscLH2 and phFound2)
bearCond2 = oscLH3 and phFound3

plotshape(bearCond ? slow[lbR] : na, offset=-lbR, title='Regular Bearish Label', style=shape.labeldown, location=location.absolute, size=size.tiny, color=bearColor, textcolor=textColor, transp=0)
plotshape(bearCond2 ? slow[lbR2] : na, offset=-lbR2, title='Regular Bearish Label LT', style=shape.labeldown, location=location.absolute, size=size.tiny, color=bearColor2, textcolor=textColor, transp=0)

// Alerts


f_crossing_level_up(sr, r) =>
    //(r > sr and r < sr[1])
    (r < sr and r > sr[1])
    
f_crossing_level_down(sr, r) =>
    //(r < sr and r > sr[1])
    (r > sr and r < sr[1])
    
if f_crossing_level_up(fast, slow)
    if (fast > 0)
        alert("Angular Momentum Heat Map Plot: " + syminfo.ticker + " Buy Signal (>0) at " + tostring(close) + " has tiggered! " + timeframe.period, freq = alert.freq_once_per_bar)
    else
        alert("Angular Momentum Heat Map Plot: " + syminfo.ticker + " Buy Signal (<0) at " + tostring(close) + " has tiggered! " + timeframe.period, freq = alert.freq_once_per_bar)
else
    if f_crossing_level_down(fast, slow)
        if (fast > 0)
            alert("Angular Momentum Heat Map Plot: " + syminfo.ticker + " Sell Signal (>0) at " + tostring(close) + " has triggered! " + timeframe.period, freq = alert.freq_once_per_bar)
        else
            alert("Angular Momentum Heat Map Plot: " + syminfo.ticker + " Sell Signal (<0) at " + tostring(close) + " has triggered! " + timeframe.period, freq = alert.freq_once_per_bar)

// -->

Overview

Moving average type, smoothing periods, the number of plotted lines and the colour theme are adjustable. It also searches oscillator pivots over short, medium and long lookback ranges to find divergences, and bars can optionally be painted. This version adds a separate short-term slow smoothing input. It is an analysis tool and has no entry or exit rules.

Details

Published by

mikeyhu70 on GitHub

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Oscillators & momentum, Divergence

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.

Settings

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

SettingTypeDefaultVariable
MAstringEMAMA
MA2stringEMAMA2
Smooth Momentumbooltruesm
Smoothing Periodint28smp
ThemestringTheme 2Theme
Incrementint1inc
Smoothint1smooth
Smooth Slowint14smoothSlow
Smooth Slow Short Termint10smoothSlow2
Plot Numberint18plotNumber
Paint BarsboolfalsePaintBars
WavesboolfalseIncType
Show all 23 settings
SettingTypeDefaultVariable
Loopback Length to Normalizeint160loopback
Oscilator Pivot Lookback Right STint1lbR
Oscilator Pivot Lookback Left STint10lbL
Oscilator Pivot Lookback Right MTint1lbR2
Oscilator Pivot Lookback Left MTint30lbL2
Oscilator Pivot Lookback Right LTint30lbR3
Oscilator Pivot Lookback Left LTint100lbL3
Max of Lookback Range ST/MTint100rangeUpper
Min of Lookback Range ST/MTint1rangeLower
Max of Lookback Range LTint800rangeUpper2
Min of Lookback Range LTint100rangeLower2
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

This indicator calculates momentum setups based on the Relative Strength Index (RSI) and plots in a separate pane. It offers multiple scanning modes such as Continuous Break, Continuous Retracement, Flip Break, Flip Retracement, and both regular and hidden div

Indicator v6 Oscillators & momentumDivergence Repaints
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - RSI Directional Momentum Indicator
330 stars

This indicator calculates the MACD oscillator from a configurable source with fast and slow lengths, then plots the histogram, MACD line, and signal line in a separate pane. It detects regular bullish divergences (price lower lows with oscillator higher lows),

Indicator v5 Oscillators & momentumDivergence
Updated 2 months ago · None stated GitHub repository of MACD + Divergences [Alorse]
228 stars

This indicator calculates the Relative Strength Index (RSI) across four user-selected timeframes and plots the results in a separate pane. It identifies regular bullish and bearish divergences between price pivot points and the primary timeframe RSI value. Add

Indicator v6 Oscillators & momentumDivergence
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe RSI with Divergence

Bubbles Indicator

by capissimo
114 stars

The Bubbles Indicator measures volatility squeezes and expansion bursts using Bollinger Bands combined with a sinusoid oscillator and RSI divergence. It processes price data through scaled Bollinger Bands to highlight volatility changes while confirming trend

Indicator v4 Volatility & bandsOscillators & momentum Repaints
Updated 1 year ago · None stated GitHub repository of Bubbles Indicator

RSI [SystemAlpha]

by iamc1oud
56 stars

This indicator plots a standard Relative Strength Index (RSI) in a separate pane alongside customizable overbought and oversold threshold levels with shaded fills. It identifies pivot highs and lows on the oscillator to detect regular and hidden bullish and be

Indicator v4 Oscillators & momentumDivergence Repaints
Updated 2 months ago · None stated GitHub repository of RSI [SystemAlpha]
55 stars

This indicator calculates a 14-period RSI from close and plots it in a separate pane with dotted overbought and dashed oversold lines at 70 and 30. It marks bullish divergence when a five-bar pivot low in price is lower than the price twenty bars earlier while

Indicator v6 Oscillators & momentumDivergence
Updated 6 months ago · Apache-2.0 GitHub repository of RSI Divergence Detector

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