Contains various helper methods for technical analysis calculations.

Hierarchy

  • TechnicalAnalysisMethods

Constructors

Methods

calculateAccumulationDistribution calculateAccumulativeSwingIndex calculateAroon calculateAroonOscillator calculateAverageDailyRange calculateAverageDirectionalIndex calculateAverageTrueRange calculateAwesomeOscillator calculateBalanceOfPower calculateBollingerBand calculateCenterOfGravity calculateChaikinMoneyFlow calculateChaikinOscillator calculateChaikinVolatility calculateChandeForecastOscillator calculateChandeMomentumOscillator calculateChoppinessIndex calculateCommodityChannelIndex calculateCoppockCurve calculateCorrelationCoefficient calculateDetrendedPriceOscillator calculateDonchianChannels calculateEaseOfMovement calculateEhlerFisherTransform calculateElderRayIndex calculateElderThermometerCustom calculateEldersForceIndex calculateExponentialMovingAverage calculateFractalChaosBands calculateFractalChaosOscillator calculateGopalakrishnanRangeIndex calculateHighLowBands calculateHighMinusLow calculateHistoricalVolatilityIndex calculateHullMovingAverage calculateIchimokuCloud calculateIntradayMomentumIndex calculateKeltnerChannels calculateKlingerVolumeOscillator calculateKurtosis calculateLinearRegression calculateMACD calculateMACDCustom calculateMarketFacilitationIndex calculateMassIndex calculateMedianPrice calculateMomentumOscillator calculateMoneyFlowIndex calculateMovingAverageEnvelopes calculateNegativeVolumeIndex calculateOnBalanceVolume calculateParabolicSAR calculatePercentagePriceOscillator calculatePerformanceIndex calculatePositiveVolumeIndex calculatePrettyGoodOscillator calculatePriceVolumeTrend calculatePrimeNumberBands calculatePrimeNumberOscillator calculateQStick calculateRainbowOscillator calculateRandomWalkIndex calculateRangeActionVerificationIndex calculateRateOfChange calculateRelativeStrengthIndex calculateSQNTrend calculateSchaffTrendCycle calculateSchaffTrendCycleSignal calculateSimpleMovingAverage calculateSkewness calculateStandardDeviation calculateStandardError calculateStandardErrorBands calculateStochasticMomentumIndex calculateStochasticOscillator calculateStochasticOscillatorSmoothed calculateStollerAverageChannels calculateSuperTrend calculateSwingIndex calculateTimeSeriesMovingAverage calculateTradeVolumeIndex calculateTriangularMovingAverage calculateTripleExponentialAverage calculateTrueStrengthIndex calculateTwiggsMoneyFlow calculateTypicalPrice calculateUltimateOscillator calculateUltimateOscillatorSmoothed calculateVIDYA calculateVariableMovingAverage calculateVerticalHorizontalFilter calculateVolumeOscillator calculateVolumeRateOfChange calculateVolumeWeightedMovingAverage calculateWeightedClose calculateWeightedMovingAverage calculateWellesWilderSmoothing calculateWilliamsAccumulationDistribution calculateWilliamsPercentRange calculateWilliamsVariableAccumulationDistribution calculateZValue isPrime linearRegression

Constructors

