Markets › Metals · XAUUSD spot (broker data), 1-hour
CCI Indicator Strategy on Gold: Lambert's ±100 Rules Backtested on 1-Hour Bars
Donald Lambert's Commodity Channel Index, CCI(20), traded four common ways on XAUUSD 1-hour bars from 2004 to 2026, with costs, swap scenarios and a control.
Buried · No proven edgeFour ways to read the CCI. None paid for its costs.
Variants tried: 4 · Passed every gate: 0 · Holdout opened: yes (already used)
Short answer: not in our test. The CCI (20) on gold 1-hour bars from 2004 to 2026, traded Lambert's way (long above +100, short below -100), long only, back inside ±100 or on the zero line, did not pass. The trend versions made only +0.032 R to +0.064 R a trade before costs, less than the costs of about 0.071 R; the reversal lost even before costs. All four versions were buried.Compare all 20 gold strategies we tested →
00The verdict in three lines
- The CCI (20) on gold 1-hour bars from 2004 to October 2026, traded four common ways: Lambert's rule (long above +100, short below -100, and its long side alone), the reversal back inside ±100, and the zero-line cross. Positions are held overnight, with $0.30 an ounce of costs a trade, and rules, gates and a control fixed before the run.
- None of the four versions passed. The trend versions made +0.032 R to +0.064 R a trade before costs, less than the 0.071 R of costs, so in R they lost a little; the reversal lost even before costs. In dollars per ounce the long-only and zero-line versions ended positive (+$548 and +$387 over 22 years), because recent trades at high gold prices weigh more in dollars.
- On all trades the trend versions beat the control (their own positions shifted in time, percentile 99.8 or higher), but that rested on a minority of trades held for many hours, many of them across suspect gaps in the data. Without the trades flagged by rule 3, they rank at percentiles 1.0, 5.2 and 0.0 of their controls (see the data notes).
01The rule
The indicator: Donald Lambert's Commodity Channel Index (1980), made for commodities. With the typical price TP = (high + low + close) / 3 of each 1-hour bar, CCI = (TP − its 20-bar average) / (0.015 × the mean absolute deviation of the same 20 values). Above +100 and below −100 are the classic signal levels, and zero is the mean. 20 is the period most often quoted for the CCI and TradingView's default (MetaTrader's default is 14).
Trading: at each 1-hour close the rule sets a position (long, short or flat); a change fills at the open of the next minute, and a reversal closes and opens at the same price. No stop and no target beyond the indicator, as the rules are taught; positions are held overnight and over weekends, as in our other gold 1-hour tests.
- CCI-BRK-LS (Lambert): long from the close where the CCI crosses above +100 until it is back at or below +100; short from the close where it crosses below −100 until it is back at or above −100; flat in between.
- CCI-BRK-L: the long side of that rule only.
- CCI-REV-LS (the reversal): long when the CCI comes back above −100, out at zero or if it falls back to −100; short when it comes back below +100, out at zero or if it rises back to +100.
- CCI-ZERO-LS: long while the CCI is above zero, short while it is below, always in the market.
Many strategies have been tested on this gold file before (our gold guide compares them), so the development t-statistic needed is 2.5. No CCI had been computed on this site before.
02Data and costs
Data: XAUUSD 1-minute bid prices from a broker's MetaTrader history (IC Markets), June 2004 to 7 October 2026, the file of all our gold tests; 1-hour bars are built from it on the New York clock. The prices are not republished. R, the unit of the results, is 1.5 times the 14-bar average true range at the signal bar, in dollars per ounce; it scales results to the volatility of the day, so a trade in 2005 counts as much as one in 2025. It is a unit, not a stop. Costs: $0.30 an ounce a round trip, as in our other gold tests, with no slippage; two financing scenarios for the nights a position is held are in the data notes.
Engine check: the trades were computed twice. Our engine (cci_lib.js) and an independent re-implementation (cci_ref.js), written by a separate AI agent from the frozen specification, the data loader and a few implementation facts we gave it (listed at the top of that file), without our engine's code, agree on every one of the 42,322 trades. The agent reported only trade counts before the self-test; one reading of the reversal rule that it found ambiguous (an opposite signal while a position is held, 5 cases) was settled before any result, and the agent changed its reference to it (see the run log). cci_selftest.js also checks the CCI against a hand calculation, hand-built signals and fills, and the control (cci_selftest_result.txt).
03Results
Results in R, and the net in dollars per ounce. The 95% range is the Wilson interval for the win rate. The drawdown is on closed trades.
| Variant | Version | Trades | Net after costs | Net per trade | Gross per trade | Net, $ per ounce | Winners (95% range) | Profit factor | Drawdown on closed trades | Verdict |
|---|---|---|---|---|---|---|---|---|---|---|
| CCI-BRK-LS | long above +100, short below -100 (Lambert) | 11,900 | -459 R | -0.039 R | +0.032 R | -$1,359 | 31.4% (31% to 32%) | 0.91 | -496 R | Buried |
| CCI-BRK-L | the long side of Lambert's rule | 6,111 | -47 R | -0.008 R | +0.064 R | +$548 | 33.0% (32% to 34%) | 0.98 | -139 R | Buried |
| CCI-REV-LS | back inside ±100, out at zero | 11,894 | -1,326 R | -0.111 R | -0.043 R | -$7,149 | 47.2% (46% to 48%) | 0.73 | -1,328 R | Buried |
| CCI-ZERO-LS | the side of the zero line, always in | 12,417 | -138 R | -0.011 R | +0.060 R | +$387 | 26.1% (25% to 27%) | 0.98 | -261 R | Buried |
Cumulative net result by month, in R.
In dollars the long-only and zero-line versions ended positive (+$548 and +$387 an ounce over 22 years) while they lost in R: a trade in 2025, with gold above $3,000, moves far more dollars than one in 2005 at $450, so the dollar total is dominated by the last years. Per R, every year counts the same.
By period
| Variant | Development 2004-2012 (trades) | Validation 2013-2019 (trades) | Holdout* 2020 to Oct 2026 (trades) | Development t | Validation PF |
|---|---|---|---|---|---|
| CCI-BRK-LS | -393 R (4,534) | -56 R (3,684) | -11 R (3,682) | -4.59 | 0.96 |
| CCI-BRK-L | -112 R (2,395) | +2 R (1,792) | +64 R (1,924) | -1.89 | 1.00 |
| CCI-REV-LS | -729 R (4,532) | -324 R (3,681) | -273 R (3,681) | -11.87 | 0.77 |
| CCI-ZERO-LS | -182 R (4,644) | -0 R (3,950) | +45 R (3,823) | -1.52 | 1.00 |
* The holdout was already used: these years had been seen in our earlier gold tests, so its result cannot count as clean out-of-sample evidence.
04How the trades went
| Variant | Median hours held | Time in the market | Before costs, per trade | Costs, per trade | After costs, per trade | Worst open loss |
|---|---|---|---|---|---|---|
| CCI-BRK-LS | 3.1 | 41.2% | +0.032 R | 0.071 R | -0.039 R | -9.1 R |
| CCI-BRK-L | 4.0 | 22.7% | +0.064 R | 0.071 R | -0.008 R | -6.6 R |
| CCI-REV-LS | 3.0 | 37.6% | -0.043 R | 0.068 R | -0.111 R | -20.3 R |
| CCI-ZERO-LS | 6.0 | 100.0% | +0.060 R | 0.071 R | -0.011 R | -14.0 R |
Most trades were short, and the short ones lost before costs. In the trend versions, the trades held under 8 hours lost 0.37 to 0.66 R each before costs, while the 22% to 45% held 8 hours or longer made 0.94 to 1.52 R each. Together that came to +0.032 R to +0.064 R a trade, less than the 0.071 R of costs.
05By year
| Year | CCI-BRK-LS | CCI-BRK-L | CCI-REV-LS | CCI-ZERO-LS |
|---|---|---|---|---|
| 2004 | -44 R | -37 R | -58 R | -41 R |
| 2005 | -92 R | -40 R | -144 R | -55 R |
| 2006 | +4 R | +25 R | -57 R | +39 R |
| 2007 | -36 R | +14 R | -80 R | -18 R |
| 2008 | -31 R | +12 R | -99 R | +16 R |
| 2009 | -61 R | -10 R | -97 R | -21 R |
| 2010 | -75 R | -32 R | -35 R | -98 R |
| 2011 | -31 R | -21 R | -75 R | -39 R |
| 2012 | -26 R | -23 R | -83 R | +33 R |
| 2013 | +45 R | +0 R | -56 R | +92 R |
| 2014 | +2 R | -17 R | -59 R | +14 R |
| 2015 | -31 R | -0 R | -48 R | -30 R |
| 2016 | -24 R | -6 R | -33 R | -6 R |
| 2017 | +2 R | +34 R | -54 R | +10 R |
| 2018 | -19 R | -3 R | -23 R | -60 R |
| 2019 | -30 R | -7 R | -50 R | -21 R |
| 2020 | -6 R | +18 R | -71 R | +62 R |
| 2021 | -27 R | -16 R | -38 R | -52 R |
| 2022 | +9 R | +7 R | -22 R | -3 R |
| 2023 | +3 R | +15 R | -10 R | -48 R |
| 2024 | -9 R | +2 R | -48 R | -0 R |
| 2025 | -7 R | +29 R | -54 R | +43 R |
| 2026 | +25 R | +11 R | -29 R | +43 R |
Net R by year; 2004 from July (the first 500 bars are used to start the averages) and 2026 to 7 October.
06Longs, shorts and the best trades
| Variant | Longs: trades / before costs | Shorts: trades / before costs | 10 best trades, net | Net without them |
|---|---|---|---|---|
| CCI-BRK-LS | 6,111 / +390 R | 5,789 / -9 R | +106 R | -565 R |
| CCI-BRK-L | 6,111 / +390 R | – | +82 R | -129 R |
| CCI-REV-LS | 5,785 / -147 R | 6,109 / -368 R | +49 R | -1,375 R |
| CCI-ZERO-LS | 6,208 / +716 R | 6,209 / +28 R | +204 R | -342 R |
07Is it the CCI or the clock?
The benchmark is a shifted-position control: the version's own series of positions (long, short or flat at each 1-hour close) is moved in time, as a whole, by one random offset of at least 5% of the bars, and traded with the same fills and costs. It keeps the number of trades, their lengths and the long and short mix, and breaks only the timing. 500 runs with fixed seeds; the bar is the 95th percentile of the average net result per trade.
| Variant | Trades | Real average per trade | Control median | Control 5th to 95th | Percentile (95 needed) |
|---|---|---|---|---|---|
| CCI-BRK-LS | 11,900 | -0.039 R | -0.069 R | -0.084 R to -0.053 R | 99.8 |
| CCI-BRK-L | 6,111 | -0.008 R | -0.046 R | -0.066 R to -0.024 R | 100.0 |
| CCI-REV-LS | 11,894 | -0.111 R | -0.071 R | -0.086 R to -0.054 R | 0.0 |
| CCI-ZERO-LS | 12,417 | -0.011 R | -0.068 R | -0.095 R to -0.043 R | 100.0 |
On all trades the three trend versions cleared this bar, and the reversal ranked below every run of the control. Without the trades flagged by rule 3, none of the trend versions clears it (percentiles 1.0, 5.2 and 0.0). That comparison keeps the flagged trades in the control runs, so it does not prove the timing worthless, but the timing result cannot count as evidence. Beating the control is one of six gates in any case; the trend versions also failed the result after costs.
08The gates
| Variant | Trades | 1. PF ≥ 1.2 in validation | 2. ≥ 50 trades in each period | 3. t ≥ 2.5 on development | 4. Above the 95th percentile of the control | 5. Positive without the 10 best trades | 6. Holdout net positive (already used) |
|---|---|---|---|---|---|---|---|
| CCI-BRK-LS | 11,900 | fail | pass | fail | pass | fail | fail |
| CCI-BRK-L | 6,111 | fail | pass | fail | pass | fail | pass |
| CCI-REV-LS | 11,894 | fail | pass | fail | fail | fail | fail |
| CCI-ZERO-LS | 12,417 | fail | pass | fail | pass | fail | pass |
09Verdict by variant
| Variant | Cause | Gates failed | Verdict |
|---|---|---|---|
| CCI-BRK-LS | Costs | 1, 3, 5, 6 | Buried |
| CCI-BRK-L | Costs | 1, 3, 5 | Buried |
| CCI-REV-LS | No proven edge | 1, 3, 4, 5, 6 | Buried |
| CCI-ZERO-LS | Costs | 1, 3, 5 | Buried |
The causes follow the protocol's definitions. Costs marks a result that was positive before costs and negative after: here the gross was +0.032 R to +0.064 R a trade, smaller than the costs. No proven edge marks the reversal, which lost even before costs. The headline cause is No proven edge. Buried means that a convincing edge was not shown here; it does not prove that none exists.
Not tested: other periods or levels, trend filters, stops and targets, other timeframes or markets, position sizing.
TWhat this shows, and what to take into your own tests
What the results show
- Before costs the trend versions (Lambert's ±100 rule and the zero line) made +0.032 R to +0.064 R a trade, less than the 0.071 R of costs, so in R every version lost after costs.
- Their trades held under 8 hours lost before costs; the minority held 8 hours or longer made about 0.94 to 1.52 R each.
- On all trades the trend versions beat their own positions shifted in time, but not without the trades flagged by rule 3; the reversal lost even before costs and ranked below every run of the control.
What remains unknown
- Other settings: MetaTrader's period of 14, the ±200 levels, or a filter on the longer trend.
- Other timeframes and other markets.
- Real spreads at news, which can be wider than $0.30 an ounce.
Why it failed
Most CCI signals on gold 1-hour bars were followed by short moves: the trades held under 8 hours lost 0.37 to 0.66 R each before costs. A minority of long-held trades made about 0.94 to 1.52 R each, and on average the trend versions netted +0.032 R to +0.064 R a trade before costs, less than the $0.30 an ounce of costs (0.071 R a trade).
What you can apply to your own tests
- Beating a timing control is necessary, not enough: compare the gross per trade with the cost per trade.
- Split the trades by how long they were held: here a minority of long trades carried the whole result.
- Check whether a result survives without the trades held across gaps in the data: here the timing advantage did not.
A note on the numbers: drawdown figures are measured on closed trades unless a table says it includes open losses. Open losses inside a trade are not counted in a closed-trade drawdown, so real account risk is higher, especially for systems with no stop. Backtests are not live trading.
FAQCommon questions
Does the CCI indicator strategy work?
Not in our test on gold: over 42,322 trades from 2004 to 2026, none of four common CCI rules made money after costs, measured in R. The long-only and zero-line rules came close to break-even (-0.008 R and -0.011 R a trade) and ended positive in dollars per ounce; Lambert's long-and-short rule and the reversal lost clearly.
Did the CCI time the market better than chance?
On all trades the trend rules beat their own positions shifted in time, but not after removing the trades that touched suspect gaps in the data, which were mostly the long trades that carried the result. So we cannot count it as evidence.
What is the CCI indicator?
The Commodity Channel Index, made by Donald Lambert in 1980 for commodities. It measures how far the typical price, (high + low + close) / 3, is from its 20-bar average, in units of its average deviation, scaled by 0.015 so that most readings fall between -100 and +100. Readings above +100 and below -100 are the classic signal levels.
Is the CCI better for trend or reversal trading?
On gold 1-hour bars the trend rules did better: Lambert's +-100 breakout and the zero-line cross made a little before costs, mostly from a minority of trades held for many hours, while the reversal rule lost 0.043 R a trade even before costs (its buys 0.025 R, its sells 0.060 R). Neither paid for its costs.
What are the best CCI settings?
We tested only the period of 20 with the +-100 levels and the zero line, fixed before the run. We did not search for the best settings: picking the best of many settings after the fact finds patterns in past data that rarely last, which is why our protocol counts every version tried.
How was the CCI strategy tested?
On 1-minute gold prices from a broker from 2004 to 2026, 1-hour bars, positions held overnight, $0.30 an ounce of costs a trade with two financing scenarios, rules written and dated before the data was run, results split into development, validation and holdout periods (the holdout already used by earlier gold tests), a control that moves each version's own positions in time as the benchmark, and every variant reported. Read the protocol.
10Check our arithmetic
cci_spec.md
cci_lib.js · cci_ref.js · cci_selftest.js · cci_run.js
control_audit_lib.js · em_lib.js · fx_data.js · gh_lib.js · gx_lib.js · hourly_lib.js · ma_lib.js · rb_lib.js · rs_lib.js · rsi2_protocol.js · stau_lib.js · data_holes_xau.json · gc_rolls.json
cci_selftest_result.txt · cci_results.txt · cci_summary.json
CCI-BRK-LS · CCI-BRK-L · CCI-REV-LS · CCI-ZERO-LS
data_manifest.md
To rerun it: set MT4_HISTORY to the folder that holds the XAUUSD1.hst history file, then run node cci_ref.js, node cci_selftest.js and node cci_run.js, in that order.
Code provenance: our own code; the re-implementation was written for this test by an AI agent working from the specification and stated facts. No third-party source code is used or published.
11Data notes
Suspect gaps (rule 3). A trade is flagged if it touches a suspect or unclear gap in the data (open across it, or entering or leaving next to it). Removing them changes no verdict, but it lowers the averages of the trend versions, most for the zero-line version:
| Variant | Trades | Flagged and removed | Net per trade | Verdict |
|---|---|---|---|---|
| CCI-BRK-LS | 11,900 | 822 | -0.039 R → -0.093 R | Buried → Buried |
| CCI-BRK-L | 6,111 | 465 | -0.008 R → -0.066 R | Buried → Buried |
| CCI-REV-LS | 11,894 | 967 | -0.111 R → -0.106 R | Buried → Buried |
| CCI-ZERO-LS | 12,417 | 1,585 | -0.011 R → -0.156 R | Buried → Buried |
The flagged trades are 6.9% to 12.8% of the trend versions' trades, but before costs they made +655 R, +374 R and +1,712 R, against a whole gross of +381 R, +390 R and +743 R. They are mostly long holds (a median of 9 to 24 hours, against 3 to 5 for the others), and long holds cross more gaps; at the same holding time, flagged and other trades earned about the same. So the data do not show that the gaps made the profit: removing them removes many of the long trend trades that carried the result. Either way, without them no trend version beats its control.
Financing. Positions held overnight pay or earn a swap. The verdicts use none; scenario A charges 3% a year of the price for every day held, longs and shorts alike, and scenario B uses today's broker swap (long −57.03, short +39.767 points a lot a night). The last column is the part of the result made across market closures of 36 hours or more (weekends and holidays):
| Variant | Net, no swap | Scenario A | Scenario B | Across closures |
|---|---|---|---|---|
| CCI-BRK-LS | -459 R | -532 R | -554 R | +32 R |
| CCI-BRK-L | -47 R | -87 R | -281 R | +42 R |
| CCI-REV-LS | -1,326 R | -1,388 R | -1,361 R | -18 R |
| CCI-ZERO-LS | -138 R | -316 R | -345 R | +49 R |
12Corrections
18 Oct 2026, navigation: added links to the new guide that compares all 11 gold strategy tests. No result changed.