The CCI is one of the most popular indicators in MetaTrader. Donald Lambert created it in 1980, and his rule is this: if the CCI rises above +100, a trend has started and you buy; if it drops back down, you exit. I tested the classic version on seven markets over 72 months, and six of them came out negative or close to zero. But on USDJPY the idea worked, with a smooth balance curve and positive results in two years the optimizer never saw. Below you’ll find the USDJPY H4 robot, its results, real trades on the chart, and how to download it for free.
- +110.7% in 72 months on USDJPY H4 with 1% risk per trade. Maximum drawdown: 10.7%.
- +22.1% in the forward test (10/2024–09/2026) with a profit factor of 1.46: the robot made money on data it did not see during optimization.
- With 2% risk per trade, the same robot returned +326.2% in 72 months with a 20.6% drawdown.
- In the archive: the robot ready for MetaTrader 5, the parameter file for USDJPY H4, and the instructions. It takes 5 minutes to set up.
📊 Download the Lambert CCI robot for free

What the robot does
Donald Lambert described the Commodity Channel Index in Commodities magazine in 1980. The indicator shows how far the typical price of the candle, (high + low + close) / 3, has moved away from its 20-candle average, measured in units of mean deviation. Lambert chose the coefficient so that the CCI would spend most of its time between −100 and +100. He considered a move above +100 to be the start of a new trend. The robot keeps Lambert’s parameters, period 20 and level +100, and removes from the rules what got in the way in the historical data:
- Entry: when the CCI crosses +100 from below at the close of an H4 candle. Buy at the open of the next candle.
- Longs only, and only with the trend: the candle must close above the EMA 50. On USDJPY the robot does not open shorts.
- Stop: 1.5 ATR(14) from the entry. Take profit: 2 stops.
- Exit on the CCI: not when it falls back below +100, as in Lambert’s version, but only when the CCI drops below zero. This way the robot doesn’t exit on the first pullback.
- Position size: based on risk as a percentage of the balance. In the test, 1%; in the parameters you can set your own.
43% of trades close in profit, and the gain at take profit is almost double the loss at the stop: the result depends on that.
What it looks like on the chart
Below are two real trades by the robot in the USDJPY H4 test. Both come from the forward period, which the optimizer did not see: one winner and one loser. At the bottom is the CCI 20 with the ±100 levels; the yellow circle marks the +100 crossover. The yellow line on the price chart is the EMA 50, the trend filter.

Winning trade. On July 11, 2025, USDJPY was above the EMA 50, and the CCI, after a pullback, rose above +100 again. The robot bought at 147.081, with a stop at 146.417 and a take profit at 148.410, twice as far away as the stop. Four days later, on July 15, the pair reached the take profit: +$340.

Losing trade. On October 27, 2025, the picture was similar: price above the EMA 50 and the CCI crossed +100. The robot bought at 153.126, with a stop at 152.566. But the momentum did not continue: the next day the price reversed and hit the stop: −$187, exactly 1% of the balance at that moment. The loss is limited in advance, and every trade that reaches the take profit covers almost two stops like this one.
To do it by hand: open USDJPY H4 and add the standard CCI indicator with period 20 and an EMA 50. Buy at the open of the next candle if the CCI closed above +100 (and was below it on the previous candle) and the candle closed above the EMA 50. The stop goes at 1.5 ATR(14) from the entry; the take profit at twice that distance. If neither the stop nor the take profit is triggered and the CCI drops below zero, close manually. Don’t open shorts.
Robot results: training and forward
To avoid fooling myself with overfitting, I split the historical data into two parts. The parameters are chosen using only 10/2020–09/2024. Then the robot takes its exam on 10/2024–09/2026, data the optimizer did not see. The test: MetaTrader 5 strategy tester, a FxPro demo account with its quotes, spreads, commissions and swaps, $10,000 deposit, 1:500 leverage, “1 minute OHLC” mode, 72 months.

| Period (USDJPY H4) | Return | Profit factor | Max. drawdown | Trades |
|---|---|---|---|---|
| Training, 10/2020–09/2024 | +73.1% | 1.66 | 9.8% | 186 |
| Forward, 10/2024–09/2026 | +22.1% | 1.46 | 10.7% | 97 |
| All 72 months, 1% risk | +110.7% | 1.57 | 10.7% | 283 |
| All 72 months, 2% risk | +326.2% | 1.53 | 20.6% | 283 |
| Longest period without a new high | ≈ 7 months (12/2024–07/2025) |
The key part here is the forward test, and I’ll be frank with you: on unseen data the robot earns more slowly than in training. The profit factor dropped from 1.66 to 1.46, and the return from about 18% to 11% per year. But it stayed positive, the drawdown did not grow, and it isn’t just one lucky combination of numbers: of 157 profitable parameter sets in training, 121 also made money in the forward test. Neighboring parameters also stay positive: CCI 30 with the same +100 level returned +23.1% in the forward test with a profit factor of 1.79, and CCI 25 with level +100 and a wide stop returned +7.7% with a profit factor of 1.51. In the test the robot finished in positive territory every full year from 2021 to 2025, and 2026 through September as well. Speaking plainly about the money: commissions took $787 over 72 months, and the swaps on USDJPY longs at FxPro were positive in the test and added $1,236. If the interest rate differential between the United States and Japan narrows, that extra will disappear.

📊 Download the robot and the parameters for USDJPY H4
Why the “internet” CCI doesn’t work and this robot does
First I ran the strategy exactly as Lambert describes it: daily chart, CCI 20, buy above +100 and exit when it returns below +100, sell below −100 and exit when it returns above −100, and a protective stop of 2 ATR. Seven markets, 72 months:

