Array of candlestick data to analyze
Z-Score configuration for peak detection. Defaults to:
Period for MFI calculation (default: 14)
Array of detected divergences with timing, strength, and description
const zScoreConfig = { lag: 3, threshold: 1, influence: 0.75 };
const mfiDivergences = Divergences.mfi(candles, zScoreConfig, 14);
mfiDivergences.forEach(div => {
console.log(`${div.type === SIGNAL_DIRECTION.BULLISH ? 'Bullish' : 'Bearish'} MFI divergence`);
console.log(`Strength: ${div.strength} points`);
console.log(`Duration: ${div.startTime} to ${div.endTime}`);
});
Generated using TypeDoc
Detects bullish and bearish divergences between price action and the Money Flow Index (MFI).
Divergences occur when price and the MFI indicator move in opposite directions, potentially signaling trend reversals: