Skip to main content

LiquidityPoolEngine

Struct LiquidityPoolEngine 

Source
pub struct LiquidityPoolEngine { /* private fields */ }
Expand description

Detects BSL/SSL pools from Equal High/Low pivot clusters and classifies every interaction as a stop hunt, a breakout, or (for a previously broken pool) a reclaim.

Over the last 2 · pivot_len + 1 bars (pivot_len at least 2) the middle bar is a pivot high when no other bar’s high is above its own and a pivot low when no other low is below its own; ties count. A pivot high joins the first active BSL pool whose price lies within tolerance_pct percent of it (relative to the pool’s price): the pool gains a touch and moves to (pool + pivot) / 2. Without such a pool the pivot forms a new one. Pivot lows form SSL pools the same way.

Then every pool is checked against the current bar, including one formed on this bar. An active BSL pool whose price the high exceeds is stop-hunted when the close is back below it and broken through otherwise; a broken-through BSL pool is reclaimed once a close falls back below it. SSL pools mirror this with the low and closes above. value: the number of active pools. First output with bar 2 · pivot_len + 1.

Implementations§

Source§

impl LiquidityPoolEngine

Source

pub fn new(pivot_len: usize, tolerance_pct: f64) -> Self

Source

pub fn with_defaults() -> Self

Source

pub fn pools(&self) -> &[LiquidityPool]

Trait Implementations§

Source§

impl Indicator for LiquidityPoolEngine

Source§

fn name(&self) -> &str

Source§

fn warmup_period(&self) -> usize

Source§

fn reset(&mut self)

Source§

fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>

Source§

fn alerts(&self) -> Vec<IndicatorAlert>

Source§

fn on_checked_bar( &mut self, bar: &Bar, ) -> Result<Option<IndicatorOutput>, BarValidationError>

Validates a bar before forwarding it to Indicator::on_bar.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.