pub struct Timeframe {
pub multiplier: u32,
pub unit: TimeframeUnit,
}Expand description
The chart timeframe a script runs on, exposed as timeframe.*.
A multiplier plus a unit, e.g. { 3, Daily } → timeframe.period == "3D".
Fields§
§multiplier: u32§unit: TimeframeUnitImplementations§
Source§impl Timeframe
impl Timeframe
Sourcepub fn as_minutes(&self) -> Option<u32>
pub fn as_minutes(&self) -> Option<u32>
The whole timeframe expressed in minutes. None for sub-minute and month
periods, which have no whole-minute length.
Sourcepub fn from_millis(millis: i64) -> Option<Self>
pub fn from_millis(millis: i64) -> Option<Self>
The period covered by a gap of millis between two bars, or None if
no whole unit divides it.
Months are never inferred: their length varies, so a monthly series has no single gap to recognise.
pub fn to_millis(&self) -> Option<i64>
pub fn is_seconds(&self) -> bool
pub fn is_minutes(&self) -> bool
pub fn is_daily(&self) -> bool
pub fn is_weekly(&self) -> bool
pub fn is_monthly(&self) -> bool
pub fn is_ticks(&self) -> bool
Sourcepub fn is_intraday(&self) -> bool
pub fn is_intraday(&self) -> bool
Intraday timeframes are seconds or minutes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Timeframe
impl RefUnwindSafe for Timeframe
impl Send for Timeframe
impl Sync for Timeframe
impl Unpin for Timeframe
impl UnsafeUnpin for Timeframe
impl UnwindSafe for Timeframe
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