Skip to main content

Renko

Struct Renko 

Source
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

Source

pub fn fixed(size: f64) -> Result<Self>

Bricks of size.

§Errors

Error::InvalidArgument unless size is finite and positive.

Source

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.

Source

pub fn with_kind(self, kind: SeriesKind) -> Result<Self>

Drawn as kind (Candlestick, the default, or OhlcBar).

§Errors

Error::InvalidArgument for other kinds.

Source

pub fn brick_size(&self) -> Option<f64>

The brick size, once known.

Trait Implementations§

Source§

impl Clone for Renko

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Renko

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl SeriesTransform for Renko

Source§

fn name(&self) -> &'static str

Name, e.g. "renko".
Source§

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)

Commits bar and writes the elements it finishes.
Source§

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.
Source§

fn reset(&mut self)

Forgets all inputs.
Source§

fn box_size(&self) -> Option<f64>

Point & Figure: the price height of one box, to stack the X/O marks.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.