Namespace FinanceSharp.Indicators
Technical analysis indicators, their common base classes, and indicator composition.
Start with SimpleMovingAverage for a windowed indicator. IndicatorBase exposes timestamped updates, current output, readiness, reset behavior, and update events.
Feed observations in timestamp order and inspect IsReady before consuming
an output that requires a complete warm-up window. Each indicator documents
its parameters and warm-up behavior in its API page.
Classes
- AbsolutePriceOscillator
This indicator computes the Absolute Price Oscillator (APO) The Absolute Price Oscillator is calculated using the following formula: APO[i] = FastMA[i] - SlowMA[i]
- AccelerationBands
The Acceleration Bands created by Price Headley plots upper and lower envelope bands around a moving average.
- AccumulationDistribution
This indicator computes the Accumulation/Distribution (AD) The Accumulation/Distribution is calculated using the following formula: AD = AD + ((Close - Low) - (High - Close)) / (High - Low) * Volume
- AccumulationDistributionOscillator
This indicator computes the Accumulation/Distribution Oscillator (ADOSC) The Accumulation/Distribution Oscillator is calculated using the following formula: ADOSC = EMA(fast,AD) - EMA(slow,AD)
- ArnaudLegouxMovingAverage
Smooth and high sensitive moving Average. This moving average reduce lag of the information but still being smooth to reduce noises. Is a weighted moving average, which weights have a Normal shape; the parameters Sigma and Offset affect the kurtosis and skewness of the weights respectively. Source: http://www.arnaudlegoux.com/index.html
- AroonOscillator
The Aroon Oscillator is the difference between AroonUp and AroonDown. The value of this indicator fluctuates between -100 and +100. An upward trend bias is present when the oscillator is positive, and a negative trend bias is present when the oscillator is negative. AroonUp/Down values over 75 identify strong trends in their respective direction.
- AverageDirectionalIndex
This indicator computes Average Directional Index which measures trend strength without regard to trend direction. Firstly, it calculates the Directional Movement and the True Range value, and then the values are accumulated and smoothed using a custom smoothing method proposed by Wilder. For an n period smoothing, 1/n of each period's value is added to the total period. From these accumulated values we are therefore able to derived the 'Positive Directional Index' (+DI) and 'Negative Directional Index' (-DI) which is used to calculate the Average Directional Index. Computation source: https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_directional_index_adx
- AverageDirectionalMovementIndexRating
This indicator computes the Average Directional Movement Index Rating (ADXR). The Average Directional Movement Index Rating is calculated with the following formula: ADXR[i] = (ADX[i] + ADX[i - period + 1]) / 2
- AverageTrueRange
The AverageTrueRange indicator is a measure of volatility introduced by Welles Wilder in his book: New Concepts in Technical Trading Systems. This indicator computes the TrueRange and then smoothes the TrueRange over a given period.
TrueRange is defined as the maximum of the following: High - Low ABS(High - PreviousClose) ABS(Low - PreviousClose)
- BalanceOfPower
This indicator computes the Balance Of Power (BOP). The Balance Of Power is calculated with the following formula: BOP = (Close - Open) / (High - Low)
- BarIndicator
The BarIndicator is an indicator that accepts DoubleArray data as its input.
This type is more of a shim/typedef to reduce the need to refer to things as IndicatorBase<DoubleArray>
- Belash
Belash is a softned oscillator (0 to 100) that shows how strongly the direction of the price is heading. If 100 then price is rising at full speed. If 0 the price is falling at full speed.
- BollingerBands
This indicator creates a moving average (middle band) with an upper band and lower band fixed at k standard deviations above and below the moving average.
- ChandeMomentumOscillator
This indicator computes the Chande Momentum Oscillator (CMO). CMO calculation is mostly identical to RSI. The only difference is in the last step of calculation: RSI = gain / (gain+loss) CMO = (gain-loss) / (gain+loss)
- CommodityChannelIndex
Represents the traditional commodity channel index (CCI)
CCI = (Typical Price - 20-period SMA of TP) / (.015 * Mean Deviation) Typical Price (TP) = (High + Low + Close)/3 Constant = 0.015
There are four steps to calculating the Mean Deviation, first, subtract the most recent 20-period average of the typical price from each period's typical price. Second, take the absolute values of these numbers. Third, sum the absolute values. Fourth, divide by the total number of periods (20).
- ComparingIndicatorBase
An indicator that holds a memory (a CurrentPoint) based on comparing current to the newly updated time and value.
- CompositeIndicator
This indicator is capable of wiring up two separate indicators into a single indicator such that the output of each will be sent to a user specified function.
- ConstantIndicator
An indicator that will always return the same value.
- CoppockCurve
A momentum indicator developed by Edwin “Sedge” Coppock in October 1965. The goal of this indicator is to identify long-term buying opportunities in the S&P500 and Dow Industrials. Source: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:coppock_curve
- CountSelector
A selector that calls DoubleArray.SliceIndex(int) on given SelectedIndex.
- Delay
An indicator that delays its input for a certain period
- DetrendedPriceOscillator
The Detrended Price Oscillator is an indicator designed to remove trend from price and make it easier to identify cycles. DPO does not extend to the last date because it is based on a displaced moving average. Is estimated as Price {X/2 + 1} periods ago less the X-period simple moving average. E.g.DPO(20) equals price 11 days ago less the 20-day SMA.
- DonchianChannel
This indicator computes the upper and lower band of the Donchian Channel. The upper band is computed by finding the highest high over the given period. The lower band is computed by finding the lowest low over the given period. The primary output value of the indicator is the mean of the upper and lower band for the given timeframe.
- DoubleExponentialMovingAverage
This indicator computes the Double Exponential Moving Average (DEMA). The Double Exponential Moving Average is calculated with the following formula: EMA2 = EMA(EMA(t,period),period) DEMA = 2 * EMA(t,period) - EMA2 The Generalized DEMA (GD) is calculated with the following formula: GD = (volumeFactor+1) * EMA(t,period) - volumeFactor * EMA2
- ExponentialMovingAverage
Represents the traditional exponential moving average indicator (EMA)
- FilteredIdentity
Represents an indicator that is a ready after ingesting a single sample and always returns the same value as it is given if it passes a filter condition
- FisherTransform
The Fisher transform is a mathematical process which is used to convert any data set to a modified data set whose Probability Distribution Function is approximately Gaussian. Once the Fisher transform is computed, the transformed data can then be analyzed in terms of it's deviation from the mean.
The equation is y = .5 * ln [ 1 + x / 1 - x ] where x is the input y is the output ln is the natural logarithm
The Fisher transform has much sharper turning points than other indicators such as MACD
For more info, read chapter 1 of Cybernetic Analysis for Stocks and Futures by John F. Ehlers
We are implementing the latest version of this indicator found at Fig. 4 of http://www.mesasoftware.com/papers/UsingTheFisherTransform.pdf
- FractalAdaptiveMovingAverage
The Fractal Adaptive Moving Average (FRAMA) by John Ehlers
- FunctionalComparingIndicator
A functional ComparingIndicatorBase. Pretty much saves time writing new classes.
- FunctionalIndicator
The functional indicator is used to lift any function into an indicator. This can be very useful when trying to combine output of several indicators, or for expression a mathematical equation
- HeikinAshi
This indicator computes the Heikin-Ashi bar (HA) The Heikin-Ashi bar is calculated using the following formulas: HA_Close[0] = (Open[0] + High[0] + Low[0] + Close[0]) / 4 HA_Open[0] = (HA_Open[1] + HA_Close[1]) / 2 HA_High[0] = MAX(High[0], HA_Open[0], HA_Close[0]) HA_Low[0] = MIN(Low[0], HA_Open[0], HA_Close[0])
- HullMovingAverage
Produces a Hull Moving Average as explained at http://www.alanhull.com/hull-moving-average/ and derived from the instructions for the Excel VBA code at http://finance4traders.blogspot.com/2009/06/how-to-calculate-hull-moving-average.html
- IchimokuKinkoHyo
This indicator computes the Ichimoku Kinko Hyo indicator. It consists of the following main indicators: Tenkan-sen: (Highest High + Lowest Low) / 2 for the specific period (normally 9) Kijun-sen: (Highest High + Lowest Low) / 2 for the specific period (normally 26) Senkou A Span: (Tenkan-sen + Kijun-sen )/ 2 from a specific number of periods ago (normally 26) Senkou B Span: (Highest High + Lowest Low) / 2 for the specific period (normally 52), from a specific number of periods ago (normally 26)
- Identity
Represents an indicator that is a ready after ingesting a single sample and always returns the same value as it is given.
- Indicator
Represents a type capable of ingesting a piece of data and producing a new piece of data. Indicators can be used to filter and transform data into a new, more informative form.
- IndicatorBase
Provides a base type for all indicators
- IndicatorExtensions
Provides extension methods for Indicator
- IndicatorResult
Represents the result of an indicator's calculations
- IntradayVwap
Defines the canonical intraday VWAP indicator
- KaufmanAdaptiveMovingAverage
This indicator computes the Kaufman Adaptive Moving Average (KAMA). The Kaufman Adaptive Moving Average is calculated as explained here: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:kaufman_s_adaptive_moving_average
- KeltnerChannels
This indicator creates a moving average (middle band) with an upper band and lower band fixed at k average true range multiples away from the middle band.
- LeastSquaresMovingAverage
The Least Squares Moving Average (LSMA) first calculates a least squares regression line over the preceding time periods, and then projects it forward to the current period. In essence, it calculates what the value would be if the regression line continued. Source: https://rtmath.net/helpFinAnalysis/html/b3fab79c-f4b2-40fb-8709-fdba43cdb363.htm
- LinearWeightedMovingAverage
Represents the traditional Weighted Moving Average indicator. The weight are linearly distributed according to the number of periods in the indicator.
For example, a 4 period indicator will have a numerator of (4 * window[0]) + (3 * window[1]) + (2 * window[2]) + window[3] and a denominator of 4 + 3 + 2 + 1 = 10
During the warm up period, IsReady will return false, but the LWMA will still be computed correctly because the denominator will be the minimum of Samples factorial or Size factorial and the computation iterates over that minimum value.
The RollingWindow of inputs is created when the indicator is created. A RollingWindow of LWMAs is not saved. That is up to the caller.
- LogReturn
Represents the LogReturn indicator (LOGR)- log returns are useful for identifying price convergence/divergence in a given period
- logr = log (current price / last price in period)
- MassIndex
The Mass Index uses the high-low range to identify trend reversals based on range expansions. In this sense, the Mass Index is a volatility indicator that does not have a directional bias. Instead, the Mass Index identifies range bulges that can foreshadow a reversal of the current trend. Developed by Donald Dorsey.
- Maximum
Represents an indicator capable of tracking the maximum value and how many periods ago it occurred
- MaximumDeltaIndicator
Calculates the delta between Maximum and current price.
- MeanAbsoluteDeviation
This indicator computes the n-period mean absolute deviation.
- MidPoint
This indicator computes the MidPoint (MIDPOINT) The MidPoint is calculated using the following formula: MIDPOINT = (Highest Value + Lowest Value) / 2
- MidPrice
This indicator computes the MidPrice (MIDPRICE). The MidPrice is calculated using the following formula: MIDPRICE = (Highest High + Lowest Low) / 2
- Minimum
Represents an indicator capable of tracking the minimum value and how many periods ago it occurred
- MinimumDeltaIndicator
Calculates the delta between Minimum and current price.
- Momentum
This indicator computes the n-period change in a value using the following: value_0 - value_n
- MomentumPercent
This indicator computes the n-period percentage rate of change in a value using the following: 100 * (value_0 - value_n) / value_n
This indicator yields the same results of RateOfChangePercent
- MomersionIndicator
Oscillator indicator that measures momentum and mean-reversion over a specified period n. Source: Harris, Michael. "Momersion Indicator." Price Action Lab., 13 Aug. 2015. Web. http://www.priceactionlab.com/Blog/2015/08/momersion-indicator/.
- MoneyFlowIndex
The Money Flow Index (MFI) is an oscillator that uses both price and volume to measure buying and selling pressure
Typical Price = (High + Low + Close)/3 Money Flow = Typical Price x Volume Positive Money Flow = Sum of the money flows of all days where the typical price is greater than the previous day's typical price Negative Money Flow = Sum of the money flows of all days where the typical price is less than the previous day's typical price Money Flow Ratio = (14-period Positive Money Flow)/(14-period Negative Money Flow)
Money Flow Index = 100 x Positive Money Flow / ( Positive Money Flow + Negative Money Flow)
- MovingAverageConvergenceDivergence
This indicator creates two moving averages defined on a base indicator and produces the difference between the fast and slow averages.
- MovingAverageTypeExtensions
Provides extension methods for the MovingAverageType enumeration
- NormalizedAverageTrueRange
This indicator computes the Normalized Average True Range (NATR). The Normalized Average True Range is calculated with the following formula: NATR = (ATR(period) / Close) * 100
- OnBalanceVolume
This indicator computes the On Balance Volume (OBV). The On Balance Volume is calculated by determining the price of the current close price and previous close price. If the current close price is equivalent to the previous price the OBV remains the same, If the current close price is higher the volume of that day is added to the OBV, while a lower close price will result in negative value.
- ParabolicStopAndReverse
Parabolic SAR Indicator Based on TA-Lib implementation
- PercentagePriceOscillator
This indicator computes the Percentage Price Oscillator (PPO) The Percentage Price Oscillator is calculated using the following formula: PPO[i] = 100 * (FastMA[i] - SlowMA[i]) / SlowMA[i]
- PeriodlessMaximum
Identical to Maximum but without Period.
- PeriodlessMinimum
Identical to Maximum but without Period.
- PropertySelector
Selects a specific range of (Start and Stop) of what properties to select.
- RateOfChange
This indicator computes the n-period rate of change in a value using the following:(value_0 - value_n) / value_n
- RateOfChangePercent
This indicator computes the n-period percentage rate of change in a value using the following: 100 * (value_0 - value_n) / value_n
- RateOfChangeRatio
This indicator computes the Rate Of Change Ratio (ROCR). The Rate Of Change Ratio is calculated with the following formula: ROCR = price / prevPrice
- RegressionChannel
The Regression Channel indicator extends the LeastSquaresMovingAverage with the inclusion of two (upper and lower) channel lines that are distanced from the linear regression line by a user defined number of standard deviations. Reference: http://www.onlinetradingconcepts.com/TechnicalAnalysis/LinRegChannel.html
- RelativeStrengthIndex
Represents the Relative Strength Index (RSI) developed by K. Welles Wilder. You can optionally specified a different moving average type to be used in the computation
- SimpleMovingAverage
Represents the traditional simple moving average indicator (SMA)
- SliceSelector
A selector that calls Slice(int, int) on given Start and Stop.
- StandardDeviation
This indicator computes the n-period population standard deviation.
- Stochastic
This indicator computes the Slow Stochastics %K and %D. The Fast Stochastics %K is is computed by(Current Close Price - Lowest Price of given Period) / (Highest Price of given Period - Lowest Price of given Period) multiplied by 100. Once the Fast Stochastics %K is calculated the Slow Stochastic %K is calculated by the average/smoothed price of of the Fast %K with the given period. The Slow Stochastics %D is then derived from the Slow Stochastics %K with the given period.
- Sum
Represents an indicator capable of tracking the sum for the given period
- SwissArmyKnife
Swiss Army Knife indicator by John Ehlers
- T3MovingAverage
This indicator computes the T3 Moving Average (T3). The T3 Moving Average is calculated with the following formula: EMA1(x, Period) = EMA(x, Period) EMA2(x, Period) = EMA(EMA1(x, Period),Period) GD(x, Period, volumeFactor) = (EMA1(x, Period)(1+volumeFactor)) - (EMA2(x, Period) volumeFactor) T3 = GD(GD(GD(t, Period, volumeFactor), Period, volumeFactor), Period, volumeFactor);
- TradeBarIndicator
The TradeBarIndicator is an indicator that accepts TradeBar data as its input.
This type is more of a shim/typedef to reduce the need to refer to things as IndicatorBase<TradeBar>
- TriangularMovingAverage
This indicator computes the Triangular Moving Average (TRIMA). The Triangular Moving Average is calculated with the following formula:(1) When the period is even, TRIMA(x,period)=SMA(SMA(x,period/2),(period/2)+1) (2) When the period is odd, TRIMA(x,period)=SMA(SMA(x,(period+1)/2),(period+1)/2)
- TripleExponentialMovingAverage
This indicator computes the Triple Exponential Moving Average (TEMA). The Triple Exponential Moving Average is calculated with the following formula: EMA1 = EMA(t,period) EMA2 = EMA(EMA(t,period),period) EMA3 = EMA(EMA(EMA(t,period),period),period) TEMA = 3 * EMA1 - 3 * EMA2 + EMA3
- Trix
This indicator computes the TRIX (1-period ROC of a Triple EMA) The TRIX is calculated as explained here: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:trix
- TrueRange
This indicator computes the True Range (TR). The True Range is the greatest of the following values: value1 = distance from today's high to today's low. value2 = distance from yesterday's close to today's high. value3 = distance from yesterday's close to today's low.
- UltimateOscillator
This indicator computes the Ultimate Oscillator (ULTOSC) The Ultimate Oscillator is calculated as explained here: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ultimate_oscillator
- Variance
This indicator computes the n-period population variance.
- VolumeWeightedAveragePriceIndicator
Volume Weighted Average Price (VWAP) Indicator: It is calculated by adding up the dollars traded for every transaction (price multiplied by number of shares traded) and then dividing by the total shares traded for the day.
- WilderMovingAverage
Represents the moving average indicator defined by Welles Wilder in his book: New Concepts in Technical Trading Systems.
- WilliamsPercentR
Williams %R, or just %R, is the current closing price in relation to the high and low of the past N days (for a given N). The value of this indicator fluctuates between -100 and 0. The symbol is said to be oversold when the oscillator is below -80%, and overbought when the oscillator is above -20%.
- WindowIdentity
Represents an indicator that is a ready after ingesting enough samples (# samples > period) and always returns the same value as it is given.
- WindowIndicator
Represents an indicator that acts on a rolling window of data in a List<T>
Enums
- CompositionMethod
Provides methods in-which how to handle composition of two indicators.
- IndicatorStatus
The possible states returned by IndicatorBase<T>.Forward
- MovingAverageType
Defines the different types of moving averages
- SwissArmyKnifeTool
The tools of the Swiss Army Knife. Some of the tools lend well to chaining with the "Of" Method, others may be treated as moving averages
Delegates
- CompositeIndicator.IndicatorComposer
Delegate type used to compose the output of two indicators into a new value.