Skip to content
All library documents

CCI Threshold Crossings for Automated Buy and Sell Signals

Article MQL5 code base

Summary

This document presents a basic automated trading example using the Commodity Channel Index (CCI) calculated from typical price. A buy signal occurs when CCI moves upward from below one threshold to above a nearby lower threshold; a sell signal uses the corresponding downward move from above positive thresholds. The sample configuration includes a CCI period, fixed lot size, stop loss, take profit, trailing stop, and trade duplication setting.

The article explicitly frames the logic as a coding demonstration rather than a profitable trading system. It supplies no backtest, market selection, or performance evidence, and gives no rationale for the chosen thresholds or trade management values. Results would depend on implementation details, instrument, timeframe, execution costs, and risk controls; the example alone does not establish an edge.

Key ideas

  • The example uses CCI calculated from typical price to trigger entries.\nA buy is triggered by an upward move through negative CCI thresholds.\nA sell is triggered by a downward move through positive CCI thresholds.\nThe sample includes fixed trade management inputs but does not validate their effectiveness.\nThe author describes the code as educational rather than a trading recommendation.

Tags

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