pub enum BoxSizeMethod {
Fixed,
Atr {
period: usize,
multiplier: f64,
},
Percentage(f64),
}Expand description
How a price-based chart obtains its size in price units. Resolve from the loaded history when selecting the method, then keep the result while bars stream in. Reapply the parameters to explicitly recalculate from newer history.
Variants§
Fixed
Use the chart type’s explicit size in price units.
Atr
Wilder’s average true range, seeded with the mean of the first period true ranges,
then smoothed through the remaining history and multiplied by multiplier.
Fields
Percentage(f64)
A percentage of the absolute latest close; 1 means 1%.
Implementations§
Source§impl BoxSizeMethod
impl BoxSizeMethod
Sourcepub fn resolve(self, fixed: f64, bars: &[Bar]) -> Option<f64>
pub fn resolve(self, fixed: f64, bars: &[Bar]) -> Option<f64>
Resolve a positive finite size, or None for invalid inputs or insufficient history.
The first bar’s true range is its high minus low. Later true ranges are the largest
of high minus low, absolute high minus previous close, and absolute low minus previous close.
Trait Implementations§
Source§impl Clone for BoxSizeMethod
impl Clone for BoxSizeMethod
Source§fn clone(&self) -> BoxSizeMethod
fn clone(&self) -> BoxSizeMethod
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BoxSizeMethod
Source§impl Debug for BoxSizeMethod
impl Debug for BoxSizeMethod
Source§impl Default for BoxSizeMethod
impl Default for BoxSizeMethod
Source§fn default() -> BoxSizeMethod
fn default() -> BoxSizeMethod
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BoxSizeMethod
impl<'de> Deserialize<'de> for BoxSizeMethod
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for BoxSizeMethod
impl PartialEq for BoxSizeMethod
Source§impl Serialize for BoxSizeMethod
impl Serialize for BoxSizeMethod
impl StructuralPartialEq for BoxSizeMethod
Auto Trait Implementations§
impl Freeze for BoxSizeMethod
impl RefUnwindSafe for BoxSizeMethod
impl Send for BoxSizeMethod
impl Sync for BoxSizeMethod
impl Unpin for BoxSizeMethod
impl UnsafeUnpin for BoxSizeMethod
impl UnwindSafe for BoxSizeMethod
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more