Skip to content
All library documents

Adding a User-Defined Bar Shift to the MT5 CCI Indicator

Article MQL5 code base

Summary

This educational MetaTrader 5 example extends the Commodity Channel Index by adding a user-defined shift in bars to its plotted values. The description explains the general implementation idea: apply the shift by changing the indicator buffer index, a technique that can also be used to shift other indicators. This makes the example relevant to traders learning how indicator output can be repositioned on a chart.

The document mentions a companion test script that demonstrates using the custom indicator through the platform's custom-indicator interface. It gives setup and compilation order for the two files, but includes no source code, trading rules, tests, or evidence that shifting the plot improves analysis or results. A plot shift changes where values appear on the chart; users should understand that display behavior before relying on it to interpret signals.

Key ideas

  • The example adds a configurable bar shift to an MT5 CCI indicator.
  • The shift is implemented by changing the indicator buffer index.
  • The same buffer-index approach can be applied to other indicators.
  • A companion script demonstrates calling the custom indicator through the platform.
  • The document describes charting functionality and gives no evidence of trading performance.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.