centaur-technical-indicators
    Preparing search index...

    Interface ChartTrends

    Chart trend utilities (no single/bulk split).

    Notes:

    • Indices in the returned tuples are zero-based.
    • All returns are plain arrays for easy consumption from JS.
    interface ChartTrends {
        breakDownTrends(
            prices: number[],
            maxOutliers: number,
            softAdjRSquaredMinimum: number,
            hardAdjRSquaredMinimum: number,
            softRmseMultiplier: number,
            hardRmseMultiplier: number,
            softDurbinWatsonMin: number,
            softDurbinWatsonMax: number,
            hardDurbinWatsonMin: number,
            hardDurbinWatsonMax: number,
        ): [number, number, number, number][];
        overallTrend(prices: number[]): [number, number];
        peakFavorableMove(prices: number[], index: number, period: number): number;
        peaks(
            prices: number[],
            period: number,
            closestNeighbor: number,
        ): [number, number][];
        peakTrend(prices: number[], period: number): [number, number];
        valleyFavorableMove(
            prices: number[],
            index: number,
            period: number,
        ): number;
        valleys(
            prices: number[],
            period: number,
            closestNeighbor: number,
        ): [number, number][];
        valleyTrend(prices: number[], period: number): [number, number];
    }
    Index

    Methods

    • Segment the series into distinct trend ranges based on goodness-of-fit thresholds. Uses Centaur Technical Indicators 1.3.0 TrendBreakConfig parameters.

      Parameters

      • prices: number[]

        Prices series.

      • maxOutliers: number

        Maximum number of outliers allowed before trend break.

      • softAdjRSquaredMinimum: number

        Soft minimum adjusted R-squared threshold.

      • hardAdjRSquaredMinimum: number

        Hard minimum adjusted R-squared threshold.

      • softRmseMultiplier: number

        Soft RMSE multiplier for trend breaks.

      • hardRmseMultiplier: number

        Hard RMSE multiplier for trend breaks.

      • softDurbinWatsonMin: number

        Soft minimum Durbin-Watson statistic.

      • softDurbinWatsonMax: number

        Soft maximum Durbin-Watson statistic.

      • hardDurbinWatsonMin: number

        Hard minimum Durbin-Watson statistic.

      • hardDurbinWatsonMax: number

        Hard maximum Durbin-Watson statistic.

      Returns [number, number, number, number][]

      Array of [startIndex, endIndex, slope, intercept].

    • OLS trend line (slope, intercept) for all points in prices.

      Parameters

      • prices: number[]

        Series to analyze.

      Returns [number, number]

      [slope, intercept]

    • Largest favorable downward excursion from the reference point over the inclusive forward window [index + 1, index + period]: prices[index] - min(window).

      Not floored: returns a negative value when the window never drops below prices[index].

      Parameters

      • prices: number[]

        Series to analyze.

      • index: number

        Reference index (the move is measured relative to prices[index]).

      • period: number

        Forward window length; the window spans [index + 1, index + period].

      Returns number

      The peak favorable (downward) move.

      If prices is empty, period === 0, or index + period >= prices.length.

    • Calculate all local maxima (peaks) using a rolling window.

      Parameters

      • prices: number[]

        High prices (or series to scan).

      • period: number

        Window length for detecting a local peak.

      • closestNeighbor: number

        Minimum index distance between accepted peaks.

      Returns [number, number][]

      Array of [value, index] pairs.

      const peaks = chartTrends.peaks([103, 102, 107, 104, 100], 3, 1); // [[107, 2]]
      

      Since the upstream 1.3.0 fix, an extremum at index 0 is retained and de-duplicated like any other (e.g. peaks([110,109,108,107],2,1) -> [[110,0]]); an all-NaN window returns [].

    • OLS trend line (slope, intercept) computed on detected peaks over windows of size period.

      Parameters

      • prices: number[]

        Series to analyze.

      • period: number

        Window length used to find peaks.

      Returns [number, number]

      [slope, intercept]

    • Largest favorable upward excursion from the reference point over the inclusive forward window [index + 1, index + period]: max(window) - prices[index].

      Not floored: returns a negative value when the window never rises above prices[index].

      Parameters

      • prices: number[]

        Series to analyze.

      • index: number

        Reference index (the move is measured relative to prices[index]).

      • period: number

        Forward window length; the window spans [index + 1, index + period].

      Returns number

      The valley favorable (upward) move.

      If prices is empty, period === 0, or index + period >= prices.length.

    • Calculate all local minima (valleys) using a rolling window.

      Parameters

      • prices: number[]

        Low prices (or series to scan).

      • period: number

        Window length for detecting a local valley.

      • closestNeighbor: number

        Minimum index distance between accepted valleys.

      Returns [number, number][]

      Array of [value, index] pairs.

      Since the upstream 1.3.0 fix, an extremum at index 0 is retained and de-duplicated like any other (e.g. peaks([110,109,108,107],2,1) -> [[110,0]]); an all-NaN window returns [].

    • OLS trend line (slope, intercept) computed on detected valleys over windows of size period.

      Parameters

      • prices: number[]

        Series to analyze.

      • period: number

        Window length used to find valleys.

      Returns [number, number]

      [slope, intercept]