Skip to content
All library documents

CCI, MFI, and CMO Oversold and Overbought Signals

Article Strategy library · Author: berlinguyinca

Summary

This Freqtrade example combines three oscillators to identify potential turning points. It calculates the Commodity Channel Index, Money Flow Index, and Chande Momentum Oscillator on a fifteen-minute timeframe. A long entry is signaled when the previous candle’s values are all below their stated oversold thresholds; an exit is signaled when all three are above their overbought thresholds. The example also defines a tiered minimum-return schedule and a fixed stop loss, though the configuration may override those defaults.

The document is primarily a strategy template rather than a tested trading study. It provides indicator conditions and framework method structure, but does not report a backtest, asset universe, transaction costs, position sizing, or measured outcomes. The signals may be interpreted as a reversal-oriented setup, yet the example does not establish that these thresholds predict reversals or perform reliably. Further evaluation would need to account for execution assumptions, parameter selection, and market-specific behavior.

Key ideas

  • The entry condition requires CCI, MFI, and CMO to cross their oversold thresholds together.
  • The exit condition requires all three indicators to exceed their overbought thresholds.
  • The example defines a fifteen-minute timeframe, a tiered return target, and a fixed stop loss.
  • It is a template with no reported backtest results or transaction-cost analysis.

Tags

Full text
# CMCWinner


# CMCWinner









This is a test strategy to inspire you.
    More information in https://github.com/freqtrade/freqtrade/blob/develop/docs/bot-optimization.md

    You can:
    - Rename the class name (Do not forget to update class_name)
    - Add any methods you want to build your strategy
    - Add any lib you need to build your strategy

    You must keep:
    - the lib in the section "Do not remove these libs"
    - the prototype for the methods: minimal_roi, stoploss, populate_indicators, populate_entry_trend,
    populate_exit_trend, hyperopt_space, buy_strategy_generator

## Source (GPL-3.0)

```python

# --- Do not remove these libs ---
from freqtrade.strategy import IStrategy
from pandas import DataFrame
# --------------------------------

# Add your lib to import here
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
import numpy # noqa


# This class is a sample. Feel free to customize it.
class CMCWinner(IStrategy):
    """
    This is a test strategy to inspire you.
    More information in https://github.com/freqtrade/freqtrade/blob/develop/docs/bot-optimization.md

    You can:
    - Rename the class name (Do not forget to update class_name)
    - Add any methods you want to build your strategy
    - Add any lib you need to build your strategy

    You must keep:
    - the lib in the section "Do not remove these libs"
    - the prototype for the methods: minimal_roi, stoploss, populate_indicators, populate_entry_trend,
    populate_exit_trend, hyperopt_space, buy_strategy_generator
    """

    # Minimal ROI designed for the strategy.
    # This attribute will be overridden if the config file contains "minimal_roi"
    minimal_roi = {
        "40": 0.0,
        "30": 0.02,
        "20": 0.03,
        "0": 0.05
    }

    # Optimal stoploss designed for the strategy
    # This attribute will be overridden if the config file contains "stoploss"
    stoploss = -0.05

    # Optimal timeframe for the strategy
    timeframe = '15m'

    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        """
        Adds several different TA indicators to the given DataFrame

        Performance Note: For the best performance be frugal on the number of indicators
        you are using. Let uncomment only the indicator you are using in your strategies
        or your hyperopt configuration, otherwise you will waste your memory and CPU usage.
        """

        # Commodity Channel Index: values Oversold:<-100, Overbought:>100
        dataframe['cci'] = ta.CCI(dataframe)

        # MFI
        dataframe['mfi'] = ta.MFI(dataframe)

		# CMO
        dataframe['cmo'] = ta.CMO(dataframe)

        return dataframe

    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        """
        Based on TA indicators, populates the buy signal for the given dataframe
        :param dataframe: DataFrame
        :return: DataFrame with buy column
        """
        dataframe.loc[
            (
                (dataframe['cci'].shift(1) < -100) &
                (dataframe['mfi'].shift(1) < 20) &
                (dataframe['cmo'].shift(1) < -50)
            ),
            'enter_long'] = 1

        return dataframe

    def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        """
        Based on TA indicators, populates the sell signal for the given dataframe
        :param dataframe: DataFrame
        :return: DataFrame with buy column
        """
        dataframe.loc[
            (
                (dataframe['cci'].shift(1) > 100) &
                (dataframe['mfi'].shift(1) > 80) &
                (dataframe['cmo'].shift(1) > 50)
            ),
            'exit_long'] = 1
        return dataframe

```

Shown in full with attribution under the source's licence. Licence: GPL-3.0

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