pub struct HighLowVolumeNodes { /* private fields */ }Expand description
High/Low Volume Nodes — the price levels of greatest and least acceptance in a rolling volume profile.
build a `bins`-bucket volume profile over the last `period` candles
HVN = bin centre of the bucket with the most volume
LVN = bin centre of the traded bucket with the least volumeA volume profile reveals where the market spent the most effort. A High Volume
Node (HVN) is a price the market accepted and traded heavily — it acts as a
magnet and as strong support/resistance. A Low Volume Node (LVN) is a price
the market rejected quickly — moves tend to accelerate through LVNs and they
often mark the edges between balance areas. Each candle’s volume is spread
across the price bins its high-low range spans (as in
VolumeProfile).
The first value lands after period candles; each update rebuilds the profile
in O(period · bins). A degenerate flat window puts both nodes at the price.
§Example
use wickra_core::{Candle, Indicator, HighLowVolumeNodes};
let mut indicator = HighLowVolumeNodes::new(20, 24).unwrap();
let mut last = None;
for i in 0..40 {
let base = 100.0 + (f64::from(i) * 0.3).sin() * 5.0;
let c = Candle::new(base, base + 1.0, base - 1.0, base, 1_000.0, 0).unwrap();
last = indicator.update(c);
}
assert!(last.is_some());Implementations§
Source§impl HighLowVolumeNodes
impl HighLowVolumeNodes
Trait Implementations§
Source§impl Clone for HighLowVolumeNodes
impl Clone for HighLowVolumeNodes
Source§fn clone(&self) -> HighLowVolumeNodes
fn clone(&self) -> HighLowVolumeNodes
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 HighLowVolumeNodes
impl Debug for HighLowVolumeNodes
Source§impl Indicator for HighLowVolumeNodes
impl Indicator for HighLowVolumeNodes
Source§type Input = Candle
type Input = Candle
Type of one input data point (typically
f64 for a price, or Candle / Tick).Source§type Output = HighLowVolumeNodesOutput
type Output = HighLowVolumeNodesOutput
Type of one output value.
Source§fn update(&mut self, candle: Candle) -> Option<HighLowVolumeNodesOutput>
fn update(&mut self, candle: Candle) -> Option<HighLowVolumeNodesOutput>
Feed one new data point into the indicator and return the freshly computed
output, or
None if the indicator is still warming up.Source§fn reset(&mut self)
fn reset(&mut self)
Reset all internal state, leaving the indicator equivalent to a freshly
constructed instance with the same parameters.
Source§fn warmup_period(&self) -> usize
fn warmup_period(&self) -> usize
Number of inputs required before the first non-
None output can be produced.Auto Trait Implementations§
impl Freeze for HighLowVolumeNodes
impl RefUnwindSafe for HighLowVolumeNodes
impl Send for HighLowVolumeNodes
impl Sync for HighLowVolumeNodes
impl Unpin for HighLowVolumeNodes
impl UnsafeUnpin for HighLowVolumeNodes
impl UnwindSafe for HighLowVolumeNodes
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>>
Run the indicator over a slice of inputs in order, returning one output (or
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
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> 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