The rolling Chande Momentum Oscillator (CMO) measures the balance of gains and loss magnitudes over a fixed number of closing-price changes. This guide uses retained USD/JPY H1 quotes to show the full calculation. Its three examples separate a zero cross, a return from below −50, and a rising close accompanied by a falling CMO.
1. Identify the rolling-sum version
For each completed close, split its change into a gain and a positive loss magnitude. Sum each over the last N changes. CMO is 100 times their difference divided by their total. It ranges from −100 to +100 when the total is positive; it has no price unit and is not a return percentage.
Check the implementation before comparing platforms. TA-Lib distinguishes its unsmoothed CMOU from its Wilder-smoothed CMO. This guide follows the plain rolling-sum definition and adds no signal-line smoothing. Its fixed 9/14/20 periods are disclosed choices, not a universal default.
If every change in the window is zero, the denominator is zero. We mark the reading unavailable. TA-Lib CMOU instead documents zero for a flat window. That explicit convention difference matters when comparing displays; this guide does not claim terminal equivalence.
2. Count N changes and N+1 closes
Let ΔC be the current retained close minus the preceding retained close. A gain is max(ΔC,0); a loss magnitude is max(−ΔC,0). G and L are the respective N-change totals. Unchanged closes add zero to both totals. Fourteen changes therefore span fifteen closes.
The numerator G−L also equals current close minus the close N observations earlier. The denominator G+L is the total absolute path over those changes. For the same unsmoothed sums, 100×G/(G+L)=(CMO+100)/2. This identity does not generally convert the rolling CMO into Wilder’s smoothed RSI.
G[N,t] = Σ max(ΔC, 0)
L[N,t] = Σ max(−ΔC, 0)
CMO[N,t] = 100 × (G−L)/(G+L) (G+L > 0)
G−L = C[t] − C[t−N]
| Calculation component | Value |
|---|---|
| G · gain total · JPY per USD | 1.150 |
| L · loss magnitude total · JPY per USD | 0.920 |
| G−L · JPY per USD | +0.230 |
| G+L · JPY per USD | 2.070 |
| Rolling CMO | +11.111111 |
| 100×G/(G+L) · % | 55.555556 |
3. Read the zero cross at the declared period
At 2024-01-31 01:00 UTC, G14 is 1.150 and L14 is 0.920 JPY per USD. Their difference is +0.230, their total 2.070, and CMO14 is +11.111111, up from −1.463415. The close rises from 147.340 to 147.480. This is a fresh upward zero cross at period 14.
The rule requires previous CMO≤0 and current CMO>0; staying positive is not a new cross. At this exact hour, CMO9 is −41.176471 and CMO20 is +4.545455. Even the sign can differ by lookback. Switching the period in the explorer keeps this hour fixed rather than finding a different example.
4. Return above −50 while the close falls
At 2024-02-06 19:00 UTC, CMO14 moves from −51.428571 to −46.456693. It returns from below −50 while remaining negative. Yet the close falls from 147.900 to 147.870: the newest change is −0.030, not a price rebound.
The old −0.160 change leaves the window as the smaller −0.030 decline enters. G14 stays 0.340; L14 falls from 1.060 to 0.930. The ratio improves because the window changes. Here a return requires previous CMO<−50 and current CMO≥−50. Exactly −50 counts as back inside our illustrative band.
The −50/+50 lines are reading aids, not instructions to trade against a trend. A band return can occur without a rising close, as this example shows. Entries, invalidation, exits and costs would require a separate strategy definition and test.
5. Follow the change that leaves the window
At 2024-01-30 23:00 UTC, the close rises from 147.580 to 147.590, adding +0.010. The outgoing gain is much larger: +0.210. G14 falls from 1.210 to 1.010, L14 stays 0.840, and CMO14 falls from +18.048780 to +9.189189. A higher close can accompany a weaker rolling balance.
The update is previous gain total + incoming gain − outgoing gain, with the same rule for loss magnitudes. The outgoing change is the one immediately before the new N-change window. Its calculation can need a close outside the visible chart; hiding that close does not remove it from the calculation.
There is no EMA starting value in this version. Once the required N+1 closes are present, older prices outside that window have no effect on its current CMO. This differs from a recursively smoothed series. A longer period changes the observations retained; it does not guarantee a better trading result.
| Rolling period · changes | Value |
|---|---|
| CMO 9 | +6.293706 |
| CMO 14 | +9.189189 |
| CMO 20 | +7.359307 |
6. Separate available values from a clean observation
We calculate on the last N retained changes, including partial hours. After a gap, the next change uses the previous retained close; missing prices and hours are not invented. The explorer reports whether the active N-change window contains partial hours or gaps.
For a fresh-cross label, both the current and previous windows must contain complete, adjacent hours and positive denominators. Values after a gap can still exist while the event is not classified. Adjacent hours across UTC midnight are allowed. Crosses use exact unrounded comparisons, not the six displayed decimals.
The retained sample contains 11 flat 14-change windows with zero denominators. These are recorded windows, not a claim of 11 complete tradable hours. Unavailable is distinct from a valid CMO of zero: equal nonzero gains and losses produce a genuine zero reading.
7. Explore the fixed cases and window totals
Choose one of the three cases, then compare 9/14/20 without moving its selected hour. Move through earlier observations to inspect incoming and outgoing changes, G, L, CMO, window quality and fresh events. Choosing 40 or 80 visible bars changes only the display. A marks an observation; no entry, exit or profit is attached.
Loading retained historical readings…
CMO 14
CMO · gold / −50,+50 · dashed / A · observation
The chart ends at A. Earlier retained closes outside the visible crop still contribute to the calculation.
- H1 end · UTC
- —
- Close · JPY per USD
- —
- Incoming ΔC · JPY per USD
- —
- Rolling CMO
- —
- CMO versus zero
- —
- Illustrative −50/+50 band
- —
- Fresh closed-bar observation
- —
- Current recorded hour
- —
- Active calculation window
- —
Inspect the window totals
- Outgoing ΔC · JPY per USD
- —
- G · gain total · JPY per USD
- —
- L · loss magnitude total · JPY per USD
- —
- G−L · JPY per USD
- —
- G+L · JPY per USD
- —
- 100×G/(G+L) · %
- —
- Window start close · UTC
- —
- Recorded bars before this observation
- —
Cases were selected at CMO14. Changing 9/14/20 keeps the same hour and can change its sign or event. This is the rolling-sum version.
Frequently asked questions
How many closes does CMO14 require?
Fourteen price changes require fifteen closes. This is the first possible full window; the reading is still unavailable if all fourteen changes are zero.
Is CMO always 2×RSI−100?
The identity holds when both ratios use exactly the same unsmoothed gain and loss sums and a positive denominator. It does not generally equate this rolling CMO with Wilder RSI. A Wilder-smoothed CMO uses a different history.
Can the close rise while CMO falls?
Yes. At 2024-01-30 23:00 UTC, a +0.010 gain enters while a +0.210 gain leaves. G14 drops from 1.210 to 1.010, and CMO14 falls from +18.048780 to +9.189189.
Does returning above −50 guarantee a rebound?
No. At 2024-02-06 19:00 UTC, CMO14 returns above −50 while the last close falls. The old loss leaving the window changes the ratio. This is an observation, not a complete trading rule.
Why is a flat window unavailable here?
Its denominator G+L is zero. We expose that condition rather than substitute a number. Other implementations may return zero, so check the flat-window convention as well as the smoothing.
Are the charts real and is this a trading backtest?
The candles are reconstructed from retained historical Forexite quotes. This is an indicator guide with reproducible calculation checks. It defines no executed trades or strategy returns.
Data, calculation choices and scope
The guide reuses 375,702 retained USD/JPY M1 records from Forexite’s 2024 Trade/MetaStock archives. Fixed GMT+1 labels are shifted back one hour to UTC. Minute labels are interval ends; H1 buckets are (start,end]. These are explicit reconstruction choices.
The 6,265 recorded H1 bars include 6,178 complete and 87 partial hours, with 52 gaps before recorded hours. The original daily ZIPs were not downloaded again. Source URLs and checksums accompany the retained minute input in the downloadable package.
One calculation uses exact integer gain/loss sums and 55-digit ratios. A separate 80-digit calculation rebuilds the hours and derives the sums from endpoint displacement and total absolute variation. Both were written by the same assistant; this checks reproducibility, not outside or terminal certification.
The reading CSV contains all hourly values for 9/14/20. The events CSV records availability and exact classifications from the full history. The ZIP includes the fixed specification, retained input, both programs and verification results. Reproduction instructions stay in the download.



