Skip to main content

Module refs

Module refs 

Source
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§

AccumulationDistributionRef
Accumulation/Distribution reference.
AdxRef
Average Directional Index reference.
AlmaConfig
ALMA (Arnaud Legoux Moving Average) configuration.
AlmaRef
ALMA reference.
AroonConfig
Aroon indicator configuration.
AroonDownRef
Aroon Down reference.
AroonUpRef
Aroon Up reference.
AtrRef
Average True Range reference.
AwesomeOscillatorRef
Awesome Oscillator reference (uses default 5/34 periods).
BalanceOfPowerRef
Balance of Power reference.
BearPowerRef
Bear Power reference.
BollingerConfig
Bollinger Bands configuration.
BollingerLowerRef
Bollinger lower band reference.
BollingerMiddleRef
Bollinger middle band reference.
BollingerUpperRef
Bollinger upper band reference.
BullPowerRef
Bull Power reference.
CandleBody
Reference to the candle body size (absolute difference between open and close).
CandleRange
Reference to the candle range (high - low).
CciRef
Commodity Channel Index reference.
ChaikinOscillatorRef
Chaikin Oscillator reference.
ChoppinessIndexRef
Choppiness Index reference.
ClosePrice
Reference to the close price.
CmfRef
Chaikin Money Flow reference.
CmoRef
Chande Momentum Oscillator reference.
CoppockCurveRef
Coppock Curve reference.
DemaRef
Double Exponential Moving Average reference.
DonchianConfig
Donchian Channels configuration.
DonchianLowerRef
Donchian lower channel reference.
DonchianMiddleRef
Donchian middle channel reference.
DonchianUpperRef
Donchian upper channel reference.
ElderBearPowerRef
Elder Ray Bear Power reference.
ElderBullPowerRef
Elder Ray Bull Power reference.
EmaRef
Exponential Moving Average reference.
GapPct
Reference to the gap percentage (open vs previous close).
HighPrice
Reference to the high price.
HmaRef
Hull Moving Average reference.
IchimokuBaseRef
Ichimoku Base Line (Kijun-sen) reference.
IchimokuConfig
Ichimoku Cloud configuration.
IchimokuConversionRef
Ichimoku Conversion Line (Tenkan-sen) reference.
IchimokuLaggingRef
Ichimoku Lagging Span (Chikou Span) reference.
IchimokuLeadingARef
Ichimoku Leading Span A (Senkou Span A) reference.
IchimokuLeadingBRef
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).
KeltnerConfig
Keltner Channels configuration.
KeltnerLowerRef
Keltner lower channel reference.
KeltnerMiddleRef
Keltner middle channel reference.
KeltnerUpperRef
Keltner upper channel reference.
LowPrice
Reference to the low price.
MacdConfig
MACD configuration for building MACD-related references.
MacdHistogramRef
MACD Histogram reference.
MacdLineRef
MACD Line reference.
MacdSignalRef
MACD Signal Line reference.
McginleyDynamicRef
McGinley Dynamic indicator reference.
MedianPrice
Reference to the median price: (high + low) / 2
MfiRef
Money Flow Index reference.
MomentumRef
Momentum indicator reference.
ObvRef
On-Balance Volume reference.
OpenPrice
Reference to the open price.
ParabolicSarConfig
Parabolic SAR configuration.
ParabolicSarRef
Parabolic SAR reference.
PriceChangePct
Reference to the price change percentage from previous close.
RelativeVolume
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.
StochasticConfig
Stochastic Oscillator configuration.
StochasticDRef
Stochastic %D line reference.
StochasticKRef
Stochastic %K line reference.
StochasticRsiConfig
Stochastic RSI configuration.
StochasticRsiRef
Stochastic RSI reference.
SupertrendConfig
SuperTrend configuration.
SupertrendUptrendRef
SuperTrend uptrend indicator reference. Returns 1.0 for uptrend, 0.0 for downtrend.
SupertrendValueRef
SuperTrend value reference.
TemaRef
Triple Exponential Moving Average reference.
TrueRangeRef
True Range reference.
TypicalPrice
Reference to the typical price: (high + low + close) / 3
VolumeRef
Reference to the volume.
VwapRef
Volume Weighted Average Price reference.
VwmaRef
Volume Weighted Moving Average reference.
WilliamsRRef
Williams %R reference.
WmaRef
Weighted Moving Average reference.

Traits§

IndicatorRef
A reference to a value that can be compared in conditions.
IndicatorRefExt
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.