TradingView indicators

Impulse MACD: Neutral Zones and Confirmation

Impulse MACD sets its main value to zero while a smoothed price center stays inside a smoothed high-low channel. Outside that channel, it measures the distance to the nearest band. This guide explains LazyBear's public implementation, its separate color rules, and how to confirm a zero-zone exit at the bar close.

Original method: Impulse MACD [LazyBear]. Source reviewed October 17, 2026. Educational material, not investment advice.

One boundary check

With lower band 98 and upper band 102, a center of 101 produces 0. A center of 103 produces +1. A center of 97 produces -1. These are illustrative price units, not trade results.

How the channel creates the zero zone

For length N, smooth high and low separately with SMMA. Seed each average with an N-bar SMA, then update it as (previous average × (N - 1) + current value) / N. Call the resulting upper and lower bands U and L.

The center C uses HLC3 = (high + low + close) / 3. Calculate E1 = EMA(HLC3, N), E2 = EMA(E1, N), then C = 2 × E1 - E2. LazyBear names this helper calc_zlema. It is the two-EMA expression often called DEMA; it differs from the lag-adjusted-input ZLEMA formula used by other indicators.

Main impulse M, after the averages are available
Center positionMMeaning
C > UC - UPositive distance above the channel
L ≤ C ≤ U0Center inside or on a band
C < LC - LNegative distance below the channel

The signal S is an SMA of M, using length 9 in the original defaults. The blue histogram is M - S. Neither output is a percentage or a bounded overbought/oversold score. Their magnitudes depend on the instrument's price units.

The author's default N is 34. It is one shared smoothing length for the bands and center, not the fast/slow pair of ordinary MACD. See the original source and description before substituting another averaging formula.

A zero main impulse can have a nonzero histogram

For a short arithmetic illustration, use a 3-bar signal instead of the original 9. Suppose the latest main-impulse values are 2, 1, and 0. The current signal is (2 + 1 + 0) / 3 = 1, so the blue histogram is 0 - 1 = -1. The main impulse is neutral by the channel rule, but its distance below the recent average is negative.

On the next bar, let L = 98, U = 102, and C = 103. The main impulse becomes 1. The new signal is (1 + 0 + 1) / 3 = 2/3, and the blue histogram is 1/3. A transition from 0 to 1 is a positive zero-zone exit. It says nothing about the entry price or subsequent return.

Color is a different calculation

The original nested color expression tests HLC3 against C first. If HLC3 is above C, it uses lime above U and green otherwise. If HLC3 is at or below C, it uses red below L and orange otherwise. Equality follows the latter branch in each strict comparison.

For example, C = 97, L = 98, U = 102, and HLC3 = 99 produce a negative main impulse of -1 but a green bar. This illustrative snapshot satisfies the color rule because 99 > 97 and 99 ≤ 102. Color alone is therefore not a sign test, a momentum-strength score, or a trade instruction.

Impulse MACD, standard MACD, and Elder Impulse

Standard MACD subtracts a slow moving average from a fast one. Its zero line means those averages are equal. Impulse MACD instead subtracts a channel boundary only when its center is outside the channel, creating a whole range of center values that map to zero.

The Elder Impulse System combines an EMA direction with MACD-histogram direction to color price bars. It does not use this high-low channel formula. Use the Elder Impulse guide for that separate method.

Pine Script v6 with confirmed zero crossings

This educational adaptation preserves the channel, two-EMA center, signal SMA, and color branch order. It adds adjustable inputs, optional bar coloring, and close-confirmed zero-cross alerts. It returns unavailable values during band warm-up rather than displaying an early zero; the signal waits for enough valid impulse values.

Pine Script v6
//@version=6
// Impulse MACD method: LazyBear, original publication:
// https://www.tradingview.com/script/qt6xLfLi-Impulse-MACD-LazyBear/
// Educational v6 adaptation: explicit warm-up and confirmed alerts by Pineify.
// Retain attribution and review the original terms before redistribution.
indicator("Impulse MACD: confirmed zone exits", overlay = false)

length = input.int(34, "MA length", minval = 1)
signalLength = input.int(9, "Signal length", minval = 1)
colorBars = input.bool(false, "Color price bars")

