pub struct UniqueThreeRiver { /* private fields */ }Expand description
Unique Three River (Bottom) — a 3-bar bullish reversal. A long black candle is followed by a smaller black candle whose body sits inside the first but whose long lower shadow probes a new low, then a small white candle that stays below the second body. The fresh low that fails to hold marks an exhausted decline.
bar1 long black: open1 − close1 >= 0.5 * (high1 − low1)
bar2 black, body inside bar1's body, with a new low (low2 < low1)
bar3 small white, contained below bar2's body (high3 <= close2)
small body: close3 − open3 <= 0.3 * (high3 − low3)Output is +1.0 when the pattern completes and 0.0 otherwise. Unique Three
River is a single-direction (bullish-only) reversal, so it never emits −1.0.
The first two bars always return 0.0 because the three-bar window is not yet
filled. Body thresholds follow the geometric house style rather than TA-Lib’s
rolling averages. Pattern-shape check only — no trend filter is applied; combine
with a trend indicator for actionable signals.
§Signed ±1 encoding
This detector emits the uniform candlestick sign convention shared across the
pattern family — +1.0 bullish, 0.0 no pattern — so it drops straight into
a machine-learning feature matrix as a single dimension.
§Example
use wickra_core::{Candle, Indicator, UniqueThreeRiver};
let mut indicator = UniqueThreeRiver::new();
indicator.update(Candle::new(15.0, 15.1, 10.0, 10.5, 1.0, 0).unwrap());
indicator.update(Candle::new(14.0, 14.1, 9.0, 11.0, 1.0, 1).unwrap());
let out = indicator
.update(Candle::new(10.2, 10.9, 9.5, 10.4, 1.0, 2).unwrap());
assert_eq!(out, Some(1.0));Implementations§
Trait Implementations§
Source§impl Clone for UniqueThreeRiver
impl Clone for UniqueThreeRiver
Source§fn clone(&self) -> UniqueThreeRiver
fn clone(&self) -> UniqueThreeRiver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UniqueThreeRiver
impl Debug for UniqueThreeRiver
Source§impl Default for UniqueThreeRiver
impl Default for UniqueThreeRiver
Source§fn default() -> UniqueThreeRiver
fn default() -> UniqueThreeRiver
Source§impl Indicator for UniqueThreeRiver
impl Indicator for UniqueThreeRiver
Source§type Input = Candle
type Input = Candle
f64 for a price, or Candle / Tick).Source§fn update(&mut self, candle: Candle) -> Option<f64>
fn update(&mut self, candle: Candle) -> Option<f64>
None if the indicator is still warming up.Source§fn reset(&mut self)
fn reset(&mut self)
Source§fn warmup_period(&self) -> usize
fn warmup_period(&self) -> usize
None output can be produced.Auto Trait Implementations§
impl Freeze for UniqueThreeRiver
impl RefUnwindSafe for UniqueThreeRiver
impl Send for UniqueThreeRiver
impl Sync for UniqueThreeRiver
impl Unpin for UniqueThreeRiver
impl UnsafeUnpin for UniqueThreeRiver
impl UnwindSafe for UniqueThreeRiver
Blanket Implementations§
Source§impl<T> BatchExt for Twhere
T: Indicator,
impl<T> BatchExt for Twhere
T: Indicator,
Source§fn batch(&mut self, inputs: &[Self::Input]) -> Vec<Option<Self::Output>>
fn batch(&mut self, inputs: &[Self::Input]) -> Vec<Option<Self::Output>>
None during warmup) per input.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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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