indicator · own pane · open source
Ehlers Center of Gravity indicator
Ehlers Center of Gravity is a free open-source indicator by @deepwick. Ehlers Center of Gravity (simplified) — the classic CoG oscillator measures where the… Deepwick Script runs a subset of Pine Script.
Running…
Loading chart…
What Ehlers Center of Gravity does
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
Deepwick Script, a subset of Pine Script · read-only
//@version=6
indicator("Ehlers Center of Gravity", overlay=false)
len = input.int(20, "Length", minval=4, maxval=100)
colorLine = input.color("color.blue", "Color Line")
colorNeutral = input.color("color.gray", "Color Neutral")
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=colorNeutral)
p_CoG = plot(cg, "CoG", color=colorLine, 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")
No comments yet.
Sign in to comment.