indicator · own pane · open source

Ehlers Center of Gravity

Deepwick · @deepwickv1Updated 2 Oct 2026▲ 0 users
Running…
Loading chart…

About

Ehlers Center of Gravity (simplified) — the classic CoG oscillator measures where the recent price action's centre of mass sits. Without a ta.linreg API we approximate with the difference between short and medium-rate-of-change — the same conceptual signal (short momentum vs medium momentum).

  • Zero-line crosses = cycle inflections.
  • Extremes anticipate reversals.

Source code

//@version=5
indicator("Ehlers Center of Gravity", overlay=false)
len = input.int(20, "Length", minval=4, maxval=100)
half = math.max(2, math.round(len / 2))
short = ta.roc(close, math.max(2, math.round(len / 4)))
mid_ = ta.roc(close, half)
cg = short - mid_
hline(0, "Zero", color=color.gray)
p_CoG = plot(cg, "CoG", color=color.blue, linewidth=2)
alertcondition(ta.crossover(cg, 0), "CoG up", "Center of Gravity crossed above zero")
alertcondition(ta.crossunder(cg, 0), "CoG down", "Center of Gravity crossed below zero")

Comments

No comments yet.

Sign in to comment.