| Instrument (D1) | Result | Profit factor | Max. drawdown | Trades |
|---|---|---|---|---|
| BITCOIN | +28.2% | 1.57 | 6.9% | 189 |
| GOLD | +5.2% | 1.25 | 10.7% | 80 |
| WTI (oil) | −4.7% | 0.77 | 8.4% | 79 |
| EURUSD | −7.1% | 0.79 | 10.8% | 150 |
| USDJPY | −9.3% | 0.77 | 12.3% | 156 |
| USDCHF | −9.8% | 0.73 | 11.6% | 144 |
| GBPUSD | −14.4% | 0.61 | 16.5% | 168 |
Five markets out of seven finish in negative territory, and even USDJPY, where the robot works, lost 9.3% with the classic version. There are three reasons:
- An exit that is too early. According to Lambert, the trade closes as soon as the CCI returns below +100. That happens on the first small pullback, and the trend keeps going without you. That’s why with the classic version only 29–37% of trades close in profit, and with small gains.
- Shorts against the trend. A CCI below −100 in a bullish pair is almost always a normal pullback. The classic version sells it and collects stops.
- No trend filter. The CCI also breaks above +100 in a range. Without the EMA, the system enters on every impulse, and the range eats up what was earned in the trends.
The robot that works differs in exactly these points: an exit at zero instead of +100 and a take profit of two stops, so the trade has room to win; longs only above the EMA 50, with no trades against the trend; H4 instead of D1, for more signals. For comparison: Lambert’s classic version on the same USDJPY H4 returned just +4.7% in 72 months with a 28.2% drawdown, and lost 7.6% in the forward test. The robot is tuned only for USDJPY H4, and I don’t advise moving it to other markets without your own testing.
The risks, plainly
- The robot only buys USDJPY. It makes money as long as the pair is rising overall. If the Bank of Japan strengthens the yen for a long time, buys when the CCI crosses above +100 will become losers, and then you need to stop the robot. The swap extra also depends on the rate differential.
- In the forward test the robot is slower. +22% in two years versus +73% in the four training years. Count on a modest return, not on the training figures.
- Streaks of stops. 43% of trades close in profit. The longest streak: 12 losing trades in a row in October–December 2020, about −$779. The longest pause without a new balance high: about 7 months (December 2024 to July 2025).
- 2% risk doubles the drawdown: 20.6% instead of 10.7%. I would start with 0.5–1% and raise the risk only after the robot has worked live for you.
Where to run it
The robot works on MetaTrader 5 with any broker that offers USDJPY. My test was done at FxPro. The other brokers in my ranking also work: RoboForex and Tickmill. Before putting the robot on an account, run it in your broker’s tester: it takes an afternoon and shows you how it behaves with your quotes, spreads and swaps. For it to run continuously, keep the platform on a VPS: the robot checks the signal at the close of each H4 candle, and if the platform is off, the signal is missed.
Download the Lambert CCI robot for free
The robot is free for clients of the brokers in my ranking:
- Open a MetaTrader 5 account with one of the brokers above (or use the one you already have).
- Go to the Telegram bot with the button and send your account number.
- After verification, the bot sends you the file: the robot, the parameters for USDJPY H4, Lambert’s classic parameters for your own experiments, and the instructions.
📊 Download the robot for free on Telegram
My conclusion
Lambert’s CCI in its classic form is a rule that exits the trade too early and trades against the trend: on the daily chart, five markets out of seven ended negative over six years. If you keep Lambert’s parameters, CCI 20 and level +100, but trade USDJPY on H4, buy only above the EMA 50, use a take profit of two stops and exit at zero, you get a robot that doubled the deposit in 72 months with a 10.7% drawdown and stayed positive in two unseen years. It’s not the fastest robot in the section: in the forward test it earns more slowly than in training, but its curve is one of the smoothest. Protect your deposit: start with 0.5–1% risk.
Today I also analyzed the Awesome Oscillator, a robot for gold, faster but with deeper drawdowns. On USDJPY, the Williams fractals, the EMA crossover, the previous day breakout, Raschke’s “Holy Grail” and the Supertrend also passed the test. Other oscillators in the section: Connors’ RSI-2 and MACD + EMA 200.
Why 72 months?
The market changes fundamentally every 3–5 years: the participants and the volatility change, and trends give way to ranges. That’s why I don’t run 10–20 year tests: they blend different markets into a single average figure. USDJPY is a good example. Since 2021 the pair has risen because of the interest rate differential between the United States and Japan, and the CCI breakouts to the upside kept reaching their targets. A 10–20 year test would mix this market with very different yen eras. You have to choose a strategy for the current market and change it when the market changes, and that applies to this robot too: if USDJPY enters a long decline, you need to stop it.
That’s why I built my app “Find Your Strategy”, in the browser or in Telegram. There you can test any idea on up to 72 months of historical data, and every 2 weeks the app automatically runs tens of thousands of strategies and shows you the ones that work over the last 6, 12 and 36 months. It doesn’t promise profits: it helps you notice in time that the market has changed.
Backtest results do not guarantee future results.
Sources
- Donald R. Lambert: “Commodity Channel Index: Tools for Trading Cyclic Trends,” Commodities magazine (later Futures), October 1980: the CCI formula, the 0.015 coefficient, and the signals when leaving ±100.
- Description of the CCI indicator in the MetaTrader 5 help (MetaQuotes): calculation using the typical price and the mean deviation.
- My own tests in MetaTrader 5 on the FxPro demo server, November 2026.
Where to trade
These are the brokers and exchanges I use that work with clients from Latin America. Always check that the service is available in your country and start small.
Risk warning: CFDs, Forex and crypto derivatives carry a high risk of losing money due to leverage. This article is not investment advice.


