Array of candlestick data to analyze
Z-Score configuration for peak detection. Defaults to:
Array of custom indicator values (same length as candles)
Array of detected divergences with timing, strength, and description
// Example with custom MACD values
const macdValues = calculateMACD(candles); // Your custom indicator calculation
const zScoreConfig = { lag: 3, threshold: 1, influence: 0.75 };
const customDivergences = Divergences.custom(candles, zScoreConfig, macdValues);
customDivergences.forEach(div => {
console.log(`Custom indicator divergence found: ${div.description}`);
console.log(`Points involved: ${div.points.length}`);
});
Generated using TypeDoc
Detects bullish and bearish divergences between price action and a custom technical indicator.
This generic function allows you to detect divergences with any custom indicator values. The indicator values array must have the same length as the candles array and represent the indicator value for each corresponding candle.