pub struct PriceChangePct;Expand description
Reference to the price change percentage from previous close.
Returns the percentage change: ((current_close - prev_close) / prev_close) * 100
§Example
ⓘ
use finance_query::backtesting::refs::*;
// Enter on big moves (>2% change)
let big_move = price_change_pct().above(2.0);
// Exit on reversal
let reversal = price_change_pct().below(-1.5);Trait Implementations§
Source§impl Clone for PriceChangePct
impl Clone for PriceChangePct
Source§fn clone(&self) -> PriceChangePct
fn clone(&self) -> PriceChangePct
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PriceChangePct
impl Debug for PriceChangePct
Source§impl IndicatorRef for PriceChangePct
impl IndicatorRef for PriceChangePct
Source§fn required_indicators(&self) -> Vec<(String, Indicator)>
fn required_indicators(&self) -> Vec<(String, Indicator)>
Required indicators to compute this reference. Read more
Source§fn value(&self, ctx: &StrategyContext<'_>) -> Option<f64>
fn value(&self, ctx: &StrategyContext<'_>) -> Option<f64>
Get the value at current candle index from context.
Source§fn prev_value(&self, ctx: &StrategyContext<'_>) -> Option<f64>
fn prev_value(&self, ctx: &StrategyContext<'_>) -> Option<f64>
Get the value at the previous candle index.
impl Copy for PriceChangePct
Auto Trait Implementations§
impl Freeze for PriceChangePct
impl RefUnwindSafe for PriceChangePct
impl Send for PriceChangePct
impl Sync for PriceChangePct
impl Unpin for PriceChangePct
impl UnsafeUnpin for PriceChangePct
impl UnwindSafe for PriceChangePct
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IndicatorRefExt for Twhere
T: IndicatorRef,
impl<T> IndicatorRefExt for Twhere
T: IndicatorRef,
Source§fn above(self, threshold: f64) -> Above<Self>
fn above(self, threshold: f64) -> Above<Self>
Create a condition that checks if this indicator is above a threshold. Read more
Source§fn above_ref<R: IndicatorRef>(self, other: R) -> AboveRef<Self, R>
fn above_ref<R: IndicatorRef>(self, other: R) -> AboveRef<Self, R>
Create a condition that checks if this indicator is above another indicator. Read more
Source§fn below(self, threshold: f64) -> Below<Self>
fn below(self, threshold: f64) -> Below<Self>
Create a condition that checks if this indicator is below a threshold. Read more
Source§fn below_ref<R: IndicatorRef>(self, other: R) -> BelowRef<Self, R>
fn below_ref<R: IndicatorRef>(self, other: R) -> BelowRef<Self, R>
Create a condition that checks if this indicator is below another indicator. Read more
Source§fn crosses_above(self, threshold: f64) -> CrossesAbove<Self>
fn crosses_above(self, threshold: f64) -> CrossesAbove<Self>
Create a condition that checks if this indicator crosses above a threshold. Read more
Source§fn crosses_above_ref<R: IndicatorRef>(
self,
other: R,
) -> CrossesAboveRef<Self, R>
fn crosses_above_ref<R: IndicatorRef>( self, other: R, ) -> CrossesAboveRef<Self, R>
Create a condition that checks if this indicator crosses above another indicator. Read more
Source§fn crosses_below(self, threshold: f64) -> CrossesBelow<Self>
fn crosses_below(self, threshold: f64) -> CrossesBelow<Self>
Create a condition that checks if this indicator crosses below a threshold. Read more
Source§fn crosses_below_ref<R: IndicatorRef>(
self,
other: R,
) -> CrossesBelowRef<Self, R>
fn crosses_below_ref<R: IndicatorRef>( self, other: R, ) -> CrossesBelowRef<Self, R>
Create a condition that checks if this indicator crosses below another indicator. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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