Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.
What Is This Strategy?
The Center Of Gravity Oscillator Reversal is a swing-trading strategy built around John Ehlers' Center of Gravity (COG) oscillator, a low-lag momentum indicator that measures where the "weight" of recent price action is concentrated within a lookback window. Instead of chasing breakouts, this is a mean-reversion / cycle-turning approach: it waits for the oscillator to form a confirmed turning point and then trades in the direction of the expected swing.
The Center of Gravity oscillator works much like the physical concept it borrows its name from. It calculates the price-weighted "balance point" of the last several bars. When recent bars carry more of the price mass, the oscillator leans positive (relative strength); when older bars dominate, it leans negative (relative weakness). Because the COG is a ratio of price sums, it is naturally normalized — it does not scale with the absolute price of the instrument, so the same threshold levels behave consistently on EUR/USD, gold, or any other symbol.
This strategy is designed for ranging or cyclic market conditions on intraday timeframes, and it is best treated as a learning tool for traders who want to understand oscillator-based reversal logic, pivot confirmation, and volatility-adaptive risk placement. It is well suited to cyclic majors and metals such as EUR/USD or XAU/USD, though the underlying code is timeframe-agnostic. If you are studying how cycle-turning indicators translate into concrete entry rules, this strategy offers a clean, transparent example.
How It Works
The strategy processes one closed bar at a time. On each newly completed bar it recalculates the oscillator, smooths it, and checks whether a turning point has just been confirmed. Here is the logic in plain English:
- Building the oscillator: For each bar the strategy uses the median price — the midpoint of the high and low,
(High + Low) / 2. Over the lastCgPeriodbars it computes the raw Center of Gravity, a centered value that oscillates around zero. A value above zero means price weight leans toward recent bars; below zero means it leans toward older bars. - Smoothing: The raw COG is passed through an EMA (Exponential Moving Average) of length
SmoothPeriod. An EMA is a weighted average that reacts faster to recent data than a simple average, which reduces noise while keeping the oscillator responsive. - Confirming a turning point: The strategy keeps the last three smoothed values and looks at the middle one as a candidate pivot. It only acts once that pivot is confirmed by the value that follows it — this avoids reacting to a turn that has not actually formed yet.
- Long (buy) signal: The strategy signals a long entry when a smoothed trough (local minimum) is confirmed while the oscillator is below zero. This represents a cyclic swing low forming in the weaker half of the cycle — in other words, "buy the dip" logic.
- Short (sell) signal: The strategy signals a short entry when a smoothed peak (local maximum) is confirmed while the oscillator is above zero. This represents a cyclic swing high forming in the stronger half of the cycle — "sell the rally" logic.
- One position at a time: The strategy allows only a single open position per magic number. If a trade is already live, new signals are ignored until it closes.
Stop-loss and take-profit logic are both derived from the ATR (Average True Range), an indicator that measures recent volatility:
- The stop distance is calculated as
ATR × StopMult. When volatility rises, stops widen; when it falls, stops tighten. This helps the risk placement adapt to current market conditions rather than using a fixed pip value. - The take-profit distance is the stop distance multiplied by
RewardRatio. With the default settings, the target is placed 1.5 times as far as the stop, defining the intended risk-to-reward profile of each trade. - For a long, the stop sits below the entry and the target above it; for a short, the stop sits above and the target below. Once the order is placed, the ATR-based stop and target manage the trade to completion.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| CgPeriod | 10 | 5 | 40 | Number of bars in the Center of Gravity lookback window. Larger values produce a slower, smoother oscillator; smaller values react faster but are noisier. |
| SmoothPeriod | 3 | 1 | 12 | EMA smoothing period applied to the raw COG. Higher values suppress noise but add lag to pivot confirmation. |
| AtrPeriod | 14 | 5 | 50 | Number of bars used to calculate ATR for volatility-scaled stops and targets. |
| StopMult | 1.6 | 0.5 | 4.0 | ATR multiple that sets the stop-loss distance. Larger values give wider stops and more room, at the cost of larger risk per trade. |
| RewardRatio | 1.5 | 0.5 | 5.0 | Take-profit distance as a multiple of the stop distance. A value of 1.5 targets 1.5 units of reward per 1 unit of risk. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade volume in lots for each position. |

