indicator · own pane · open source

Adaptive MACD indicator

Adaptive MACD is a free open-source indicator. Adaptive MACD — fast and slow EMA lengths scale with the Efficiency Ratio. Deepwick Script runs a subset of Pine Script.

v1Updated 3 Oct 2026▲ 0 users
Running…
Loading chart…

What Adaptive MACD does

Adaptive MACD — fast and slow EMA lengths scale with the Efficiency Ratio. Trends compress the windows for sharper crosses; chop widens them so the MACD doesn't whipsaw.

  • Histogram (h) flips are the signal; 0 line is the bias.

Source code

Deepwick Script, a subset of Pine Script · read-only

//@version=6
indicator("Adaptive MACD", overlay=false)
len = input.int(14, "Base length", minval=5, maxval=100)
colorNeutral = input.color("color.gray", "Color  Neutral")
cumAbs = ta.cum(math.abs(ta.change(close)))
sumAbs = cumAbs - cumAbs[len]
er = math.abs(close - close[len]) / math.max(sumAbs, 0.0001)
aFast = na(er) ? 12 : math.max(2, math.min(50, math.round(2 / (0.5 + er * 1.5))))
aSlow = na(er) ? 26 : math.max(aFast * 2, math.min(200, math.round(2 / (0.05 + er * 0.5))))
[m, s, h] = ta.macd(close, aFast, aSlow, 9)
macdH = h
hline(0, "Zero", color=colorNeutral)
p_Histogram = plot(macdH, "Histogram", color=colorNeutral, style=plot.style_columns)
alertcondition(ta.crossover(macdH, 0), "Histogram up", "Adaptive MACD histogram crossed above zero")
alertcondition(ta.crossunder(macdH, 0), "Histogram down", "Adaptive MACD histogram crossed below zero")

Comments

No comments yet.

Sign in to comment.