How to use the technical.indicators.cmf function in technical

To help you get started, we’ve selected a few technical examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github freqtrade / technical / tests / test_indicators.py View on Github external
def test_chaikin_money_flow(testdata_1m_btc):
    from technical.indicators import cmf, chaikin_money_flow

    assert cmf is chaikin_money_flow

    result = chaikin_money_flow(testdata_1m_btc, 14)

    # drop nan, they are exspected, based on the period
    result = result[~numpy.isnan(result)]

    assert result.min() >= -1
    assert result.max() <= 1
github freqtrade / freqtrade-strategies / user_data / strategies / berlinguyinca / TechnicalExampleStrategy.py View on Github external
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe['cmf'] = cmf(dataframe, 21)

        return dataframe
github freqtrade / technical / technical / consensus.py View on Github external
def evaluate_cmf(self, period=12, prefix="cmf", impact_buy=1, impact_sell=1):
        """
        evaluates the osc
        :param dataframe:
        :param period:
        :param prefix:
        :return:
        """
        from technical.indicators import cmf

        self._weights(impact_buy, impact_sell)
        dataframe = self.dataframe
        name = '{}_{}'.format(prefix, period)
        dataframe[name] = cmf(dataframe, period)

        dataframe.loc[
            (
                (dataframe[name] > 0.5)
            ),
            'buy_{}'.format(name)
        ] = (1 * impact_buy)

        dataframe.loc[
            (
                (dataframe[name] < -0.5)
            ),
            'sell_{}'.format(name)
        ] = (1 * impact_sell)