Center of Gravity
Indicator
Center of Gravity is a weighted average of earlier prices, shifted so a flat price reads 8.5 at the default length of 14.
John Ehlers, The CG Oscillator, Technical Analysis of Stocks & Commodities, May 2002. This kernel uses the lagged form kept for chart parity. Reviewed by the ChartLabs team, updated Nov 2026.
Center Of Gravity is 8.419.
Center Of Gravity 8.419
Center Of Gravity is 8.419.
Center Of Gravity 8.419
Illustration on simulated data.
Center Of GravityWhat is the Center of Gravity indicator?
Periods is 14, and the maximum is 500, not 5,000. Source is Close. The line colour is the literal white, 1 px, in its own panel, 3 decimals.
Record 0 has no earlier price, so it prints (14 + 3) / 2, which is 8.500. From the next bar, the sum uses only earlier prices. The current bar is left out. One earlier close of 10, at length 14, prints 15.000. A flat series stays at 8.500.
Ehlers's 2002 formula is negative and includes the current bar. This kernel does not match that sign. It weights the previous prices and adds the length offset, which is why a flat price sits at 8.5 instead of a negative number.
Current bar left out
After record 0, the window is the previous Periods bars, or fewer while the chart is short.
The colour is the word white
The plot colour is the string white, not a grey hex.
Center of Gravity signalsFour patterns to know.
Stuck at 8.5
Price is not moving, so the weighted average stays at (N + 3) / 2. At 14 that is 8.500.
Rising above 8.5
Earlier prices were lower than the more recent ones in the window, so the weighted sum has lifted.
Falling under 8.5
The recent prices in the window are the lighter ones.
A turn through 8.5
The weighted window has crossed the flat-price value. The current bar itself is not inside that window.
Center of Gravity formulaHow it is calculated.
Record 0
Print (Periods + 3) / 2. At 14 that is 8.500.
Use earlier prices
The next bar, with one close of 10 behind it, prints 15.000.
Keep the offset
Weights are N + 2 − j on the previous bars only. A flat price stays at 8.500.
Center of Gravity settingsEvery setting, explained.
| Setting | Default | Range | What it changes |
|---|---|---|---|
| Periods | 14 | 1 to 500 | How many earlier bars are weighted. The Signal lens changes this. |
| Source | Close | Any price, or volume | The series in the window. The default is the close. |
| Line | white | Fixed | The colour string is white, 1 px, 3 decimals. |
- Setting
- Periods
- Default
- 14
- Range
- 1 to 500
- What it changes
- How many earlier bars are weighted. The Signal lens changes this.
- Setting
- Source
- Default
- Close
- Range
- Any price, or volume
- What it changes
- The series in the window. The default is the close.
- Setting
- Line
- Default
- white
- Range
- Fixed
- What it changes
- The colour string is white, 1 px, 3 decimals.
Drag to see how the setting changes the lines and how many signals you get. Illustration on simulated data.
Center of Gravity strategiesUse it in 3 setups.
Know the flat reading
That is (14 + 3) / 2. It is the zero of this kernel, not zero itself.
A cross of 8.5
The current close is not in the sum. Traders often look at price itself for the side.
Give record 0 no weight
It is not a weighted price. The first real window is the next bar, 15.000 after a single close of 10.
Center of Gravity mistakesCommon mistakes.
Expecting a negative oscillator
The 2002 article prints a negative value and includes the current bar. This chart's line is the lagged form, positive on a flat series.
Thinking the colour is grey
The plot colour is the string white. It is not #999999.
Using the current close in a hand calculation
After record 0 the current bar is left out. Adding it will not match the line.
Center of Gravity combinationsPair it with these.
Center of Gravity + Relative Strength Index
RSI is a 0 to 100 momentum average. Center of Gravity is a weighted price position with a flat reading of 8.5.
Center of Gravity + EMA
The EMA includes the current close. This line waits until the next bar to include today's close.
Center of Gravity + CCI
CCI measures distance from an average in mean-deviation units. This line is the weighted slot of earlier prices.
Center of Gravity FAQQuestions traders ask.
What are the Center of Gravity settings?
Periods 14 and source Close. Periods stops at 500.
What is the flat reading?
8.500 at the default, which is (14 + 3) / 2. A later flat series stays there.
What is the one-bar example?
Record 0 is 8.500. Record 1, after a close of 10, is 15.000.
What colour is the line?
The colour is the string white, 1 px, three decimals.
Does it match the 2002 article's sign?
No. The article is negative and includes the current bar. This kernel lags by one bar and adds N + 2.
Does it repaint?
No. A closed bar stays. The live bar moves until it closes, and it is not inside its own sum.
Who published the oscillator?
John F. Ehlers, The CG Oscillator, Technical Analysis of Stocks & Commodities, May 2002.
Why is record 0 not blank?
The kernel writes the constant-price value there, because there is no previous price to weight.
Related indicatorsMore momentum tools.
All momentum indicatorsTry Center of Gravity on a live chart.
Free. No download.
Works in your browser and on iPhone too.