Skip to content

Documentation / @finchart/indicators / cr

Function: cr() ​

cr(source, options?): Cr

Defined in: indicators/src/factories.ts:2052

CR — the energy band: Σ max(0, high − mid[1]) / Σ max(0, mid[1] − low) × 100 over the window, mid[1] the previous bar's midpoint, formed as high[1] / 2 + low[1] / 2 (the same double as (high + low) / 2 except where that sum would overflow, or where a half rounds — the smallest doubles); and four smas of the CR, each drawn ceil(p / 2.5 + 1) bars back — the value at a bar is the average that stood that many bars earlier. The sums are the literature's (SUM(…, N)) and the canonical's own docstring; the canonical's code divides bar by bar, writes 0 where a bar has no downward pressure (its low at or above the previous midpoint), and uses N only as a start delay. Bar by bar under this package's null rule would leave the averages empty around every such bar; the window sums carry them across it. No first bar (no previous midpoint); a window whose downward sum is 0 has no ratio — null, where the canonical writes 0. With the defaults the CR reads from the 27th bar and MA(60), the furthest displaced, from the 111th — 110 bars of memory, the declared lookback.

Parameters ​

source ​

Source<OHLC>

options? ​

CrOptions = {}

Returns ​

Cr