Skip to content

The Money Flow Index (MFI) signs should be extracted from Typical Prices #473

Description

@ebadran

In the current implementation of the Money Flow Index (MFI), the extractSigns function is applied to the changes in the rawMoneyFlow array.

const rawMoneyFlow = multiply(typprice(highs, lows, closings), volumes);
const signs = extractSigns(changes(1, rawMoneyFlow));
const moneyFlow = multiply(signs, rawMoneyFlow);

As a result, the index rarely reaches the 20 or 80 thresholds typically used to signal overbought or oversold conditions.

In the more widely accepted definition of the MFI, as seen in Wikipedia, TradingView and Investopedia, the positive/negative signs are instead extracted from the Typical Prices.

const typicalPrices = typprice(highs, lows, closings);
const signs = extractSigns(changes(1, typicalPrices));
const rawMoneyFlow = multiply(typicalPrices, volumes);
const moneyFlow = multiply(signs, rawMoneyFlow);

This isn’t necessarily an error, but it might confuse some users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions