#[non_exhaustive]pub enum AlertCondition {
Show 15 variants
StrategyFills(String),
Crossing(f64),
CrossingUp(f64),
CrossingDown(f64),
Above(f64),
Below(f64),
EnteringChannel {
lower: f64,
upper: f64,
},
ExitingChannel {
lower: f64,
upper: f64,
},
InsideChannel {
lower: f64,
upper: f64,
},
OutsideChannel {
lower: f64,
upper: f64,
},
MovingBy {
value: f64,
bars: u32,
},
MovingByPercent {
percent: f64,
bars: u32,
},
Compare {
other: AlertSource,
comparison: AlertComparison,
},
Channel {
boundaries: [AlertSource; 2],
comparison: AlertChannelComparison,
},
VolumeAboveAverage {
multiplier: f64,
bars: u32,
},
}Expand description
When an alert fires, judged on its source for each subject symbol. Each variant states its rule so that a host and a server evaluate it alike. Levels are finite and in the symbol’s price units.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
StrategyFills(String)
Each fill of the host’s uniquely named strategy run. Feed Backtest::update results to
AlertEngine::strategy_fills with the same run id. Uses the price source, no additional
rules, and frequency EveryTime (the constructor default) or Once. No bars evaluate it.
Crossing(f64)
The previous value was strictly below or above the level and the current value reaches or passes it, in either direction.
CrossingUp(f64)
The previous price was below the level and the current price is at or above it.
CrossingDown(f64)
The previous price was above the level and the current price is at or below it.
Above(f64)
The price is above the level.
Below(f64)
The price is below the level.
EnteringChannel
Previous value was outside the inclusive channel, current value is inside it.
Fields
ExitingChannel
Previous value was inside the inclusive channel, current value is outside it.
Fields
InsideChannel
The current value is inside the inclusive channel, lower <= value <= upper, whatever the
previous value was.
Fields
OutsideChannel
The current value is outside the inclusive channel, below lower or above upper,
whatever the previous value was.
Fields
MovingBy
Signed change from bars bars ago reaches value: at least for positive, at most for negative.
Fields
MovingByPercent
Signed percentage change, 100 * (current - previous) / abs(previous), over bars bars.
A zero previous value cannot satisfy this condition.
Fields
Compare
Compare against another output on the same bar, using its previous value for crossings.
Fields
other: AlertSourceThe second output on the same symbol and bar.
comparison: AlertComparisonThe required relationship between the outputs.
Channel
Test against two boundaries resolved on each evaluated bar. The boundaries may change order; their minimum and maximum define the inclusive channel. Missing, non-finite or coincident boundaries cannot satisfy the condition. On a new bar, transitions resolve the source and both boundaries at the preceding bar again. Within a bar they compare with the previous evaluation, just as a crossing does.
Fields
boundaries: [AlertSource; 2]Stable sources of the two boundary lines, retained through drawing edits and storage.
comparison: AlertChannelComparisonState or transition to test.
VolumeAboveAverage
Current volume exceeds multiplier times the mean of the preceding bars completed volumes.
Implementations§
Trait Implementations§
Source§impl Clone for AlertCondition
impl Clone for AlertCondition
Source§fn clone(&self) -> AlertCondition
fn clone(&self) -> AlertCondition
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 AlertCondition
impl Debug for AlertCondition
Source§impl<'de> Deserialize<'de> for AlertCondition
impl<'de> Deserialize<'de> for AlertCondition
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 Display for AlertCondition
impl Display for AlertCondition
Source§impl PartialEq for AlertCondition
impl PartialEq for AlertCondition
Source§impl Serialize for AlertCondition
impl Serialize for AlertCondition
impl StructuralPartialEq for AlertCondition
Auto Trait Implementations§
impl Freeze for AlertCondition
impl RefUnwindSafe for AlertCondition
impl Send for AlertCondition
impl Sync for AlertCondition
impl Unpin for AlertCondition
impl UnsafeUnpin for AlertCondition
impl UnwindSafe for AlertCondition
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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