Methods

  • Calculates Accumulation/distribution indicator (A/D) values based on given OHLC and Volume values.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values.

    Returns number[]

    An array of Accumulation/Distribution values, or null if calculations are not possible with given values.

  • Calculates Accumulative Swing Index (ASI) values using given data and maximum price change (limit move) values.

    Parameters

    • openValues: number[]

      OHLC-data Open values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • closeValues: number[]

      OHLC-data Close values.

    • limitMoveValue: number

      Maximum price change in one direction.

    Returns number[]

    An array of Accumulative Swing Index values, or null if calculations are not possible with given values.

  • Calculates Aroon Up and Aroon Down values using given number of time periods (n).

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • n: number

      Time period count.

    Returns number[][]

    An array containing two arrays, the first one has Aroon Up values and the second one Aroon Down values. Returns null if calculations are not possible with given values.

  • Calculates Aroon Oscillator values using given number of time periods (n).

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values

    • n: number

      Time period count.

    Returns number[]

    An array of Aroon Oscillator values, or null if calculations are not possible with given values.

  • Calculates Average Daily Range values using given number of time periods (n).

    Parameters

    • highValues: number[]

      OHLC data High values.

    • lowValues: number[]

      OHLC data Low values.

    • n: number

      Time period count.

    Returns number[]

    An array of Average Daily Range values, or null if calculations are not possible with given values.

  • Calculates Average Directional Index (ADX) values. Returns also values for Directional Movement Indicators (-DI and +DI).

    Parameters

    • closeValues: number[]

      OHLC data Close values.

    • highValues: number[]

      OHLC data High values.

    • lowValues: number[]

      OHLC data Low values.

    • n: number

      Period count.

    Returns number[][]

    An array containing three arrays, the first one has ADX values, the second one -DI values, and the third one +DI values. Returns null if calculations are not possible with given values.

  • Calculates Average True Range values using given number of time periods (n).

    Parameters

    • closeValues: number[]

      OHLC data Close values.

    • highValues: number[]

      OHLC data High values.

    • lowValues: number[]

      OHLC data Low values.

    • n: number

      Period count.

    Returns number[]

    An array of Average True Range values, or null if calculations are not possible with given values.

  • Calculates Awesome Oscillator values using given short-term and long-term time period counts.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • shortPeriodCount: number

      Short-term period count.

    • longPeriodCount: number

      Long-term period count.

    Returns number[]

    An array of Awesome Oscillator values, or null if calculations are not possible with given values.

  • Calculates Balance of Power (BOP) values using given moving average type and number of time periods (n) for smoothing.

    Parameters

    • openValues: number[]

      OHLC-data Open values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • closeValues: number[]

      OHLC-data Close values.

    • n: number

      Time period count.

    • movingAverageType: MovingAverageType

      Moving average type used for smoothing the indicator values.

    Returns number[]

    An array of Balance of Power values, or null if calculations are not possible with given values.

  • Calculates Bollinger Band values based on given number of time periods.

    Parameters

    • sourceValues: number[]

      Data values used as a basis for calculations, most commonly OHLC-data Close values.

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • n: number

      Period count.

    • standardDeviationMultiplier: number

      Number of standard deviations between the moving average line and the upper and the lower bands.

    Returns number[][]

    An array containing three arrays. The first array has the middle band values, the second has the upper band values, and the third one the lower band values. Returns null if calculations are not possible with given parameters.

  • Calculates Center of Gravity (COG) values using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Period count.

    • signalPeriods: number

      Period count for the Signal line.

    Returns number[][]

    An array containing two arrays: the first one has COG values and the second one Signal values.

  • Calculates Chaikin Money Flow values using given number of time periods.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values.

    • periodCount: number

      Period count.

    Returns number[]

    An array of Chaikin Money Flow values, or null if calculations are not possible with given values.

  • Calculates Chaikin Oscillator values using given number of fast and slow time periods.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values.

    • fastPeriodCount: number

      Fast period count.

    • slowPeriodCount: number

      Slow period count.

    Returns number[]

    An array of Chaikin Oscillator values, or null if calculations are not possible with given values.

  • Calculates Chaikin Volatility using given values and moving average.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • periodCount: number

      Period count for Chaikin Volatility.

    • periodCountMA: number

      Period count for the moving average used in calculations.

    • movingAverageType: MovingAverageType

      The type of the moving average used in calculations.

    Returns number[]

    An array of Chaikin Volatility values, or null if calculations are not possible with given values.

  • Calculates Chande Forecast Oscillator (CFO) values using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    Returns number[]

    An array of CFO values, or null if calculations are not possible with given values.

  • Calculates Chande Momentum Oscillator (CMO) values using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    Returns number[]

    An array of CMO values, or null if calculations are not possible with given values.

  • Calculates Choppiness Index (CHOP) values using given number of time periods (n).

    Parameters

    • closeValues: number[]

      OHLC data Close values.

    • highValues: number[]

      OHLC data High values.

    • lowValues: number[]

      OHLC data Low values.

    • n: number

      Period count.

    Returns number[]

    Array of Choppiness Index values, or null if calculation is not possible with given values.

  • Calculates Commodity Channel Index (CCI) values using given number of time periods (n).

    Parameters

    • closeValues: number[]

      OHLC data Close values.

    • highValues: number[]

      OHLC data High values.

    • lowValues: number[]

      OHLC data Low values.

    • n: number

      Period count.

    Returns number[]

    Array of Commodity Channel Index values, or null if calculation is not possible with given values.

  • Calculates Coppock Curve values using given time period counts.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • periodCountLongROC: number

      Period count for long Rate of Change.

    • periodCountShortROC: number

      Period count for short Rate of Change.

    • periodCountWMA: number

      Period count for Weighted Moving Average.

    Returns number[]

    An array of Coppock Curve values, or null if calculations are not possible with given values.

  • Calculates Correlation Coefficient between the two given datasets. If the datasets are of different length, the first values of the longer set are excluded from the calculations.

    Parameters

    • dataValues1: number[]

      First dataset values.

    • dataValues2: number[]

      Second dataset values.

    • n: number

      Time period count.

    Returns number[]

    An array of Correlation Coefficient values, or null if calculations are not possible with given values.

  • Calculates Detrended Price Oscillator (DPO) values using given moving average type and number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Period count.

    • movingAverageType: MovingAverageType

      Moving average to use during calculations.

    Returns number[]

    An array of DPO values, or null if calculations are not possible with given values.

  • Calculates values for Donchian Channels using given period count (n).

    Parameters

    • highValues: number[]

      OHLC data High values.

    • lowValues: number[]

      OHLC data Low values.

    • n: number

      Period count.

    Returns number[][]

    An array containing three arrays. The first array has the upper band values, the second has the lower band values, and the third one the middle band values. Returns null if calculations are not possible with given parameters.

  • Calculates Ease of Movement (EOM) values based on given number of time periods (n).

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values.

    • n: number

      Period count.

    • scale: number

      Scale for the Volume values to keep them compatible with the other values.

    • movingAverageType: MovingAverageType = MovingAverageType.SimpleMovingAverage

      Moving average to use during calculations.

    Returns number[]

    An array of EOM values, or null if calculations are not possible with given values.

  • Calculates Ehler Fisher Transform (EFT) values based on given time period counts.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • periodCount: number

      The number of overall time periods (lookup periods).

    • rawSmoothingPeriods: number

      The number of time periods used for raw smoothing before fisher transform.

    • fisherSmoothingPeriods: number

      The number of time periods used for final smoothing with EMA.

    • signalPeriodCount: number

      The number of time periods used to calculate the signal line.

    Returns number[][]

    An array containing two arrays: the first one has EFT-values and the second one Signal values. Returns null if calculations are not possible with given values.

  • Calculates Elder-Ray Index (Elder-Ray Power Indicator) using given moving average type and number of time periods (n).

    Parameters

    • sourceValues: number[]

      Data values used as a basis for calculations, most commonly OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • n: number

      Period count.

    • movingAverageType: MovingAverageType

      The type of the used moving average.

    Returns number[][]

    An array containing two arrays: the first one has Bull Power values and the second one Bear Power values. Returns null if calculations are not possible with given values.

  • Calculates custom Elder Thermometer using given number of time periods.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • n: number

      Time period count.

    Returns number[][]

    An array containing two arrays: Thermometer Bull values and Thermometer Bear values.

  • Calculates Elder's Force Index (EFI) using the given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • volumes: number[]

      Volume values.

    • n: number

      Period count.

    Returns number[]

    An array of EFI values, or null if calculations are not possible with given values.

  • Calculates Exponential Moving Average using given number of time periods (n).

    Parameters

    • values: number[]

      Data values to calculate from.

    • n: number

      The number of values to use in averaging each round (period count).

    Returns number[]

    Array of Exponential Moving Average values, or null if averaging is not possible for the given values.

  • Calculates Fractal Chaos Bands based on the given values and number of time periods.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • periodCount: number

      The number of bars/candles needed to form a fractal.

    Returns number[][]

    An array containing two arrays; the first one has the upper band values and the second lower band values. Returns null if calculations are not possible with given values.

  • Calculates Fractal Chaos Oscillator (FCO) using given number of time periods.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • periodCount: number

      The number of bars/candles needed to form a fractal.

    Returns number[]

    An array of FCO values, or null if calculations are not possible with given values.

  • Calculates Gopalakrishnan Range Index (GAPO) values based on given number of time periods (n).

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • n: number

      Period count.

    Returns number[]

    An array of GAPO values, or null if calculations are not possible with given values.

  • Calculates High Low Bands based on given data values and period count. Uses Triangular Moving Average to calculate the middle band.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Period count.

    • percentage: number

      Percentage of the TMA line to position the upper and lower bands.

    Returns number[][]

    An array containing three arrays. The first array has the middle band values, the second has the upper band values, and the third one the lower band values. Returns null if calculations are not possible with given parameters.

  • Calculates High Minus Low values.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    Returns number[]

    An array of High Minus Low values, or null if calculations are not possible with given values.

  • Calculates Historical Volatility Index (HVI) using given number of time periods.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Period count.

    • periodsPerYear: number

      The number of time periods used for annualizing the indicator.

    • standardDeviations: number

      The number of standard deviations used in calculations.

    • useMovingAverage: boolean

      Whether Simple Moving average is used to smooth the standard deviations values during the calculations.

    Returns number[]

    An array of HVI values, or null if calculations are not possible with given values.

  • Calculates Hull Moving Average using given number of time periods (n).

    Parameters

    • values: number[]

      Data values to calculate from.

    • n: number

      The number of values to use in averaging each round (period count).

    Returns number[]

    Array of Hull Moving Average values, or null if averaging is not possible for the given values.

  • Calculates various values related to Ichimoku Cloud. Does not return Chikou Span (Lagging Span) values, since they are the same as OHLC-data Close values. Also, Close values are not needed in the calculations. The returned data does not contain X-values or moving data forward or back.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • tenkanSenPeriodCount: number

      Tenkan-Sen (Conversion Line) period count.

    • kijunSenPeriodCount: number

      Kijun-Sen (Base Line) period count.

    • senkouSpanBPeriodCount: number

      Senkou Span B (Leading Span B) period count.

    Returns number[][]

    An array of arrays containing: -Array of Tenkan-Sen (Conversion Line) values. -Array of Kijun-Sen (Base Line) values. -Array of Senkou Span A (Leading Span A) values. -Array of Senkou Span B (Leading Span B) values. Returns null if calculations are not possible with given values.

  • Calculates Intraday Momentum Index (IMI) values using given number of time periods (n).

    Parameters

    • openValues: number[]

      OHLC-data Open values.

    • closeValues: number[]

      OHLC-data Close values.

    • n: number

      Period count.

    Returns number[]

    An array of IMI values, or null if calculations are not possible with given values.

  • Calculates values Keltner Channels. Uses Exponential Moving Average (EMA) of the typical price for the middle line and Average True Range (ATR) for the upper and lower bands.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • periodCountEMA: number

      Period count for EMA.

    • periodCountATR: number

      Period count for ATR.

    • multiplier: number

      Multiplier for ATR.

    Returns number[][]

    An array containing three arrays: an array for EMA values, an array for upper channel values, and an array for lower channel values. Returns null if calculations are not possible with given values.

  • Calculates Klinger Volume Oscillator (KVO) using given time period count and moving average types.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values.

    • shortPeriodCount: number

      Time period count for the shorter moving average.

    • longPeriodCount: number

      Time period count for the longer moving average.

    • signalPeriodCount: number

      Time period count for the Signal line.

    • movingAverageType: MovingAverageType

      Moving average used to calculate short and long averages.

    • movingAverageSignal: MovingAverageType

      Moving average used to calculate the Signal line.

    Returns number[][]

    An array containing three arrays. The first has the KVO values, the second the Signal values, and the third has the histogram values. Returns null if calculations are not possible with given values.

  • Calculates Kurtosis values based on given moving average type and number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Period count.

    • movingAverageType: MovingAverageType

      The type of the used moving average.

    Returns number[]

    An array of Kurtosis values, or null if calculations are not possible with given values.

  • Calculates Linear Regression indicator values using given number of time periods.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • periodCount: number

      Time period count.

    Returns number[][]

    An array containing four data arrays: -Linear Regression Slope values. -Linear Regression Intercept values. -Linear Regression Forecast values. -Linear regression R Squared (R2) values. Returns null if calculations are not possible with given values.

  • Calculates MACD, Signal Line, and Histogram.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • shortPeriod: number

      Short period count.

    • longPeriod: number

      Long period count.

    • signalPeriod: number

      Signal period count.

    Returns number[][]

    An array containing three arrays, the first one has MACD values, the second Signal values, and the third Histogram values. Returns null if calculations are not possible with given values.

  • Calculates MACD, Signal Line, and Histogram using given moving average types.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • shortPeriod: number

      Short period count.

    • longPeriod: number

      Long period count.

    • signalPeriod: number

      Signal period count.

    • movingAverageShort: MovingAverageType

      Moving average type used to calculate the short moving average.

    • movingAverageLong: MovingAverageType

      Moving average type used to calculate the long moving average.

    • movingAverageSignal: MovingAverageType

      Moving average type used to calculate the signal line.

    Returns number[][]

    An array containing three arrays, the first one has MACD values, the second Signal values, and the third Histogram values. Returns null if calculations are not possible with given values.

  • Calculates Market Facilitation Index values.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values.

    Returns number[][]

    An array containing two arrays: the first one has MFI values, and the second one has the bar colors as numbers. 1 = green (Green), 2 = blue (Fake), 3 = pink (Squat), 4 = brown (Fade) Returns null if calculations are not possible with given values.

  • Calculates Mass Index values using given number of time periods (n).

    Parameters

    • highValues: number[]

      OHLC-data High values

    • lowValues: number[]

      OHLC-data Low values.

    • n: number

      Period count.

    Returns number[]

    An array of Mass Index values, or null if calculations are not possible with given values.

  • Calculates Median Prices based on given High and Low values.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    Returns number[]

    An array of Median Prices, or null if calculations are not possible with given values.

  • Calculates Momentum Oscillator values using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Period count.

    Returns number[]

    An array of Momentum Oscillator values, or null if calculations are not possible with given values.

  • Calculates Money Flow Index values using given number of time periods (n).

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values.

    • n: number

      Period count.

    Returns number[]

    An array of Money Flow Index values, or null if calculations are not possible with given values.

  • Calculates Moving Average Envelopes based on given values and moving average type.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Period count for the moving average.

    • percentage: number

      Percentage of the moving average line to position the upper and lower bands.

    • movingAverageType: MovingAverageType

      The moving average type used to calculate the envelopes.

    Returns number[][]

    An array containing three arrays. The first array has the middle band values, the second has the upper band values, and the third one the lower band values. Returns null if calculations are not possible with given parameters.

  • Calculates Negative Volume Index (NVI) values based on given data and volume values.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • volumes: number[]

      Volume values.

    Returns number[]

    An array of NVI values, or null if calculations are not possible with given values.

  • Calculates On-Balance Volume values based on given data and Volume values.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • volumes: number[]

      Volume values.

    • startOBV: number = 0

      Optional starting value to which Volume values are added or subtracted from. If not given the first value will be the first Volume value.

    Returns number[]

    An array of On-Balance Volume values, or null if calculations are not possible with given values.

  • Calculates Parabolic SAR values using given values.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • accelerationFactor: number

      Acceleration Factor. Used as an initial values and as an incremental value.

    • maximumAccelerationFactor: number

      Maximum value for Acceleration Factor.

    Returns number[]

    An array of Parabolic SAR values. Return null if calculations are not possible with given values.

  • Calculates Percentage Price Oscillator values using given number of time periods (n). Returns also Signal and Histogram values.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • longPeriod: number

      Long period count.

    • shortPeriod: number

      Short period count.

    • signalPeriod: number

      Signal period count.

    Returns number[][]

    An array containing three arrays, the first one has PPO values, the second Signal values, and the third Histogram values. Returns null if calculations are not possible with given values.

  • Calculates Performance Index values.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    Returns number[]

    An array of Performance Index values, or null if calculations are not possible with given values.

  • Calculates Positive Volume Index (PVI) values based on given data and volume values.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • volumes: number[]

      Volume values.

    Returns number[]

    An array of PVI values, or null if calculations are not possible with given values.

  • Calculates Pretty Good Oscillator (PGO) values using given number of time periods and moving average types.

    Parameters

    • sourceValues: number[]

      Data values used as a basis for calculations, most commonly OHLC-data Close values.

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • periodCountMA: number

      The number of time periods used to calculate the moving averages.

    • periodCountATR: number

      The number of time periods used to calculate the Average True Range.

    • movingAverageMA: MovingAverageType

      The type of the OHLC-data based moving average.

    • movingAverageATR: MovingAverageType

      The type of the Average True Range based moving average.

    Returns number[]

    An array of PGO values, or null if calculations are not possible with given values.

  • Calculates Price Volume Trend (PVT) using given price and volume values.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • volumes: number[]

      Volume values.

    Returns number[]

    An array of PVT values, or null if calculations are not possible with given values.

  • Calculates Prime Number Bands based on given values.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    Returns number[][]

    An array containing two arrays. The first one has upper bands values and the second lower band values. Returns null if calculations are not possible with given values.

  • Calculates Prime Number Oscillator (PNO) values based on given data values.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    Returns number[]

    An array of PNO values, or null if calculations are not possible with given values.

  • Calculates QStick values using given moving average and number of time periods (n).

    Parameters

    • openValues: number[]

      OHLC-data Open values.

    • closeValues: number[]

      OHLC-data Close values.

    • n: number

      Period count.

    • movingAverageType: MovingAverageType

      Moving average to use during calculations.

    Returns number[]

    An array of QStick values, or null if calculations are not possible with given values.

  • Calculates Rainbow Oscillator values using given parameters and moving average type.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • periodCount: number

      The number of time periods used for calculating the series of moving averages.

    • lookbackPeriods: number

      The number of time periods checked when finding out the highest and lowest prices.

    • smoothingLevels: number

      The number of times the oscillator is smoothed with a moving average.

    • movingAverageType: MovingAverageType

      Moving average type used for calculating the series of averages.

    Returns number[][]

    An array containing three arrays: the first array has Rainbow Oscillator values, the second array has values for the upper band, and the third array has values for the lower band. Returns null if calculations are not possible with given values.

  • Calculates Random Walk Index (RWI) values using given number of time periods (n).

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • n: number

      Time period count.

    Returns number[][]

    An array containing two arrays: the first one has RWI High values and the second one RWI Low values. Returns null if calculations are not possible with given values.

  • Calculates Range Action Verification Index (RAVI) using given moving average types and time period counts.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • periodCountShort: number

      Period count for the shorter moving average.

    • periodCountLong: number

      Period count for the longer moving average.

    • movingAverageShort: MovingAverageType

      The type of the shorter moving average.

    • movingAverageLong: MovingAverageType

      The type of the longer moving average.

    Returns number[]

    An array of RAVI values, or null if calculations are not possible with given values.

  • Calculates Rate of Change (ROC) values using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    Returns number[]

    Array of Rate of Change values, or null if calculation is not possible with given values.

  • Calculates Relative Strength Index (RSI) using given number of time periods, N.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Number of values over which the smoothing calculation is applied.

    Returns number[]

    Array of Relative Strength Index values, or null if calculations are not possible.

  • Calculates SQN Trend (System Quality Number) using given values, moving average type and number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    • movingAverageType: MovingAverageType

      Moving average type used during calculations.

    Returns number[]

    An array of SQN Trend values, or null if calculations are not possible with given values.

  • Calculates Schaff Trend Cycle (STC) values using given time period counts and moving averages.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • macdShortPeriods: number

      The short period count for MACD calculations.

    • macdLongPeriods: number

      The long period count for MACD calculations.

    • firstStochPeriods: number

      The time period count used to calculate the first Stochastic, that is the lookback periods when finding the highest and lowest values.

    • firstStochKPeriods: number

      The time period count used to smooth the first Stochastic (%K).

    • firstStochDPeriods: number

      The time period count used to calculate the first %D values.

    • secondStochPeriods: number

      The time period count used to calculate the second Stochastic, that is the lookback periods when finding the highest and lowest values.

    • secondStochKPeriods: number

      The time period count used to smooth the second Stochastic (%K).

    • secondStochDPeriods: number

      The time period count used to calculate the second %D values, in other words the final STC values.

    • macdShortMA: MovingAverageType

      Moving average type to calculate the short moving average during MACD calculations.

    • macdLongMA: MovingAverageType

      Moving average type to calculate the long moving average during MACD calculations.

    • firstStochKMA: MovingAverageType

      Moving average type to calculate the first Stochastic %K values.

    • firstStochDMA: MovingAverageType

      Moving average type to calculate the first Stochastic %D values.

    • secondStochKMA: MovingAverageType

      Moving average type to calculate the second Stochastic %K values.

    • secondStochDMA: MovingAverageType

      Moving average type to calculate the second Stochastic %D values.

    Returns number[]

    An array of STC values, or null if calculations are not possible with given values.

  • Calculates Schaff Trend Cycle (STC) values using given time period counts and moving averages. This version uses MACD's Signal line as basis for Stochastic calculations.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • macdShortPeriods: number

      The short period count for MACD calculations.

    • macdLongPeriods: number

      The long period count for MACD calculations.

    • macdSignalPeriods: number

      The signal period count for MACD calculations.

    • firstStochPeriods: number

      The time period count used to calculate the first Stochastic, that is the lookback periods when finding the highest and lowest values.

    • firstStochKPeriods: number

      The time period count used to smooth the first Stochastic (%K).

    • firstStochDPeriods: number

      The time period count used to calculate the first %D values.

    • secondStochPeriods: number

      The time period count used to calculate the second Stochastic, that is the lookback periods when finding the highest and lowest values.

    • secondStochKPeriods: number

      The time period count used to smooth the second Stochastic (%K).

    • secondStochDPeriods: number

      The time period count used to calculate the second %D values, in other words the final STC values.

    • macdShortMA: MovingAverageType

      Moving average type to calculate the short moving average during MACD calculations.

    • macdLongMA: MovingAverageType

      Moving average type to calculate the long moving average during MACD calculations.

    • macdSignalMA: MovingAverageType

      Moving average type to calculate the signal line during MACD calculations.

    • firstStochKMA: MovingAverageType

      Moving average type to calculate the first Stochastic %K values.

    • firstStochDMA: MovingAverageType

      Moving average type to calculate the first Stochastic %D values.

    • secondStochKMA: MovingAverageType

      Moving average type to calculate the second Stochastic %K values.

    • secondStochDMA: MovingAverageType

      Moving average type to calculate the second Stochastic %D values.

    Returns number[]

    An array of STC values, or null if calculations are not possible with given values.

  • Calculates Simple Moving Average using given averaging frame length (window length, or period count N).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      The number of values to use in averaging each round (period count).

    Returns number[]

    Array of Simple Moving Average values, or null if averaging is not possible for the given values.

  • Calculates Skewness values based on given moving average type and number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    • movingAverageType: MovingAverageType

      The type of the used moving average.

    Returns number[]

    An array of Skewness values, or null if calculations are not possible with given values.

  • Calculates Standard Deviation values using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    • movingAverageType: MovingAverageType = MovingAverageType.None

      Optional moving average type, default is no averaging.

    Returns number[]

    An array of Standard Deviation values, or null if calculations are not possible with given values.

  • Calculates Standard Error values using given moving average and number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Period count.

    • movingAverageType: MovingAverageType

      Moving average to use during calculations.

    Returns number[]

    An array of Standard Error values, or null if calculations are not possible with given values.

  • Calculates Standard Error Bands values using given moving average type and number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    • multiplier: number

      Multiplier for the standard error used when calculating upper and lower bands.

    • movingAverageType: MovingAverageType

      The type of the used moving average.

    Returns number[][]

    An array containing three arrays. The first array has the middle band values, the second has the upper band values, and the third one the lower band values. Returns null if calculations are not possible with given parameters.

  • Calculates Stochastic Momentum Index (SMI) values using given moving average types and time period counts.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • periodCount: number

      The number of time periods to calculate the stochastic (%K) line. This is the lookback period for High/Low range.

    • firstSmoothPeriods: number

      The number of time periods used for the first smoothing of the stochastic (%K) values.

    • doubleSmoothPeriods: number

      The number of time periods used for the second (double) smoothing of the stochastic (%K) values.

    • movingAveragePeriods: number

      The number of time periods used to calculate the moving average (%D) line.

    • oscillatorMovingAverage: MovingAverageType

      The moving average used to smooth the oscillator (%K) line.

    • maMovingAverage: MovingAverageType

      The moving average used to calculate the moving average (%D) line.

    Returns number[][]

    An array of two arrays: the first one has SMI values (%K) while the second one has moving average values (%D). Returns null if calculations are not possible with given values.

  • Calculates Stochastic Oscillator values using given number of time periods (n).

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • n: number

      The number of time periods used to calculate the oscillator.

    • movingAveragePeriods: number

      The number of time periods used to calculate the moving average.

    Returns number[][]

    An array containing two arrays, the first one has Stochastic Oscillator values and the second one moving average values. Returns null if calculation is not possible with given values.

  • Calculates Smoothed Stochastic Oscillator values using given moving average types and time period counts.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • oscillatorPeriods: number

      The number of time periods used to calculate the stochastic (%K) values.

    • oscillatorSmoothingPeriods: number

      The number of time periods used to smooth the stochastic (%K) values.

    • movingAveragePeriods: number

      The number of time periods used to calculate the moving average (%D) values.

    • oscillatorMovingAverage: MovingAverageType

      The moving average type used to smooth the stochastic (%K) values.

    • maMovingAverage: MovingAverageType

      The moving average type used to calculate the moving average (%D) values.

    Returns number[][]

    An array containing two arrays: the first one has stochastic (%K) values while the second one has the moving average (%D) values. Returns null if calculations are not possible with given values.

  • Calculates Stoller Average Range Channels (STARC) using given moving average type and number of time periods.

    Parameters

    • sourceValues: number[]

      Data values used as a basis for calculations, most commonly OHLC-data Close values.

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • periodCountMA: number

      Period count for the moving average.

    • periodCountATR: number

      Period count for the Average True Range.

    • multiplier: number

      Multiplier for the Average True Range.

    • movingAverageType: MovingAverageType

      The type of the used moving average.

    Returns number[][]

    An array containing three arrays: an array for moving average values, an array for upper channel values, and an array for lower channel values. Returns null if calculations are not possible with given values.

  • Calculates Supertrend values using given number of time periods.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • periodCount: number

      Period count.

    • multiplier: number

      Multiplier for ATR.

    Returns number[]

    An array of Supertrend values, or null if calculations are not possible with values.

  • Calculates Swing Index (SI) values using given data and maximum price change (limit move) values.

    Parameters

    • openValues: number[]

      OHLC-data Open values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • closeValues: number[]

      OHLC-data Close values.

    • limitMoveValue: number

      Maximum price change in one direction.

    Returns number[]

    An array of Swing Index values, or null if calculations are not possible with given values.

  • Calculates Time Series Moving Average (TSMA) values using given number of time periods (n). Uses least squares regression fitting.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    Returns number[]

    An array of TSMA values, or null if calculations are not possible with given values.

  • Calculates Trade Volume Index (TVI) values using given minimum tick value.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • volumes: number[]

      Volume values.

    • minimumTickValue: number

      Minimum tick value to be used in the calculations.

    Returns number[]

    An array of TVI values, or null if calculations are not possible with given values.

  • Calculates Triangular Moving Average (TMA) values using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    Returns number[]

    An array of TMA values, or null if calculations are not possible with given values.

  • Calculates Triple Exponential Average (TRIX) values using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    Returns number[][]

    An array containing two arrays, the first one has Triple Exponential Average values and the second one 9-day Exponential Moving Average values. Returns null if calculations are not possible with given values.

  • Calculates True Strength Index (TSI) values using given time period counts and moving average types.

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • priceChangePeriods: number

      Time periods used to calculate the price change (value - value n periods ago).

    • firstSmoothPeriods: number

      Time periods used to calculate the first smoothing.

    • doubleSmoothPeriods: number

      Time periods used to calculate the second (double) smoothing.

    • signalPeriods: number

      Time periods used to calculate the signal values.

    • firstSmoothMovingAverage: MovingAverageType

      Moving average type used for the first smoothing.

    • doubleSmoothMovingAverage: MovingAverageType

      Moving average type used for the second (double) smoothing.

    • signalMovingAverage: MovingAverageType

      Moving average type used to calculate the signal values.

    Returns number[][]

    An array containing two arrays: the first one has TSI values while the second one has the signal values. Returns null if calculations are not possible with given values.

  • Calculates Twiggs Money Flow values using given OHLC- and Volume values and number of time periods (n).

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values.

    • n: number

      Period count.

    Returns number[]

    An array of Twiggs Money Flow values, or null if calculations are not possible with given values.

  • Calculates Typical Prices based on given High, Low and Close values.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • closeValues: number[]

      OHLC-data Close values.

    Returns number[]

    An array of Typical Prices, or null if calculations are not possible with given values.

  • Calculates Ultimate Oscillator (UO) values using given time period counts.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • shortPeriods: number

      Period count for the shortest average.

    • midPeriods: number

      Period count for the middle average.

    • longPeriods: number

      Period count for the longest average.

    Returns number[]

    An array of Ultimate Oscillator values, or null if calculations are not possible with given values.

  • Calculates Ultimate Oscillator Smoothed (UO ST) values using given time period counts and moving average.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • shortPeriods: number

      Period count for the shortest average.

    • midPeriods: number

      Period count for the middle average.

    • longPeriods: number

      Period count for the longest average.

    • movingAverageType: MovingAverageType

      Moving average to be used in smoothing

    Returns number[]

    An array of Ultimate Oscillator ST values, or null if calculations are not possible with given values.

  • Calculates Variable Index Dynamic Average (VIDYA) values using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    • periodCountStDevShort: number

      Short standard deviation period count used in VIDYA calculations.

    • periodCountStDevLong: number

      Long standard deviation period count used in VIDYA calculations.

    Returns number[]

    An array of VIDYA values, or null if calculations are not possible with given values.

  • Calculates Variable Moving Average (VMA) values using the given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    Returns number[]

    An array of VMA values, or null if calculations are not possible with given values.

  • Calculates Vertical Horizontal Filter (VHF) using given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    Returns number[]

    An array of VHF values, or null if calculations are not possible with given values.

  • Calculates Volume Oscillator (VO) using the given time period counts and moving average types.

    Parameters

    • volumes: number[]

      Volume values to calculate from.

    • shortPeriodCount: number

      Short-term period count.

    • longPeriodCount: number

      Long-term period count.

    • signalPeriodCount: number

      Period count for signal line.

    • calculateAsPercentage: boolean

      When enabled, the difference between the short and long moving averages is calculated as a percentage and not as an actual volume difference.

    • movingAverageType: MovingAverageType

      Moving average type for the short and long averages.

    • movingAverageSignal: MovingAverageType

      Moving average type for the signal line.

    Returns number[][]

    An array containing three arrays. The first has the VO values, the second the Signal values, and the third has the histogram values. Returns null if calculations are not possible with given values.

  • Calculates Volume Rate of Change (VROC) values using given number of time periods (n).

    Parameters

    • volumes: number[]

      Volumes values to calculate from.

    • n: number

      Period count.

    Returns number[]

    An array of VROC values, or null if calculations are not possible with given values.

  • Calculates Volume Weighted Moving Average (VWMA) values using the given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • volumes: number[]

      Volume values.

    • n: number

      Time period count.

    Returns number[]

    An array of VWMA values, or null if calculations are not possible with given values.

  • Calculates Weighted Close values based on given High, Low and Close values.

    Parameters

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • closeValues: number[]

      OHLC-data Close values.

    Returns number[]

    An array of Weighted Close values, or null if calculations are not possible with given values.

  • Calculates Weighted Moving Average using given number of time periods (n).

    Parameters

    • values: number[]

      Data values to calculate from.

    • n: number

      The number of values to use in averaging each round (period count).

    Returns number[]

    Array of Weighted Moving Average values, or null if averaging is not possible for the given values.

  • Calculates Welles Wilder Smoothing (WWS) for the data values using the given number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    Returns number[]

    An array of WWS values, or null if calculations are not possible with given values.

  • Calculates Williams Accumulation Distribution (WAD) values.

    Parameters

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values. Can be null if useVolume is set false (Volume values not incorporated into calculations).

    • useVolume: boolean

      Sets whether to take Volume into account during calculations.

    Returns number[]

    An array of WAD values, or null if calculations are not possible with given values.

  • Calculates Williams Percent Range values using given number of time periods (n).

    Parameters

    • sourceValues: number[]

      Data values used as a basis for calculations, most commonly OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • n: number

      Time period count.

    Returns number[]

    An array of Williams Percent Range values, or null if calculations are not possible with given values.

  • Calculates Williams Variable Accumulation Distribution (WVAD) values using given moving average and number of time periods (n).

    Parameters

    • openValues: number[]

      OHLC-data Open values.

    • closeValues: number[]

      OHLC-data Close values.

    • highValues: number[]

      OHLC-data High values.

    • lowValues: number[]

      OHLC-data Low values.

    • volumes: number[]

      Volume values.

    • n: number

      Period count.

    • movingAverageType: MovingAverageType

      Moving average to use during calculations.

    Returns number[]

    An array of WVAD values, or null if calculations are not possible with given values.

  • Calculates Z-Value values based on given moving average type and number of time periods (n).

    Parameters

    • dataValues: number[]

      Data values to calculate from.

    • n: number

      Time period count.

    • movingAverageType: MovingAverageType

      Moving average to use during calculations.

    Returns number[]

    An array of Z-Values, or null if calculations are not possible with given values.

  • Tests if given value is a prime number.

    Parameters

    • value: number

      Value to test.

    Returns boolean

    True if value is a prime number.

  • Calculate linear line fit for given points.

    Parameters

    • xInFactorization: number[]

      X-values that are used to calculate the factors. This is the point set where the regression line is fitted to.

    • yInFactorization: number[]

      Y-values that are used to calculate the factors. Length must be equal to xInFactorization length.

    • xValuesToFit: number[]

      X-values whose Y values are to be solved, using the factors.

    Returns number[]

    Array containing fitted Y-values. Returns null if unable to calculate with given values.