Center Of Gravity

Center of Gravity
Indicator

MomentumSeparate panelFree on ChartLabs

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.

Example market1hIndicatorsAtlas AICenter of Gravitychartlabs.co/charts
Atlas reads it

Center Of Gravity is 8.419.

Center Of Gravity 8.419

Atlas reads it

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.

1Inconclusive

Stuck at 8.5

Price is not moving, so the weighted average stays at (N + 3) / 2. At 14 that is 8.500.

2Bullish lean

Rising above 8.5

Earlier prices were lower than the more recent ones in the window, so the weighted sum has lifted.

3Bearish lean

Falling under 8.5

The recent prices in the window are the lighter ones.

4Inconclusive

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.

CG=∑(N+2−j)P∑P
STEP 1

Record 0

Print (Periods + 3) / 2. At 14 that is 8.500.

STEP 2

Use earlier prices

The next bar, with one close of 10 behind it, prints 15.000.

STEP 3

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.

SettingDefaultRangeWhat it changes
Periods141 to 500How many earlier bars are weighted. The Signal lens changes this.
SourceCloseAny price, or volumeThe series in the window. The default is the close.
LinewhiteFixedThe 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.
148 earlier bars in the window
70,20866,82563,44360,06164,803.7

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

Ona market that is not movingCGsits near 8.5

That is (14 + 3) / 2. It is the zero of this kernel, not zero itself.

A cross of 8.5

IfCGcrosses 8.5thenthe lagged window has turned

The current close is not in the sum. Traders often look at price itself for the side.

Give record 0 no weight

Thefirst print is8.500by rule

It is not a weighted price. The first real window is the next bar, 15.000 after a single close of 10.

Test a rule in the Strategy TesterFree with 1 year of history. Past results do not guarantee future results.

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 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 indicators

Try Center of Gravity on a live chart.
Free. No download.

Works in your browser and on iPhone too.

Example market1h
CG