pub struct Renko { /* private fields */ }Expand description
Renko bricks of a fixed size, or sized by the ATR of the first inputs. Bricks are finished elements only (none is forming).
§Examples
use ferrochart_core::chart::SeriesData;
use ferrochart_core::transform::Renko;
use ferrochart_core::data::ValueColumns;
use ferrochart_core::chart::SeriesOptions;
use ferrochart_core::{Chart, ChartOptions};
let mut chart = Chart::new(ChartOptions::default());
let renko = chart.add_transform_series(
chart.main_pane(),
Box::new(Renko::fixed(1.0)?),
SeriesOptions::default(),
)?;
chart.set_data(renko, SeriesData::Value(ValueColumns {
time: vec![0, 60_000, 120_000],
value: vec![10.0, 12.5, 13.2],
color: None,
}))?;
// 10 → 11 → 12 → 13: three bricks on the time axis.
assert_eq!(chart.data_view().time_index().len(), 3);Implementations§
Source§impl Renko
impl Renko
Sourcepub fn atr(n: usize) -> Result<Self>
pub fn atr(n: usize) -> Result<Self>
Bricks the size of the mean true range of the first n inputs.
§Errors
Error::InvalidArgument if n is 0.
Sourcepub fn with_kind(self, kind: SeriesKind) -> Result<Self>
pub fn with_kind(self, kind: SeriesKind) -> Result<Self>
Drawn as kind (Candlestick, the default, or OhlcBar).
§Errors
Error::InvalidArgument for other kinds.
Sourcepub fn brick_size(&self) -> Option<f64>
pub fn brick_size(&self) -> Option<f64>
The brick size, once known.
Trait Implementations§
Source§impl SeriesTransform for Renko
impl SeriesTransform for Renko
Source§fn output_kind(&self) -> SeriesKind
fn output_kind(&self) -> SeriesKind
How the output is drawn:
Candlestick, OhlcBar, Kagi or
PointFigure.Source§fn push(&mut self, bar: InputBar, out: &mut TransformOutput)
fn push(&mut self, bar: InputBar, out: &mut TransformOutput)
Commits
bar and writes the elements it finishes.Source§fn peek(&self, bar: InputBar, out: &mut TransformOutput)
fn peek(&self, bar: InputBar, out: &mut TransformOutput)
Writes, without changing the state, the elements
bar would finish
and the ones still forming if it were the last input.Auto Trait Implementations§
impl Forget for Renko
impl Freeze for Renko
impl Move for Renko
impl RefUnwindSafe for Renko
impl Send for Renko
impl Sync for Renko
impl Unpin for Renko
impl UnsafeUnpin for Renko
impl UnwindSafe for Renko
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more