Struct yata::indicators::StochasticOscillator
source · pub struct StochasticOscillator<M: MovingAverageConstructor = MA> {
pub period: PeriodType,
pub ma: M,
pub signal: M,
pub zone: ValueType,
}
Expand description
Stochastic Oscillator
§Links
§2 values
main
value
Range in [0.0
; 1.0
].
signal line
value
Range in [0.0
; 1.0
].
§3 signals
- Signal #1
When main
value crosses lower bound upwards, returns full buy signal.
When main
value crosses upper bound downwards, returns full sell signal.
Otherwise returns no signal.
- Signal #2
When signal line
value crosses lower bound upwards, returns full buy signal.
When signal line
value crosses upper bound downwards, returns full sell signal.
Otherwise returns no signal.
- Signal #3
When main
value crosses signal line
upwards, returns full buy signal.
When main
value crosses signal line
downwards, returns full sell signal.
Otherwise returns no signal.
Fields§
§period: PeriodType
Period for searching highest high and lowest low. Default is 14
.
Range in [2
; PeriodType::MAX
)
ma: M
Moving average for smoothing main
value.
Default is SMA(14)
.
Usually it is equal to period
.
Period range is in [2
; PeriodType::MAX
)
signal: M
Moving average type for smoothing signal line
value.
Default is SMA(3)
.
Period range is in [2
; PeriodType::MAX
)
zone: ValueType
Zone size for #1 and #2 signals.
Range in [0.0
; 0.5
].
Trait Implementations§
source§impl<M: Clone + MovingAverageConstructor> Clone for StochasticOscillator<M>
impl<M: Clone + MovingAverageConstructor> Clone for StochasticOscillator<M>
source§fn clone(&self) -> StochasticOscillator<M>
fn clone(&self) -> StochasticOscillator<M>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<M: Debug + MovingAverageConstructor> Debug for StochasticOscillator<M>
impl<M: Debug + MovingAverageConstructor> Debug for StochasticOscillator<M>
source§impl Default for StochasticOscillator
impl Default for StochasticOscillator
source§impl<'de, M> Deserialize<'de> for StochasticOscillator<M>where
M: Deserialize<'de> + MovingAverageConstructor,
impl<'de, M> Deserialize<'de> for StochasticOscillator<M>where
M: Deserialize<'de> + MovingAverageConstructor,
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>,
source§impl<M: MovingAverageConstructor> IndicatorConfig for StochasticOscillator<M>
impl<M: MovingAverageConstructor> IndicatorConfig for StochasticOscillator<M>
§type Instance = StochasticOscillatorInstance<M>
type Instance = StochasticOscillatorInstance<M>
source§fn init<T: OHLCV>(self, candle: &T) -> Result<Self::Instance, Error>
fn init<T: OHLCV>(self, candle: &T) -> Result<Self::Instance, Error>
source§fn set(&mut self, name: &str, value: String) -> Result<(), Error>
fn set(&mut self, name: &str, value: String) -> Result<(), Error>
source§fn size(&self) -> (u8, u8)
fn size(&self) -> (u8, u8)
IndicatorResult
size processing by the indicator (count of raw values, count of signals)
source§impl<M> Serialize for StochasticOscillator<M>where
M: Serialize + MovingAverageConstructor,
impl<M> Serialize for StochasticOscillator<M>where
M: Serialize + MovingAverageConstructor,
impl<M: Copy + MovingAverageConstructor> Copy for StochasticOscillator<M>
Auto Trait Implementations§
impl<M> RefUnwindSafe for StochasticOscillator<M>where
M: RefUnwindSafe,
impl<M> Send for StochasticOscillator<M>where
M: Send,
impl<M> Sync for StochasticOscillator<M>where
M: Sync,
impl<M> Unpin for StochasticOscillator<M>where
M: Unpin,
impl<M> UnwindSafe for StochasticOscillator<M>where
M: UnwindSafe,
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
source§impl<T, I, C> IndicatorConfigDyn<T> for Cwhere
T: OHLCV,
I: IndicatorInstanceDyn<T> + IndicatorInstance<Config = C> + 'static,
C: IndicatorConfig<Instance = I> + Clone + 'static,
impl<T, I, C> IndicatorConfigDyn<T> for Cwhere
T: OHLCV,
I: IndicatorInstanceDyn<T> + IndicatorInstance<Config = C> + 'static,
C: IndicatorConfig<Instance = I> + Clone + 'static,
source§fn init(
&self,
initial_value: &T
) -> Result<Box<dyn IndicatorInstanceDyn<T>>, Error>
fn init( &self, initial_value: &T ) -> Result<Box<dyn IndicatorInstanceDyn<T>>, Error>
source§fn over(&self, inputs: &dyn AsRef<[T]>) -> Result<Vec<IndicatorResult>, Error>
fn over(&self, inputs: &dyn AsRef<[T]>) -> Result<Vec<IndicatorResult>, Error>
IndicatorConfig
over series of OHLC and returns series of IndicatorResult
s Read more