CCI beginner tutorial by William210 – indicator MetaTrader 5

Good morning.

If this code malfunctions for whatever reasons, forgetting or MQL5 upgrades, let me know so I can correct it, thank you

You can find all my multi timeFrame indicator codes or not, in CodeBase or on the Marketplace, free or purchasable, by searching for “William210”.


What is CCI?

The CCI: Powerful indicator for trading

The CCI (Commodity Channel Index) is a simple and powerful tool for:


Identify trends: bullish or bearish, strong or weak.

Spotting overbought/oversold: Potential buying or selling opportunities.

Confirm trend reversals: Anticipate changes in market direction.


An alternative code

All codes, all functions have examples in the official documentation if you want.

Why this code?
I wanted to rewrite simpler codes, easier to reuse.

Whether starting out in coding, or needing a basic code to evolve quickly,

it should help you, as it helps me with my own codes.

Leave a comment to tell me which one you prefer.The code from the doc or mine. 


May this code help you

Don’t forget to put a star and ask me as a friend to be the first to be notified when my code is published in codebase or the marketplace


I wrote other simple codes in CodeBase:

I offer many of these indicators in the Marketplace, search for me “William210”

Adaptative moving average using iama()

Adx using iadx()

Alligator using alligator()

ATR using iatr() or without iATR or with the old formula a sort of SMA

The ATR is very useful for other indicators, such as SuperTrend which I offer in the marketplace

Awesome oscillator without iao()

Bands bollinger using ibands()

Donchian channel

Envelopes using ienvelopes()

Ishimoku using iishimoku()

Keltener channel

MACD using  imacd()

Momentum using iMomentum()

Moving average using ima(), using the native functions SimpleMA(), ExponentialMA(), SmoothedMA(), LinearWeightedMA()
I offer many multi-timeframe smoothing options in the marketplace.

Simple average => EMA, SMA, EMA, SMMA, LWMA

Volume-weighted averages => VWMA, VEMA

double and more exponential Average => DEMA, TEMA

RSI, with or not irsi()

Stochastic using  istochastic()


If you have code ideas to help or serve as a basis, request it on this thread CCI beginner tutorial by William210



📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks