Skip to content

    Center of Gravity Oscillator: Formula, Nifty Example and Indian Trading Guide

    Quick answer

    Center of Gravity Oscillator explained with a worked Nifty calculation, options P&L in rupees, best settings, and Indian F&O tax rules.

    19 June 2026
    14 min read
    2,605 words

    Key Takeaways

    • 1.The Center of Gravity Oscillator (CG) was created by John Ehlers in 2002 and measures where the weighted balance point of recent prices sits, which lets it turn slightly ahead of price instead of lagging like a moving average.
    • 2.The core formula is a price weighted average: multiply each of the last N closes by its age, add them, divide by the plain sum of those closes, then flip the sign so the line moves with price.
    • 3.On a Nifty chart a 10 bar CG crossing its one bar signal line is a cleaner entry trigger than the raw zero line, because the raw CG number drifts with price level and is not naturally centred on zero.
    • 4.In choppy NSE sessions the CG whips back and forth and gives many false crossovers, so it works best on liquid, trending names like Nifty, Bank Nifty and HDFC Bank, filtered by a trend or volume check.
    • 5.Any rupee figures below are illustrative for learning the mechanics. F&O profits are taxed as business income at your slab, not as capital gains, and no indicator guarantees a profitable trade.

    What the Center of Gravity Oscillator Actually Measures

    The Center of Gravity Oscillator, usually shortened to CG, was published by John Ehlers in 2002. The idea is borrowed from physics. If you treat the last N closing prices as weights on a seesaw, the CG is the balance point of that seesaw. When recent prices are heavier near the new end of the window, the balance point shifts and the oscillator moves before a lagging average would. That is why Ehlers called it a near zero lag indicator, not a leading one in any magical sense.

    In plain terms, the CG answers one question: across the last few bars, is the weight of price building toward the most recent bars or fading away. A rising CG means buyers are pushing the balance point forward, a falling CG means the weight is slipping back. Because it reacts to that shift in momentum rather than to raw price, it tends to flatten and curl at swing highs and lows a bar or two before a simple moving average does. But it is still a windowed average that cannot see the future, and weighting newer bars makes it noisy, so on ranging Nifty and Bank Nifty sessions it crosses its own signal line many times with no real move following. Treat it as a timing tool that needs a trend filter, not a standalone buy and sell machine.

    The Exact Formula, Spelled Out

    Ehlers defined the CG over a window of N bars. Label the most recent close as index 0, the bar before it as index 1, and so on back to index N minus 1. The numerator is the sum of each close multiplied by one plus its index, which gives older bars a larger weight, and the denominator is the plain sum of those same closes. The result is negated so the oscillator rises when price rises.

    Written out, CG = minus (sum over i from 0 to N minus 1 of (1 plus i) times Price[i]) divided by (sum over i from 0 to N minus 1 of Price[i]). The negative sign is the part most people get wrong. Without it the line moves opposite to price. Many platforms also subtract a constant to recentre the line near zero, but the crossover signals do not depend on that cosmetic shift.

    • Pick a window N. Ehlers used 10 bars. For intraday Nifty, 10 on the 5 minute chart is a sensible start.
    • Take the last N closes and label the newest as index 0, working backwards.
    • Multiply each close by (1 plus its index) and add those products together. This is the numerator.
    • Add up the same N closes with no weighting. This is the denominator.
    • Divide numerator by denominator, then multiply by minus one. That number is today's CG value.
    • Plot a 1 bar lag of the CG as a signal line. A CG cross above its signal line is the buy trigger, a cross below is the sell trigger.
    Why use the signal line, not the zero line

    The raw CG number drifts with the price level of the instrument, so on Nifty near 23,000 it is a large negative figure that is never really at zero. The standard CG crossover signal compares the CG to its own one bar delayed value. That self referencing cross is far more reliable than waiting for an arbitrary zero crossing.

    A Fully Worked Nifty Example, Step by Step

    Let us compute a 5 bar CG on the Nifty 50 spot using illustrative 5 minute closes from a morning session. Five bars keeps the arithmetic readable. The closes, newest first, are index 0 equals 23,180, index 1 equals 23,165, index 2 equals 23,150, index 3 equals 23,140, and index 4 equals 23,120. These are realistic Nifty levels and illustrative only.

    Index i (0 = newest)Close (Rs)Weight (1 + i)Close x Weight
    023,180123,180
    123,165246,330
    223,150369,450
    323,140492,560
    423,12051,15,600
    Totals1,15,7553,47,120

    The denominator is the plain sum of the five closes, 23,180 plus 23,165 plus 23,150 plus 23,140 plus 23,120 equals 1,15,755. The numerator is the sum of the Close times Weight column, 23,180 plus 46,330 plus 69,450 plus 92,560 plus 1,15,600 equals 3,47,120. Dividing gives 3,47,120 divided by 1,15,755 equals 2.9987, and applying the negative sign gives a raw CG of minus 2.9987.

    That single number means little alone, which is the point. Now slide the window forward by one bar. Suppose the next close prints 23,205, so the new window, newest first, is 23,205, 23,180, 23,165, 23,150, 23,140. The new denominator is 1,15,840 and the new numerator is 3,47,360, giving a raw CG of minus 2.9986. The CG ticked up from minus 2.9987 to minus 2.9986. The move is tiny because the price level dominates the maths, but the slope just turned positive, and a CG crossing above its prior value is the bar where the standard CG signal flips bullish on Nifty.

    Turning the Signal Into a Real Nifty Options Trade

    An indicator value is academic until you size a position. Say the CG bullish cross prints with Nifty spot at 23,205 around 10:00 am on a weekly expiry day, and you buy one lot of the at the money 23,200 weekly call. Nifty's F&O lot size is 65, set by SEBI and NSE. Assume the 23,200 call is quoted at Rs 90. Your outlay is 90 times 75 equals Rs 6,750 plus charges, and that premium is also your maximum loss if the move fails.

    Now assume the CG read the shift correctly and Nifty grinds up to 23,280 over the next hour, lifting the call premium to roughly Rs 135. You exit. Gross profit is (135 minus 90) times 75 equals 45 times 75 equals Rs 3,375 before costs. This is illustrative, not a typical or guaranteed result. Many CG signals fail, and on those the premium decays from 90 toward 60 or lower as time and a flat move eat the option, capping your loss at the Rs 6,750 paid.

    Costs matter on a trade this size. Brokerage on a discount broker is about Rs 20 per order, so Rs 40 round trip. STT on options is 0.1 percent of the premium value on the sell leg only, here 0.1 percent of Rs 10,125, about Rs 10. Add exchange charges, GST, SEBI fees and stamp duty and the all in cost is roughly Rs 70 to Rs 90. Net profit is therefore near 3,375 minus about 80, close to Rs 3,295, and the exact figure depends on your broker.

    ItemCalculationAmount (Rs)
    Buy 1 lot 23,200 CE90 x 655,850 outlay
    Sell same lot135 x 658,775 received
    Gross profit(135 - 90) x 652,925
    Brokerage round tripapprox 20 x 240
    STT on sell premium0.15% x 8,77513
    Other charges + GST (approx)exchange, SEBI, stamp, GST30
    Net profit (illustrative)2,925 - 83approx 2,842

    Best Settings for Nifty, Bank Nifty and NSE Stocks

    There is no single best period, only sensible defaults. Ehlers original window was 10 bars. On Indian intraday charts a 10 period CG on the 5 minute Nifty or Bank Nifty chart balances responsiveness and noise. Shorter windows like 5 whipsaw more, which on a fast mover like Bank Nifty can mean a dozen false flips in a sideways hour. Longer windows of 15 to 20 smooth the line for swing trading on daily charts of Reliance, TCS or HDFC Bank. Match the window to the instrument's volatility and your holding period, then keep it fixed, because constantly retuning to fit recent bars is curve fitting that will not hold up live.

    Instrument and styleTimeframeCG period to testNotes
    Nifty intraday5 minute10Filter with VWAP or a 20 EMA trend check
    Bank Nifty intraday5 minute8 to 10More volatile, expect more false flips
    Index swing tradesDaily14 to 20Smoother line, fewer but cleaner signals
    Liquid stocks (Reliance, TCS, HDFC Bank)Daily14Avoid illiquid mid and small caps

    How to Read Signals Without Fooling Yourself

    The cleanest CG signal is the crossover of the CG line and its one bar signal line, as in the worked example: crossing above is bullish, crossing below is bearish. Slope matters too, since a CG rising and accelerating shows building upward weight, while a CG rising but flattening warns the move is tiring. The most powerful read is divergence: if Nifty prints a higher high but the CG prints a lower high, the new high is not backed by a forward shift in weight and a pullback is more likely. Bearish divergence where Nifty fails at a prior swing high is a far stronger short setup than a bare crossover in the middle of a range.

    • Take long CG crossovers only when price is above a rising 20 EMA or above VWAP, so you trade with the intraday trend.
    • Ignore CG flips that happen inside a tight, low volume range, which is where false signals cluster.
    • Treat CG divergence against a clear support or resistance level as your highest quality signal.
    • Exit on the opposite CG cross or on a fixed stop, do not wait for the indicator to confirm a loss you can already see in price.

    CG Oscillator Versus RSI, Stochastic and MACD

    The CG is closest in spirit to a fast stochastic but is built from a weighted average rather than a high low range, so it curls a touch earlier and is smoother. The Relative Strength Index measures the strength of up moves versus down moves, a different question, which makes RSI and CG complementary rather than redundant.

    IndicatorWhat it measuresLagBest paired use on NSE
    CG OscillatorBalance point of recent pricesVery lowTiming entries inside a known trend
    RSIRelative strength of gains vs lossesModerateOverbought and oversold and divergence filter
    StochasticClose position within recent rangeLowSimilar to CG, can be redundant with it
    MACDDifference of two moving averagesHigherConfirming the broader trend direction

    Limitations, False Signals and Risk Control

    The CG's biggest weakness is the flip side of its strength. Because it weights recent bars heavily, it is twitchy. In a sideways Nifty session it crosses its signal line repeatedly with no follow through, and each whipsaw costs brokerage, STT and slippage even when price barely moves. On expiry afternoons, when option premiums decay fast, a string of false CG flips can quietly bleed an account.

    There is also event risk no oscillator handles. Around RBI policy, the Union Budget, monthly F&O expiry or a major global cue, Nifty and Bank Nifty can gap and spike in ways that make any windowed indicator briefly meaningless. The defence is position sizing and stops, not a better setting. Risk a small, fixed fraction of capital per trade, set the stop before you enter, and accept that a fair share of CG signals will fail.

    Tax reminder for F&O traders

    Profits from Nifty and Bank Nifty futures and options are treated as business income in India and taxed at your slab rate, not as capital gains. The 20 percent short term and 12.5 percent long term capital gains rates apply to delivery equity, not to F&O. Keep a clean trade log because F&O turnover and audit rules can apply. This is general information, not tax advice, so confirm with a professional.

    A Simple, Disciplined CG Workflow

    • Choose one instrument and timeframe, for example Nifty on the 5 minute chart, and a fixed CG period of 10.
    • Confirm the trend with VWAP or a 20 EMA before you accept any CG signal.
    • Take only CG crossovers in the direction of that trend, or clean CG divergences at support or resistance.
    • Size the position so a single losing trade costs a small, fixed fraction of capital, and set the stop before entry.
    • Record entry, exit, the CG reading and the result in a trading journal, then review the win rate across many trades, not one.

    Sources and Further Reading

    For authoritative data and further reading on this topic, refer to Zerodha Varsity, Investopedia and NSE India. Always confirm current rules, rates and contract specifications on the official source before you trade.

    Sources and Further Reading

    For authoritative data and further reading on this topic, refer to Zerodha Varsity, Investopedia and NSE India. Always confirm current rules, rates and contract specifications on the official source before you trade.

    Related Topics

    Center of Gravity OscillatorIndian stock marketNSEBSEtrading indicators

    Related Articles

    OneTradeJournal

    The trading journal built for Indian F&O traders. Track your trades, spot patterns, build discipline.

    • Log one trade a day by hand, on purpose
    • AI mentor finds your repeat mistakes
    • Behavioural analytics catch tilt early
    • Trading calendar with P&L heatmap
    • Pre-trade checklist flags risks
    Start journaling

    Yearly ₹2,499 · No broker credentials