Functions

The following functions are available globally.

  • Simple moving average

    Declaration

    Swift

    public func sma(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

    n

    The period

  • Weighted moving average

    Declaration

    Swift

    public func wma(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

    n

    The period

  • Exponential moving average

    Declaration

    Swift

    public func ema(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

    n

    The period

  • Double exponential moving average

    Declaration

    Swift

    public func dema(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

    n

    The period

  • Triple exponential moving average

    Declaration

    Swift

    public func tema(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

    n

    The period

  • Triangular Moving Average

    Declaration

    Swift

    public func trima(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

    n

    The period

  • Kaufman Adaptive Moving Average /// - Parameter inputs: The inputs

    Declaration

    Swift

    public func kama(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    n

    The period

  • Compute the values of the three components of the bollinger bands

    Declaration

    Swift

    public func bbands(_ inputs: [Double], period: Int, stddev: Double) -> (Int, BBandResult)

    Parameters

    period

    The period

    stddev

    The standard deviation

    inputs

    The inputs

    Return Value

    The result as a tuple of (Int ,BBBandResult)

  • Vector Absolute Value

    Declaration

    Swift

    public func abs(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs values

  • Declaration

    Swift

    public func acos(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs values

  • Accumulation/Distribution Line

    Declaration

    Swift

    public func ad<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

  • Vector addition

    Declaration

    Swift

    public func add(a: [Double], b: [Double]) -> (Int, [Double])

    Parameters

    a

    Inputs A

    b

    Inputs B

  • Accumulation/Distribution Oscillator

    Declaration

    Swift

    public func adosc<T>(_ inputs: [T], short_period: Double, long_period: Double) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    short_period

    The short period value

    long_period

    The long period value

  • Average Directional Movement Index

    Declaration

    Swift

    public func adx<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    period

    The period

  • Average Directional Movement Rating

    Declaration

    Swift

    public func adxr<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    period

    The period

  • Aweosome Oscillator

    Declaration

    Swift

    public func ao<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An arrayof Quotable elements.

  • Absolute Price Oscillator

    Declaration

    Swift

    public func apo(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Aroon

    Declaration

    Swift

    public func arroon<T>(_ inputs: [T], period n: Int) -> (Int, ArroonResult) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period

  • Aroon Oscillator

    Declaration

    Swift

    public func aroonosc<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period

  • Vector Arcsine

    Declaration

    Swift

    public func asin(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs values

  • Vector Arctangent

    Declaration

    Swift

    public func atan(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs values

  • Average True Range

    Declaration

    Swift

    public func atr<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    The inputs

    n

    The period

  • Average Price

    Declaration

    Swift

    public func avgprice<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

  • Balance of Power

    Declaration

    Swift

    public func bop<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

  • Commodity Channel Index

    Declaration

    Swift

    public func cci<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period

  • Vector Ceiling

    Declaration

    Swift

    public func ceil(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Chande Momentum Oscillator

    Declaration

    Swift

    public func cmo(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

    n

    The period

  • Vector Cosine

    Declaration

    Swift

    public func cos(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Vector Hyperbolic Cosine

    Declaration

    Swift

    public func cosh(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Crossany

    Declaration

    Swift

    public func crossany(a: [Double], b: [Double]) -> (Int, [Double])

    Parameters

    a

    A values

    b

    B values

  • Crossover

    Declaration

    Swift

    public func crossover(a: [Double], b: [Double]) -> (Int, [Double])

    Parameters

    a

    A values

    b

    B values

  • Chaikins Volatility

    Declaration

    Swift

    public func cvi<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period

  • Linear Decay

    Declaration

    Swift

    public func decay(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

    n

    The period

  • Directional indicator

    Declaration

    Swift

    public func di<T>(_ inputs: [T], period n: Int) -> (Int, Direction) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period n

  • Vector division

    Declaration

    Swift

    public func div(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Directional Movement

    Declaration

    Swift

    public func dm<T>(_ inputs: [T], period n: Int) -> (Int, Direction) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period n

  • Detrended Price Oscillator

    Declaration

    Swift

    public func dpo(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

    n

    The period

  • Directional Movement Index

    Declaration

    Swift

    public func dx<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period

  • Exponential Decay

    Declaration

    Swift

    public func edecay(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

    n

    The period

  • Ease of Movement

    Declaration

    Swift

    public func emv<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

  • Vector Exponential

    Declaration

    Swift

    public func exp(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Fisher Transform

    Declaration

    Swift

    public func fisher<T>(_ inputs: [T], period n: Int) -> (Int, FisherResult) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period

  • Vector Floor

    Declaration

    Swift

    public func floor(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Forecast Oscillator

    Declaration

    Swift

    public func fosc(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

    n

    The period

  • Hull Moving Average

    Declaration

    Swift

    public func hma(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

    n

    The period

  • Klinger Volume Oscillator

    Declaration

    Swift

    public func kvo<T>(_ inputs: [T], short: Int, long: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    The input values

    short

    The short period

    long

    The long period

  • Lag

    Declaration

    Swift

    public func lag(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The period

    inputs

    The period

  • Linear Regression

    Declaration

    Swift

    public func linreg(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The period

    inputs

    The period

  • Linear Regression Intercept

    Declaration

    Swift

    public func linregintercept(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The period

    inputs

    The period

  • Linear Regression Slope

    Declaration

    Swift

    public func linregslope(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The period

    inputs

    The period

  • Vector Natural Log

    Declaration

    Swift

    public func ln(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Vector Base-10 Log

    Declaration

    Swift

    public func log10(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Moving Average Convergence/Divergence

    Declaration

    Swift

    public func macd(_ inputs: [Double], short: Int, long: Int, signal: Int) -> (Int, MACDResult)

    Parameters

    inputs

    The inputs values

    short

    The short period

    long

    The long period

    signal

    The signal period

  • Market Facilitation Index

    Declaration

    Swift

    public func marketfi<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

  • Mass Index

    Declaration

    Swift

    public func mass<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

  • Maximum In Period

    Declaration

    Swift

    public func max(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    An array of Quotable elements.

  • Mean Deviation Over Period

    Declaration

    Swift

    public func md(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    An array of Quotable elements.

  • Median Price

    Declaration

    Swift

    public func medprice<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

  • Money Flow Index

    Declaration

    Swift

    public func mfi<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

  • Momentum

    Declaration

    Swift

    public func mom(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    An array of Quotable elements.

  • Mesa Sine Wave

    Declaration

    Swift

    public func msw(_ inputs: [Double], period n: Int) -> (Int, MSWResult)

    Parameters

    inputs

    The input values

  • Vector Multiplication

    Declaration

    Swift

    public func mul(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Normalized Average True Range

    Declaration

    Swift

    public func natr<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

  • Normalized Average True Range

    Declaration

    Swift

    public func nvi<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

  • On Balance Volume

    Declaration

    Swift

    public func obv<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

  • Percentage Price Oscillator

    Declaration

    Swift

    public func ppo(_ inputs: [Double], short: Int, long: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Parabolic SAR

    Declaration

    Swift

    public func psar<T>(_ inputs: [T], acceleration: Double, accelerationMax: Double) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

    acceleration

    The acceleration factor

    accelerationMax

    The accelation factor maximum

  • Positive Volume Index

    Declaration

    Swift

    public func pvi<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

  • Qstick

    Declaration

    Swift

    public func qstick<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

    period

    The period

  • Rate of Change

    Declaration

    Swift

    public func roc(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Rate of Change Ratio

    Declaration

    Swift

    public func rocr(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Vector Round

    Declaration

    Swift

    public func round(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Relative Strength Index

    Declaration

    Swift

    public func rsi(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Vector Sine

    Declaration

    Swift

    public func sin(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Vector Hyperbolic Sine

    Declaration

    Swift

    public func sinh(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Vector Sqrt

    Declaration

    Swift

    public func sqrt(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Standard Deviation Over Period

    Declaration

    Swift

    public func stddev(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Standard Error Over Period

    Declaration

    Swift

    public func stderr(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Stochastic Oscillator

    Declaration

    Swift

    public func stoch<T>(_ inputs: [T], kPeriod: Int, kSlowingPeriod: Int, dPeriod: Int) -> (Int, StochResult) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements.

    period

    The period

  • Stochastic RSI

    Declaration

    Swift

    public func stochrsi(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Vector Substraction

    Declaration

    Swift

    public func sub(a: [Double], b: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Sum Over Period

    Declaration

    Swift

    public func sum(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    An array of Quotable elements.

  • Vector Tangent

    Declaration

    Swift

    public func tan(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Vector Hyperbolic Tangent

    Declaration

    Swift

    public func tanh(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Vector Degree Conversion

    Declaration

    Swift

    public func todeg(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Vector Radian Conversion

    Declaration

    Swift

    public func torad(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • True Range

    Declaration

    Swift

    public func tr<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

  • Trix

    Declaration

    Swift

    public func trix(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    An array of Quotable elements.

  • Vector Truncate

    Declaration

    Swift

    public func trunc(_ inputs: [Double]) -> (Int, [Double])

    Parameters

    inputs

    The inputs

  • Time Series Forecast

    Declaration

    Swift

    public func tsf(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    An array of Quotable elements.

  • Typical Price

    Declaration

    Swift

    public func typprice<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

  • Ultimate Oscillator

    Declaration

    Swift

    public func ultosc<T>(_ inputs: [T], short: Int, medium: Int, long: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    short

    The short period

    medium

    The medium period

    long

    The long period

  • Variance Over Period

    Declaration

    Swift

    public func variance(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Vertical Horizontal Filter

    Declaration

    Swift

    public func vhf(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Variable Index Dynamic Average

    Declaration

    Swift

    public func vidya(_ inputs: [Double], short: Int, long: Int, alpha: Double) -> (Int, [Double])

    Parameters

    inputs

    The input values

    short

    The short period

    long

    The long period

    alpha

    The alpha value

  • Annualized Historical Volatility

    Declaration

    Swift

    public func volatility(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Volume Oscillator

    Declaration

    Swift

    public func vosc<T>(_ inputs: [T], short: Int, long: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    short

    The short period

    long

    The long period

  • Volume Weighted Moving Average

    Declaration

    Swift

    public func vwma<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period

  • Williams Accumulation/Distribution

    Declaration

    Swift

    public func wad<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

  • Weighted Close Price

    Declaration

    Swift

    public func wcprice<T>(_ inputs: [T]) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

  • Wilders Smoothing

    Declaration

    Swift

    public func wilders(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The input values

  • Weighted Close Price

    Declaration

    Swift

    public func willr<T>(_ inputs: [T], period n: Int) -> (Int, [Double]) where T : Quotable

    Parameters

    inputs

    An array of Quotable elements

    n

    The period

  • Zero-Lag Exponential Moving Average

    Declaration

    Swift

    public func zlema(_ inputs: [Double], period n: Int) -> (Int, [Double])

    Parameters

    inputs

    The inputs

    n

    The period