Chartsv26.10.18
Pro edition

Fibonacci and volatility overlays

The Pro retracement and volatility surfaces over the live streaming chart - the Fibonacci zone with its gradient fill, the interactive anchors with the swing magnet, the one-click plan on the alert and order contracts, the ATR levels and bands, the study fills, the MA fan and the fair value gaps.

The Fibonacci and volatility overlays share one rule: the numbers come from pure core modules, the painters only read them, and every plan action lands on the contracts the platform already has. The zone, the bands, the fan and the gaps are ordinary layers over the live chart - the host computes once per history change and repaints per frame. The overlays live in the @unifin/chart-core/studies subpath, so a host that does not show them pays nothing for their weight.

Alerts 0 · orders 0Live · 14400 bars

The desk above is that study layer live on the real library chart: the same streaming scene as the desk pages carries the crosshair, the tooltip and pan and zoom while the pointer is away from the anchors. Switch the Fibonacci zone, the ATR bands, the MA fan and the fair value gaps on the toggle row, drag the round anchors to rebuild the impulse (the magnet snaps to a swing within 8 px), press Auto impulse to rebuild the frame from the visible window, and change the ATR multiplier or the anchor. The plan block below the chart turns the selected level into the platform contracts: the break alert counts once, the level order and the stop order count once each.

The retracement zone

fibonacciLevels(from, to) gives the seven base ratios with their labels and prices; autoFibonacci finds the impulse for you when the host asks for it. paintFibZone fills the zone between the anchors with one ramp per frame - the accent at 0.10 at the impulse end fading to 0.02 - draws the impulse as a dashed line and labels every level with a pill carrying the ratio and the price. Two readability rules: a zone shorter than FIB_ZONE_MIN_FILL_PX (24 px) keeps its lines and drops the fill, and a cramped scale keeps the three key ratios (0.382, 0.5, 0.618) with an ellipsis instead of the hidden ones. A pill never sits on the last-price tag - it steps aside when the two would collide. A canvas without gradient support degrades to a flat fill instead of throwing.

Dragging and the one-click plan

dragFibAnchor moves one anchor of the frame; the magnet snaps it to a swing inside FIB_SNAP_PX (8 px by default, configurable through snapPx, switchable off) and leaves a free position alone outside the threshold, so the manual pick is never fought. A locked frame ignores drags, any other drag leaves the automatic mode, and resetFibToAuto returns the frame to the impulse. The extend flag adds the projection ratios 1.272, 1.414, 1.618 and 2.0 on top of the base seven - it adds, it never rewrites them.

The plan block turns the analytics into work with one click: fibBreakAlertRule builds a platform price-cross alert on the level, fibLimitOrderRequest a LIMIT order on it and fibStopOrderRequest a STOP_LIMIT behind the 0.618 with a protective buffer (below the level for a buy, above it for a sell). The builders produce the very AlertRule and OrderRequest shapes the manual forms use, so the hosts' validation and delivery paths stay the only ones in play.

ATR levels and bands

atrLevels(bars, { mult, anchor, atrPeriod }) returns the stop and the 1R, 2R and 3R targets around an anchor, the day range and the expected move (the ATR times the square root of the configured steps). The anchor strategy is explicit: the last close by default, the last confirmed swing or the session open of the last UTC day. The multiplier is clamped to a sane range, and a non-numeric history yields an empty list instead of NaN prices.

paintAtrBandLayer paints one band from the anchor to every requested level: the stop takes the down colour, the targets the up colour, each band fades from the anchor to its far edge and carries a pill label. The layer is static - nothing pulses - and it never crosses the price axis.

Study fills

The band studies - Bollinger, Keltner, Donchian, the EMA cloud - share one option: studyFill is none, solid or gradient. The gradient goes from the leading line to the far edge of the band, alpha 0.20 down to 0.08, with a single ramp per band and per frame; the solid mode uses a flat 0.14; none keeps the lines alone. The mode is a property of the band overlay, so it flips between frames without rebuilding the binding, and null values simply split the band into separate areas.

The MA fan

computeMaFan(bars, { count, base, step }) builds up to forty simple averages with one rolling pass per line - never quadratic in the history - and paintMaFan fades them with age from one shared ramp (the freshest line is the most opaque). The fan is one overlay, not twenty indicator instances: no legend zoo, no repeated calculation, and switching it off leaves nothing behind. The layers walk only the visible window, so a 100 000-bar history costs what the screen shows.

Fair value gaps

fairValueGaps(bars, { limit }) implements the classic three-bar fair value gap: the window between the high of the left bar and the low of the right bar of a triple (and the mirrored bearish one). A gap stays open until a later bar touches its near boundary; the list keeps only the most recent blocks, as many as the limit asks. paintFairValueGaps fills the open zones with a two-stop ramp - denser at the boundary the price leans on - clips them to the plot and lets the fill die out on the closing bar, so a closed gap stops shouting.

On this page