# Center of Gravity

Center of Gravity is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Center of Gravity plots Ehlers's balance-point oscillator: the centroid of a 10-bar window of median price, zero-centered and paired with a one-bar-delayed trigger line. Upward trigger crossings cue cycle troughs and downward crossings cue crests, with a directional gradient fill. A low-lag timing tool for traders working ranging markets.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 23, 2026.
- Access: free.
- Concepts: [Center of Gravity](https://www.luxalgo.com/library/concept/center-of-gravity/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=lqeea56digk27wxpo6w9h5zn
- Page: https://www.luxalgo.com/library/indicator/center-of-gravity/

**Center of Gravity** plots the balance point of a rolling price window as an oscillator: each bar's price is weighted by its position, the newest counting 1 and the oldest N, and the negated ratio of the weighted sum to the plain sum is the window's centroid in bar positions. This is the definitive clean build of Ehlers's [Center of Gravity](https://www.luxalgo.com/library/concept/center-of-gravity/), paired with its standard trigger (the same line delayed one bar), whose crossings supply the entire signal grammar.

## How to Trade the Center of Gravity?

- **Cross above the trigger**: a cycle-trough cue, strongest when it fires near the bottom of the oscillator's recent envelope.
- **Cross below the trigger**: a crest cue, read the same way near the top of the envelope.
- **No fixed bounds**: the line carries no universal overbought or oversold levels, so stretch is sized against the oscillator's own recent travel.
- **Pinning**: one color hugging one side of the pane means a persistent trend is loading the window, the cue to stand the counter-trend crossings down.

The tool is a cycle instrument: it earns its keep while price ranges and misleads while price trends, which is exactly the behavior the coloring makes visible.

## Center of Gravity Settings

- **Length** (default 10): the window N whose balance point is measured, the only parameter. The oscillator behaves best near half the dominant cycle length.
- **Source** (default hl2): the price series in the window; the original construction uses the high-low midpoint.
- **Center on Zero** (default on): adds the (N + 1) / 2 offset so the line swings around zero; disabled, the raw centroid rests near -(N + 1) / 2 and the midline follows.
- Style: bullish, bearish, trigger, and midline colors, **Gradient Fill** (default on), and **Trigger Cross Markers** (default off). The crossing alerts fire either way.

## Frequently Asked Questions

### How does it compare with the Fisher Transform?
Both are Ehlers cycle tools read through a one-bar trigger. The [Fisher Transform](https://www.luxalgo.com/library/indicator/fisher-transform/) reshapes normalized price so extremes become sharp turning points; the Center of Gravity tracks the window's centroid instead, giving a smoother line with gentler turns.

### What Length should I use?
The default 10 matches the published examples. Half the dominant cycle you trade is the guideline: shorter windows turn faster and whip more, longer ones smooth the line and delay every crossing.

### Why does the oscillator sit near a negative level instead of zero?
Center on Zero is off. The raw centroid of flat prices rests at -(N + 1) / 2 (around -5.5 at the default length) and the centering option simply re-bases that resting level to zero. Both conventions plot the same information.

## Related indicators

- [Internal Candle Strength](https://www.luxalgo.com/library/indicator/internal-candle-strength/) (Balance of Power): markdown at https://www.luxalgo.com/library/indicator/internal-candle-strength.md
- [Pretty Good Oscillator](https://www.luxalgo.com/library/indicator/pretty-good-oscillator/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/pretty-good-oscillator.md
- [Gator Oscillator](https://www.luxalgo.com/library/indicator/gator-oscillator/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/gator-oscillator.md
- [Wave Trend Oscillator](https://www.luxalgo.com/library/indicator/wave-trend-oscillator/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/wave-trend-oscillator.md
- [Traders Dynamic Index](https://www.luxalgo.com/library/indicator/traders-dynamic-index/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/traders-dynamic-index.md
- [QQE Weighted Oscillator](https://www.luxalgo.com/library/indicator/qqe-weighted-oscillator/) (QQE): markdown at https://www.luxalgo.com/library/indicator/qqe-weighted-oscillator.md
- [5/35 Oscillator](https://www.luxalgo.com/library/indicator/5-35-oscillator/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/5-35-oscillator.md
- [Inverse Fisher Transform](https://www.luxalgo.com/library/indicator/inverse-fisher-transform/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/inverse-fisher-transform.md

---

Source: https://www.luxalgo.com/library/indicator/center-of-gravity/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
