Expand description
Indicator reference system for building strategy conditions.
This module provides a type-safe way to reference indicator values that can be used to build trading conditions.
§Example
ⓘ
use finance_query::backtesting::refs::*;
// Reference RSI indicator
let rsi_ref = rsi(14);
// Build conditions
let oversold = rsi_ref.below(30.0);
let overbought = rsi_ref.above(70.0);
// Compose conditions
let entry = rsi(14).crosses_below(30.0).and(price().above_ref(sma(200)));Structs§
- Accumulation
Distribution Ref - Accumulation/Distribution reference.
- AdxRef
- Average Directional Index reference.
- Alma
Config - ALMA (Arnaud Legoux Moving Average) configuration.
- AlmaRef
- ALMA reference.
- Aroon
Config - Aroon indicator configuration.
- Aroon
Down Ref - Aroon Down reference.
- Aroon
UpRef - Aroon Up reference.
- AtrRef
- Average True Range reference.
- Awesome
Oscillator Ref - Awesome Oscillator reference (uses default 5/34 periods).
- Balance
OfPower Ref - Balance of Power reference.
- Bear
Power Ref - Bear Power reference.
- Bollinger
Config - Bollinger Bands configuration.
- Bollinger
Lower Ref - Bollinger lower band reference.
- Bollinger
Middle Ref - Bollinger middle band reference.
- Bollinger
Upper Ref - Bollinger upper band reference.
- Bull
Power Ref - Bull Power reference.
- Candle
Body - Reference to the candle body size (absolute difference between open and close).
- Candle
Range - Reference to the candle range (high - low).
- CciRef
- Commodity Channel Index reference.
- Chaikin
Oscillator Ref - Chaikin Oscillator reference.
- Choppiness
Index Ref - Choppiness Index reference.
- Close
Price - Reference to the close price.
- CmfRef
- Chaikin Money Flow reference.
- CmoRef
- Chande Momentum Oscillator reference.
- Coppock
Curve Ref - Coppock Curve reference.
- DemaRef
- Double Exponential Moving Average reference.
- Donchian
Config - Donchian Channels configuration.
- Donchian
Lower Ref - Donchian lower channel reference.
- Donchian
Middle Ref - Donchian middle channel reference.
- Donchian
Upper Ref - Donchian upper channel reference.
- Elder
Bear Power Ref - Elder Ray Bear Power reference.
- Elder
Bull Power Ref - Elder Ray Bull Power reference.
- EmaRef
- Exponential Moving Average reference.
- GapPct
- Reference to the gap percentage (open vs previous close).
- High
Price - Reference to the high price.
- HmaRef
- Hull Moving Average reference.
- Ichimoku
Base Ref - Ichimoku Base Line (Kijun-sen) reference.
- Ichimoku
Config - Ichimoku Cloud configuration.
- Ichimoku
Conversion Ref - Ichimoku Conversion Line (Tenkan-sen) reference.
- Ichimoku
Lagging Ref - Ichimoku Lagging Span (Chikou Span) reference.
- Ichimoku
LeadingA Ref - Ichimoku Leading Span A (Senkou Span A) reference.
- Ichimoku
LeadingB Ref - Ichimoku Leading Span B (Senkou Span B) reference.
- IsBearish
- Reference to whether the current candle is bearish (close < open).
- IsBullish
- Reference to whether the current candle is bullish (close > open).
- Keltner
Config - Keltner Channels configuration.
- Keltner
Lower Ref - Keltner lower channel reference.
- Keltner
Middle Ref - Keltner middle channel reference.
- Keltner
Upper Ref - Keltner upper channel reference.
- LowPrice
- Reference to the low price.
- Macd
Config - MACD configuration for building MACD-related references.
- Macd
Histogram Ref - MACD Histogram reference.
- Macd
Line Ref - MACD Line reference.
- Macd
Signal Ref - MACD Signal Line reference.
- Mcginley
Dynamic Ref - McGinley Dynamic indicator reference.
- Median
Price - Reference to the median price: (high + low) / 2
- MfiRef
- Money Flow Index reference.
- Momentum
Ref - Momentum indicator reference.
- ObvRef
- On-Balance Volume reference.
- Open
Price - Reference to the open price.
- Parabolic
SarConfig - Parabolic SAR configuration.
- Parabolic
SarRef - Parabolic SAR reference.
- Price
Change Pct - Reference to the price change percentage from previous close.
- Relative
Volume - Reference to relative volume (current volume / average volume over N periods).
- RocRef
- Rate of Change reference.
- RsiRef
- Relative Strength Index reference.
- SmaRef
- Simple Moving Average reference.
- Stochastic
Config - Stochastic Oscillator configuration.
- StochasticD
Ref - Stochastic %D line reference.
- StochasticK
Ref - Stochastic %K line reference.
- Stochastic
RsiConfig - Stochastic RSI configuration.
- Stochastic
RsiRef - Stochastic RSI reference.
- Supertrend
Config - SuperTrend configuration.
- Supertrend
Uptrend Ref - SuperTrend uptrend indicator reference. Returns 1.0 for uptrend, 0.0 for downtrend.
- Supertrend
Value Ref - SuperTrend value reference.
- TemaRef
- Triple Exponential Moving Average reference.
- True
Range Ref - True Range reference.
- Typical
Price - Reference to the typical price: (high + low + close) / 3
- Volume
Ref - Reference to the volume.
- VwapRef
- Volume Weighted Average Price reference.
- VwmaRef
- Volume Weighted Moving Average reference.
- WilliamsR
Ref - Williams %R reference.
- WmaRef
- Weighted Moving Average reference.
Traits§
- Indicator
Ref - A reference to a value that can be compared in conditions.
- Indicator
RefExt - Extension trait that adds condition-building methods to all indicator references.
Functions§
- accumulation_
distribution - Create an Accumulation/Distribution reference.
- adx
- Create an Average Directional Index reference.
- alma
- Create an ALMA configuration.
- aroon
- Create an Aroon indicator configuration.
- atr
- Create an Average True Range reference.
- awesome_
oscillator - Create an Awesome Oscillator reference.
- balance_
of_ power - Create a Balance of Power reference.
- bear_
power - Create a Bear Power reference.
- bollinger
- Create a Bollinger Bands configuration.
- bull_
power - Create a Bull Power reference.
- candle_
body - Get a reference to the candle body size.
- candle_
range - Get a reference to the candle range (high - low).
- cci
- Create a Commodity Channel Index reference.
- chaikin_
oscillator - Create a Chaikin Oscillator reference.
- choppiness_
index - Create a Choppiness Index reference.
- close
- Get a reference to the close price.
- cmf
- Create a Chaikin Money Flow reference.
- cmo
- Create a Chande Momentum Oscillator reference.
- coppock_
curve - Create a Coppock Curve reference (uses default 10/14/11 periods).
- dema
- Create a Double Exponential Moving Average reference.
- donchian
- Create a Donchian Channels configuration.
- elder_
bear_ power - Create an Elder Ray Bear Power reference.
- elder_
bull_ power - Create an Elder Ray Bull Power reference.
- ema
- Create an Exponential Moving Average reference.
- gap_pct
- Get a reference to the gap percentage (open vs previous close).
- high
- Get a reference to the high price.
- hma
- Create a Hull Moving Average reference.
- ichimoku
- Create an Ichimoku Cloud configuration with default periods (9, 26, 52, 26).
- ichimoku_
custom - Create an Ichimoku Cloud configuration with custom periods.
- is_
bearish - Returns 1.0 if the candle is bearish (close < open), 0.0 otherwise.
- is_
bullish - Returns 1.0 if the candle is bullish (close > open), 0.0 otherwise.
- keltner
- Create a Keltner Channels configuration.
- low
- Get a reference to the low price.
- macd
- Create a MACD configuration.
- mcginley
- Create a McGinley Dynamic indicator reference.
- median_
price - Get a reference to the median price: (high + low) / 2.
- mfi
- Create a Money Flow Index reference.
- momentum
- Create a Momentum indicator reference.
- obv
- Create an On-Balance Volume reference.
- open
- Get a reference to the open price.
- parabolic_
sar - Create a Parabolic SAR configuration.
- price
- Get a reference to the close price.
- price_
change_ pct - Get a reference to the price change percentage from previous close.
- relative_
volume - Get a reference to relative volume (current volume / N-period average volume).
- roc
- Create a Rate of Change reference.
- rsi
- Create a Relative Strength Index reference.
- sma
- Create a Simple Moving Average reference.
- stochastic
- Create a Stochastic Oscillator configuration.
- stochastic_
rsi - Create a Stochastic RSI configuration.
- supertrend
- Create a SuperTrend configuration.
- tema
- Create a Triple Exponential Moving Average reference.
- true_
range - Create a True Range reference.
- typical_
price - Get a reference to the typical price: (high + low + close) / 3.
- volume
- Get a reference to the volume.
- vwap
- Create a Volume Weighted Average Price reference.
- vwma
- Create a Volume Weighted Moving Average reference.
- williams_
r - Create a Williams %R reference.
- wma
- Create a Weighted Moving Average reference.