Skip to content

Price transforms

Transforms derive a display from the source history. Keep feeding original bars through the series lifecycle; changing the renderer does not replace those bars or provide a market feed. All scenes below reuse the fixed OHLC history from your first chart. The compiled setups are in chart_types.rs.

ChartType::Heikin smooths original OHLC bars. The close is (open + high + low + close) / 4; the open is the midpoint of the previous transformed open and close. The first open is the midpoint of the first source open and close. High/low extend to include the transformed body. For a first source bar (100, 106, 98, 104), the transformed open is 102 and close is 102; the next transformed open is also 102. The recurrence uses full loaded history, so panning does not reseed it.

Heikin-Ashi from original OHLCOpen full size

Pan through the smoothed candles; the history is transformed before clipping to the view.

The interactive example needs JavaScript and WebAssembly. You can still use the chart setup alongside it.

series_heikin.rs
use egui_charts::{Chart, ChartType};
pub fn heikin() -> Chart {
let mut chart = crate::first_chart::first_chart();
chart.set_chart_type(ChartType::Heikin);
chart
}

Heikin-Ashi keeps the time-based axis and can also be an added series. It uses the candle renderer’s chart colours and dimensions; see candles and bars. The original values remain available through Chart::bars.

ChartType::Renko builds bricks from price movement. Supply the original history and set ChartTypeParams::renko_brick_size in price units. Close is the default input; renko_source can select high/low. renko_wicks displays source extremes for the selected input. The RenkoConfig reference describes brick continuation and reversal rules.

Half-unit Renko bricksOpen full size

Inspect the price steps: horizontal distance counts bricks rather than elapsed minutes.

The interactive example needs JavaScript and WebAssembly. You can still use the chart setup alongside it.

series_renko.rs
use egui_charts::{Chart, ChartType};
pub fn renko() -> Chart {
let mut chart = crate::first_chart::first_chart();
let mut params = chart.chart_type_params().clone();
params.renko_brick_size = 0.5;
params.renko_wicks = true;
chart.set_chart_type_params(params);
chart.set_chart_type(ChartType::Renko);
chart
}

ChartType::PointAndFigure builds columns of rising Xs or falling Os. Set pnf_box_size and pnf_reversal; a box size of 0.25 and reversal count of 3 require a 0.75 move against the column to reverse. High/low is the default input; pnf_source can select close. See PointFigureConfig for grid and reversal rules.

Quarter-unit boxes with a three-box reversalOpen full size

Inspect X and O columns on their own element axis.

The interactive example needs JavaScript and WebAssembly. You can still use the chart setup alongside it.

series_point_and_figure.rs
use egui_charts::{Chart, ChartType};
pub fn point_and_figure() -> Chart {
let mut chart = crate::first_chart::first_chart();
let mut params = chart.chart_type_params().clone();
params.pnf_box_size = 0.25;
params.pnf_reversal = 3;
chart.set_chart_type_params(params);
chart.set_chart_type(ChartType::PointAndFigure);
chart
}

These main renderers share the parameter workflow above:

TypeSource and parametersStyle and definition
KagiClose by default, or kagi_source high/low; kagi_reversal in price units and kagi_size_methodChart up/down colours and styles.kagi thick/thin widths; KagiConfig
LineBreakClose by default, or line_break_source high/low; line_break_count reversal lookback, 1 to 10Chart up/down colours; LineBreakConfig
RangeRetained executions in order, or an OHLC path approximation when no trades are held; range_size and range_size_methodChart up/down colours; RangeBarSource, RangeBarConfig

ChartTypeParams holds all these fields. For high/low input, intrabar order is unknown: continuation takes priority over reversal and at most one direction is processed per source bar. OHLC range bars are an approximation; original executions give their actual path. See the order-flow guide for supplying executions.

Renko, Kagi, Range and Point and Figure support BoxSizeMethod: fixed price units, Wilder ATR or a percentage of the absolute latest close. History-derived sizes resolve from loaded history and stay frozen while bars stream. Reapply parameters to explicitly recalculate them. Invalid sizes or insufficient history produce a chart message. Use Chart::set_chart_type_params to apply a copy of the current parameters, preserving unrelated styles.

Main transform colours and dimensions come from ChartConfig; Kagi has separate KagiStyle stroke widths, and Renko has its wick switch. The main candle style switches are specific to Candles; they are not universal transform settings.

Renko, Kagi, Line Break, Point and Figure, and Range have one time-scale slot per displayed element. Chart indices on those types count elements, not source bars. Studies, drawings, markers and added price series remain stored but are hidden; studies continue updating. Volume is also hidden. Returning to a time-based type shows these overlays again. These five types cannot be added series: SeriesOptions::chart_type converts them to Line. See all added-series restrictions.