Recommended Chart Settings
The Center Of Gravity Oscillator Reversal strategy was designed with cyclic majors and metals in mind — for example EUR/USD or XAU/USD (gold) — traded on intraday timeframes such as M15, M30, or H1, where short-term cyclic swings are more pronounced. Because the oscillator is self-normalizing, the same default parameters can be applied across instruments without rescaling thresholds.
That said, the code is timeframe-agnostic and will run on whatever primary symbol and timeframe you attach it to. Results will vary considerably across different symbols, timeframes, and market conditions, so treat these as starting points for study rather than fixed rules. Always test any configuration on historical data and a demo account before drawing conclusions.
How to Install on MetaTrader 5
- Download the .ex5 file from the link below.
- Copy it to your MT5
MQL5\Expertsfolder. - Restart MetaTrader 5 or refresh the Navigator panel.
- Drag the EA onto a chart matching the recommended symbol and timeframe.
- Configure the input parameters and enable Algo Trading.
What to Consider Before Using This EA
Like any single-indicator system, this strategy has clear strengths and equally clear limitations, and understanding both is the point of studying it.
Strengths:
- The Center of Gravity oscillator is a low-lag indicator, so confirmed turns tend to arrive earlier than they would with slower moving-average crossovers.
- Because the oscillator is normalized, the logic behaves consistently across instruments, which makes it a good teaching example of scale-invariant indicator design.
- Risk placement is volatility-adaptive through ATR, so the strategy automatically adjusts stop and target distances as conditions change.
- The rules are transparent and fully mechanical — every entry has a defined reason, stop, and target.
Limitations:
- Mean-reversion and cycle-turning systems typically struggle in strong trending markets. When price trends persistently, the oscillator can keep signaling reversals against the move, which historically leads to a string of stopped-out trades.
- The pivot confirmation requires three smoothed values, which introduces a small amount of lag. In fast markets, the confirmed turn may arrive after part of the swing has already occurred.
- A fixed lot size does not scale risk to account equity or to the varying stop distances the ATR produces, so risk per trade is not constant.
- The single-position rule means the strategy may sit out of the market while a valid setup develops on another symbol or while an existing trade is open.
This strategy is best understood as an educational framework for oscillator-based reversals — not a finished, hands-off system. Its behavior in a live-like environment depends heavily on the symbol, timeframe, and prevailing regime.
Risk Management Tips
Sound risk management matters far more than any single entry signal. Whether you are studying this strategy or any other, keep these principles in mind:
- Risk a small, fixed fraction per trade. A common guideline is to risk no more than 1–2% of your account on any single position. With a fixed lot size, you may need to adjust the
Lotsparameter so that the ATR-based stop distance corresponds to that fraction of your equity. - Understand drawdown. Even a well-constructed strategy will experience losing streaks. Know the maximum drawdown you are prepared to tolerate before you begin.
- Start on a demo account. Test the strategy on a demo or historical data first so you can observe how it behaves across trending, ranging, and volatile conditions without financial exposure.
- Respect the reward ratio. The
RewardRatioparameter defines the intended risk-to-reward profile. Changing it alters not just target distance but the win rate you would need to break even. - Never over-leverage. Leverage magnifies both gains and losses. Size positions conservatively and account for spread, slippage, and swap costs.
Risk Warning
Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.
Downloads
- Expert Advisor: CenterOfGravityOscillatorReversal.ex5 (2 downloads)
- Source Code: CenterOfGravityOscillatorReversal.mq5 (2 downloads)
- Documentation: CenterOfGravityOscillatorReversal.pdf (3 downloads)