Documentation / @finchart/indicators / pointAndFigure
Function: pointAndFigure()
pointAndFigure(
source,options):PointAndFigureColumn[]
Defined in: indicators/src/point-and-figure.ts:86
Close-based, one candle moves one column once. Boxes are integer levels on the grid — a rising close reaches level floor(close / boxSize), a falling one ceil(close / boxSize) (a box is filled only when the close reaches it), where the quotient the division gives, when within a relative 8 × 2⁻⁵² of an integer, is that integer. With a normal box and a normal close a decimal tie always lands inside that window (its exact quotient is the integer and the division strays by a couple of 2⁻⁵² at most — which is why a subnormal box is refused: its digits are already gone), so a close written as the decimal a box sits on fills it (0.3 / 0.1 is 2.9999999999999996 in doubles); a close a real fraction short does not, and one a few 2⁻⁵² short is not a tie — it lands on whichever side of the window the division puts it. A price is a level times boxSize, multiplied once, never accumulated, so a fractional box keeps the grid straight. A level 2⁴⁷ boxes or more away from zero cannot be kept — judged after the snap — because past it the snap window, a quarter of a level wide there, would start to reach neighbouring levels (the division itself stays sharp much further; the window is the limit); and a box so large that a level's price leaves the double range cannot be priced — ContractError either way, for the reference candle as for any other. The first candle's close is the reference; the first close that reaches a grid level strictly beyond it — the next level up, or the next level down — starts the first column at that level. In a rising column a close reaching a higher level fills the boxes up to it; a close giving back reversal boxes or more from the column's top starts the falling column one box below that top, down to the level reached. The falling column mirrors it. Anything else moves nothing. The grid is absolute — every column's boxes sit on the same multiples of boxSize whatever history precedes them — but the columns are path-dependent (each starts one box inside the previous one's extreme), so a history page prepended later can redraw columns well past the seam; the transform re-derives the whole tape and builds every column afresh.
Parameters
source
readonly OHLC[]