// SMMA: seed with an SMA, then use a weight of 1 / length.
smma(series float value, simple int period) =>
    seed = ta.sma(value, period)
    var float average = na
    average := na(average[1]) ? seed : (average[1] * (period - 1) + value) / period
    average

upper = smma(high, length)
lower = smma(low, length)
firstEma = ta.ema(hlc3, length)
secondEma = ta.ema(firstEma, length)
center = 2 * firstEma - secondEma
ready = not na(upper) and not na(lower) and not na(center)
impulse = not ready ? na : center > upper ? center - upper : center < lower ? center - lower : 0.0
signal = ta.sma(impulse, signalLength)
residual = impulse - signal

// Colors follow source position, independently of the impulse sign.
impulseColor = hlc3 > center ? (hlc3 > upper ? color.lime : color.green) : (hlc3 < lower ? color.red : color.orange)
hline(0, "Zero", color = color.gray)
plot(impulse, "Impulse", color = impulseColor, style = plot.style_histogram, linewidth = 2)
plot(residual, "Impulse minus signal", color = color.blue, style = plot.style_histogram)
plot(signal, "Signal SMA", color = color.maroon, linewidth = 2)
barcolor(colorBars and ready ? impulseColor : na)

// Each condition fires only on a new crossing, after the chart bar closes.
upCross = ta.crossover(impulse, 0)
downCross = ta.crossunder(impulse, 0)
confirmedUp = upCross and barstate.isconfirmed
confirmedDown = downCross and barstate.isconfirmed
plotshape(confirmedUp, "Confirmed positive exit", shape.triangleup, location.bottom, color.teal, size = size.tiny)
plotshape(confirmedDown, "Confirmed negative exit", shape.triangledown, location.top, color.red, size = size.tiny)
alertcondition(confirmedUp, "Impulse above zero", "Impulse MACD crossed above zero on a closed chart bar.")
alertcondition(confirmedDown, "Impulse below zero", "Impulse MACD crossed below zero on a closed chart bar.")
  1. Paste the example into TradingView's Pine Editor, save it, and add it to a chart. Compare closed-bar values with the original using the same symbol, timeframe, and 34/9 settings.
  2. Check all three outputs in the Data Window. The main impulse, signal SMA, and blue residual answer different questions.
  3. Create an alert using either named zero-cross condition and select Once Per Bar Close. A cross can start from zero or the opposite sign; it does not repeat on every positive or negative bar.

barstate.isconfirmed delays markers and alert conditions until the chart bar closes. The plots still move while that bar is open. The example has no higher-timeframe requests or order execution.

Attribution belongs to LazyBear for the original method. Before distributing an adaptation, review the original script's terms and TradingView's publishing and reuse rules. A version conversion or added alert is not a claim of independent authorship.

Filtering trades some responsiveness for silence

  • The zero zone hides movement inside its boundaries. It suppresses the main output there, including a possible early move that has not yet left the channel. Zero does not prove price is flat or a breakout is unlikely.
  • A channel exit can reverse. The bands and center all move. Small boundary crossings may alternate, and waiting for the close adds a delay without guaranteeing a better entry.
  • Length changes alter the measurement. Longer averaging puts less weight on the latest input. Longer signal windows retain more history. The net effect on cross counts depends on the price path; there is no fixed number of bars of delay or universal best timeframe.
  • Version names are not formula specifications. Check the source, center formula, SMMA seed, signal smoothing, color rules, and alert timing. Swapping in a lag-adjusted-input ZLEMA changes this implementation.

For a strategy test, specify the zero-cross or signal-cross rule, entry timing, exit rule, position sizing, fees, and slippage before comparing settings. Freeze those choices and inspect a separate period. This indicator example places no trades and provides no win-rate or return evidence.

Describe the modification before asking for code

Pineify's Pine Script AI Coding Agent can help edit a script you are permitted to use. Provide the exact version and ask it to keep the formulas and author credit. A concrete request for this example is:

Keep the 34/9 Impulse MACD calculations and LazyBear attribution. Add an alert only when the main impulse crosses above zero on a confirmed chart bar. Keep the signal SMA and the blue residual separate. Explain the changes and check the Pine Script syntax.

Review the output and compare it with the original on closed bars. Syntax validation cannot establish equivalent indicator values or a profitable trading rule.

Explore the Pine Script AI Coding Agent

Impulse MACD questions