Struct ta::indicators::FastStochastic [−][src]
pub struct FastStochastic { /* fields omitted */ }
Expand description
Fast stochastic oscillator.
The stochastic oscillator is a momentum indicator comparing the closing price of a security to the range of its prices over a certain period of time.
Formula
Where:
- %Kt - value of fast stochastic oscillator
- Ct - close price of the current period
- Ln - lowest price for the last n periods
- Hn - highest price for the last n periods
Parameters
- period - number of periods (integer greater than 0). Default is 14.
Example
use ta::indicators::FastStochastic; use ta::Next; let mut stoch = FastStochastic::new(5).unwrap(); assert_eq!(stoch.next(20.0), 50.0); assert_eq!(stoch.next(30.0), 100.0); assert_eq!(stoch.next(40.0), 100.0); assert_eq!(stoch.next(35.0), 75.0); assert_eq!(stoch.next(15.0), 0.0);
Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for FastStochastic
impl Send for FastStochastic
impl Sync for FastStochastic
impl Unpin for FastStochastic
impl UnwindSafe for FastStochastic
Blanket Implementations
Mutably borrows from an owned value. Read more