MAIDR Documentation - v4.4.0
    Preparing search index...

    Function candleTrendPattern

    • Names a hammer or a hanging man, which are one shape under two readings.

      The shape does not decide it: an identical candle is a hammer at the bottom of a fall and a hanging man at the top of a rise. So this is the one place where the run of earlier closes has to be read, and it is read by the rule #734 gives -- the last CandleShapeThresholds.trendLookback closes before the candle, each strictly under or over the one before it.

      That is a narrow rule and deliberately so. It is the request's own, it can be stated to a reader in one sentence, and a candle that meets the shape after an unsteady run is left unnamed rather than given whichever name the last two closes happen to suggest. Nothing here forecasts anything: the name says what the drawing is, and a reader who wants to know whether the fall really was a downtrend can navigate back through it.

      A run shorter than the lookback -- the first few candles of any chart -- establishes nothing, and gets no name.

      Parameters

      • previousCloses: readonly number[]

        Every close before this candle, oldest first

      • candle: Ohlc

        The candle's four prices

      • thresholds: CandleShapeThresholds = DEFAULT_CANDLE_SHAPE_THRESHOLDS

        How strict to be; the request's figures by default

      Returns CandleTrendPattern | null

      The name, or null when the shape or the run does not hold