Algorithms package of Indie language.


Types

Adx

type

Average directional index algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(adx_len, di_len) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]

Returns series of Minus Directional Indicator, Average Directional Index and Plus Directional Indicator.

Static methods

new
(adx_len, di_len) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]

Returns series of Minus Directional Indicator, Average Directional Index and Plus Directional Indicator.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Adx

@indicator('Example')
def Main(self):
    minus_di, adx, plus_di = Adx.new(adx_len=9, di_len=12)
    return minus_di[0], adx[0], plus_di[0]

Atr

type

Average true range algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(length, ma_algorithm) -> indie.Series[float]

Returns series of Average True Range values calculated for the length bars period using moving average specified by ma_algorithm argument.

Static methods

new
(length, ma_algorithm) -> indie.Series[float]

Returns series of Average True Range values calculated for the length bars period using moving average specified by ma_algorithm argument.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Atr

@indicator('Example')
def Main(self):
    atr = Atr.new(length=12, ma_algorithm='SMA')
    return atr[0]

Bb

type

Bollinger bands algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length, mult) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]

Returns middle, upper and lower series of Bollinger Bands calculated on src series for the length bars period.

Static methods

new
(src, length, mult) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]

Returns middle, upper and lower series of Bollinger Bands calculated on src series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Bb

@indicator('Example', overlay_main_pane=True)
def Main(self):
    lower, middle, upper = Bb.new(self.close, length=20, mult=2.0)
    return lower[0], middle[0], upper[0]

Cci

type

Commodity channel index algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Commodity Channel Index values calculated on src series for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Commodity Channel Index values calculated on src series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Cci

@indicator('Example')
def Main(self):
    cci = Cci.new(self.close, length=20)
    return cci[0]

Change

type

Algorithm to calculate change of a series of values. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns the difference between current src value and its value length bars ago.

Static methods

new
(src, length) -> indie.Series[float]

Returns the difference between current src value and its value length bars ago.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Change

@indicator('Example')
def Main(self):
    ch = Change.new(self.close)
    return ch[0]

Corr

type

Correlation coefficient algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(x, y, length) -> indie.Series[float]

Returns series of Correlation Coefficient values calculated from x and y series for the length bars period.

Static methods

new
(x, y, length) -> indie.Series[float]

Returns series of Correlation Coefficient values calculated from x and y series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Corr

@indicator('Example')
def Main(self):
    corr = Corr.new(self.close, self.open, length=14)
    return corr[0]

CumSum

type

Cumulative sum algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src) -> indie.Series[float]

Returns series of cumulative sum of src values.

Static methods

new
(src) -> indie.Series[float]

Returns series of cumulative sum of src values.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import CumSum

@indicator('Example')
def Main(self):
    cs = CumSum.new(self.close)
    return cs[0]

Dev

type

Mean absolute deviation algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Mean Absolute Deviation values calculated on src series for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Mean Absolute Deviation values calculated on src series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Dev

@indicator('Example')
def Main(self):
    dev = Dev.new(self.close, length=12)
    return dev[0]

Donchian

type

Donchian channels algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(length) -> indie.Series[float]

Returns series of Middle Channel of Donchian Channels calculated for the length bars period.

Static methods

new
(length) -> indie.Series[float]

Returns series of Middle Channel of Donchian Channels calculated for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Donchian

@indicator('DC', overlay_main_pane=True)
def Main(self):
    d = Donchian.new(length=20)
    return d[0]

Ema

type

Exponential moving average algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Exponential Moving Average values calculated on src series for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Exponential Moving Average values calculated on src series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Ema

@indicator('Example', overlay_main_pane=True)
def Main(self):
    ema = Ema.new(self.close, length=9)
    return ema[0]

FixNan

type

Algorithm that replaces all math.nan values with the most recent corresponding non-nan values in a series. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src) -> indie.Series[float]

Returns series created from src by replacing math.nan values with previous nearest non-nan value.

Static methods

new
(src) -> indie.Series[float]

Returns series created from src by replacing math.nan values with previous nearest non-nan value.

# indie:lang_version = 5
import math
from indie import indicator, MutSeriesF
from indie.algorithms import FixNan

@indicator('Example', overlay_main_pane=True)
def Main(self):
    # Variable `s` is just an example of a series with `nan` values:
    s = MutSeriesF.new(math.nan)
    if self.close[0] > self.open[0]:
        s[0] = self.close[0]
    # `FixNan` replaces every `nan` value in `s` with the closest non-`nan` value on the left of it:
    s2 = FixNan.new(s)
    return s2[0]
See also: NanToZero

Highest

type

Algorithm that returns the maximum value over a given period. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns maximum value of given src series over a period of length bars.

Static methods

new
(src, length) -> indie.Series[float]

Returns maximum value of given src series over a period of length bars.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Highest

@indicator('My Indie 1', overlay_main_pane=True)
def Main(self):
    h = Highest.new(self.high, length=12)
    return h[0]
See also: SinceHighest

LinReg

type

Linear regression algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length, offset) -> indie.Series[float]

Returns series of Linear Regression Curve values calculated on src series for the length bars period (with possible offset offset).

Static methods

new
(src, length, offset) -> indie.Series[float]

Returns series of Linear Regression Curve values calculated on src series for the length bars period (with possible offset offset).

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import LinReg

@indicator('Example')
def Main(self):
    lr = LinReg.new(self.close, length=14, offset=0)
    return lr[0]

Lowest

type

Algorithm that returns the minimum value over a given period. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns minimum value of given src series over a period of length bars.

Static methods

new
(src, length) -> indie.Series[float]

Returns minimum value of given src series over a period of length bars.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Lowest

@indicator('My Indie 1', overlay_main_pane=True)
def Main(self):
    l = Lowest.new(self.low, length=12)
    return l[0]
See also: SinceLowest

Ma

type

Moving average algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length, algorithm) -> indie.Series[float]

Returns a moving average of src specified by algorithm argument.

Static methods

new
(src, length, algorithm) -> indie.Series[float]

Returns a moving average of src specified by algorithm argument.

# indie:lang_version = 5
from indie.algorithms import Ma

@indicator('Example', overlay_main_pane=True)
def Main(self):
    ma = Ma.new(self.close, length=12, algorithm='SMA')
    return ma[0]

Macd

type

Moving average convergence/divergence algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, fast_len, slow_len, sig_len, ma_source, ma_signal) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]

Returns series of Moving Average Convergence/Divergence, Signal Line and Histogram Line values calculated from series of src for fast_len, slow_len and sig_len bars periods using moving averages specified by ma_source and ma_signal argument.

Static methods

new
(src, fast_len, slow_len, sig_len, ma_source, ma_signal) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]

Returns series of Moving Average Convergence/Divergence, Signal Line and Histogram Line values calculated from series of src for fast_len, slow_len and sig_len bars periods using moving averages specified by ma_source and ma_signal argument.

# indie:lang_version = 5
from indie.algorithms import Macd

@indicator('Example', overlay_main_pane=True)
def Main(self):
    macd = Macd.new(self.close, fast_length=12, slow_length=26, sig_length=9, ma_source='EMA', ma_signal='EMA')
    return macd[0]

Median

type

Moving median algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Moving Median values calculated from series of src for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Moving Median values calculated from series of src for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Median

@indicator('Example', overlay_main_pane=True)
def Main(self):
    m = Median.new(self.close, length=10)
    return m[0]

Mfi

type

Money flow index algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Money Flow Index values calculated from series of src for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Money Flow Index values calculated from series of src for the length bars period.

# indie:lang_version = 5
from indie.algorithms import Mfi

@indicator('Example', overlay_main_pane=True)
def Main(self):
    mfi = Mfi.new(self.hlc3, length=14)
    return mfi[0]

Mfv

type

Money flow volume algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
() -> indie.Series[float]

Returns series of Money Flow Volume.

Static methods

new
() -> indie.Series[float]

Returns series of Money Flow Volume.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Mfv

@indicator('Example')
def Main(self):
    mfv = Mfv.new()
    return mfv[0]

NanToZero

type

Algorithm that replaces all math.nan values with zeros in a series. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src) -> indie.Series[float]

Returns series created from src by replacing math.nan values with zeros.

Static methods

new
(src) -> indie.Series[float]

Returns series created from src by replacing math.nan values with zeros.

# indie:lang_version = 5
import math
from indie import indicator, MutSeriesF
from indie.algorithms import NanToZero

@indicator('Example')
def Main(self):
    # Variable `s` is just an example of a series with `nan` values:
    s = MutSeriesF.new(math.nan)
    if self.close[0] > self.open[0]:
        s[0] = 0 if math.isnan(s[1]) else s[1] + 1
    # `NanToZero` replaces every `nan` value in `s` with zero
    s2 = NanToZero.new(s)
    return s2[0]
See also: FixNan

NetVolume

type

Net volume algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src) -> indie.Series[float]

Returns series of Net Volume values calculated on src series.

Static methods

new
(src) -> indie.Series[float]

Returns series of Net Volume values calculated on src series.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import NetVolume

@indicator('Example')
def Main(self):
    nv = NetVolume.new(self.close)
    return nv[0]

PercentRank

type

Percent rank algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Percent Rank (number of previous values that are less or equal to the current value) calculated on src series for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Percent Rank (number of previous values that are less or equal to the current value) calculated on src series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import PercentRank

@indicator('Example')
def Main(self):
    pr = PercentRank.new(self.close, length=12)
    return pr[0]

Rma

type

RMA algorithm is a moving average algorithm that is used to calculate RSI. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns a Moving Average that is used in calculations of Rsi.

Static methods

new
(src, length) -> indie.Series[float]

Returns a Moving Average that is used in calculations of Rsi.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Rma

@indicator('My Indie 1', overlay_main_pane=True)
def Main(self):
    rma = Rma.new(self.close, length=12)
    return rma[0]

Roc

type

Rate of change algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Rate Of Change (percentage of change between the current value and value length bars ago) calculated on src series.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Rate Of Change (percentage of change between the current value and value length bars ago) calculated on src series.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Roc

@indicator('Example')
def Main(self):
    roc = Roc.new(self.close, length=9)
    return roc[0]

Rsi

type

Relative strength index algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Relative Strength Index values calculated on src series for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Relative Strength Index values calculated on src series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Rsi

@indicator('Example')
def Main(self):
    rsi = Rsi.new(self.close, length=12)
    return rsi[0]

Sar

type

Parabolic stop and reverse algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(start, increment, maximum) -> indie.Series[float]

Returns series of Parabolic Stop And Reverse values.

Static methods

new
(start, increment, maximum) -> indie.Series[float]

Returns series of Parabolic Stop And Reverse values.

# indie:lang_version = 5
from indie.algorithms import Sar

@indicator('Example', overlay_main_pane=True)
def Main(self):
    sar = Sar.new(start=0.02, increment=0.02, maximum=0.2)
    return sar[0]

SinceHighest

type

Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[int]

Returns the number of bars after the maximum price for the length bars period.

Static methods

new
(src, length) -> indie.Series[int]

Returns the number of bars after the maximum price for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import SinceHighest

@indicator('Example')
def Main(self):
    sh = SinceHighest.new(self.high, length=10)
    return sh[0]
See also: Highest

SinceLowest

type

Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[int]

Returns the number of bars after the minimum price for the length bars period.

Static methods

new
(src, length) -> indie.Series[int]

Returns the number of bars after the minimum price for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import SinceLowest

@indicator('Example')
def Main(self):
    sl = SinceLowest.new(self.high, length=10)
    return sl[0]
See also: Lowest

SinceTrue

type

Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(condition) -> indie.Series[int]

Returns an index of the last True in condition series; if no such True is found, returns -1.

Static methods

new
(condition) -> indie.Series[int]

Returns an index of the last True in condition series; if no such True is found, returns -1.

# indie:lang_version = 5
from indie import indicator, MutSeries
from indie.algorithms import SinceTrue

@indicator('Example')
def Main(self):
    cond = MutSeries[bool].new(self.close[0] > self.open[0])
    index = SinceTrue.new(cond)
    return index

Sma

type

Simple moving average algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Simple Moving Average values calculated from series of src for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Simple Moving Average values calculated from series of src for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Sma

@indicator('Example')
def Main(self):
    sma = Sma.new(self.close, length=12)
    return sma[0]

StdDev

type

Standard deviation algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Standard Deviation values calculated from series of src for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Standard Deviation values calculated from series of src for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import StdDev

@indicator('Example')
def Main(self):
    sd = StdDev.new(self.close, length=12)
    return sd[0]

Stoch

type

Stochastic algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, low, high, length) -> indie.Series[float]

Returns series of Stochastic on src series with high and low highs and lows of the source over a period of length bars.

Static methods

new
(src, low, high, length) -> indie.Series[float]

Returns series of Stochastic on src series with high and low highs and lows of the source over a period of length bars.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Stoch

@indicator('Example')
def Main(self):
    s = Stoch.new(self.close, self.low, self.high, length=14)
    return s[0]

Sum

type

Sliding sum algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Sliding Sum values calculated on src series for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Sliding Sum values calculated on src series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Sum

@indicator('Example')
def Main(self):
    s = Sum.new(self.close, length=10)
    return s[0]

Supertrend

type

Supertrend algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(factor, atr_period, ma_algorithm) -> tuple[indie.Series[float], indie.Series[float]]

Returns a tuple of two Supertrend series: Supertrend Line and Direction Of Trend.

Static methods

new
(factor, atr_period, ma_algorithm) -> tuple[indie.Series[float], indie.Series[float]]

Returns a tuple of two Supertrend series: Supertrend Line and Direction Of Trend.

# indie:lang_version = 5
from indie import indicator, color, plot
from indie.algorithms import Supertrend

@indicator('Example', overlay_main_pane=True)
def Main(self):
    st, dir = Supertrend.new(factor=3.0, atr_period=10, ma_algorithm='SMA')
    c = color.RED if dir[0] > 0 else color.GREEN
    return plot.Line(st[0], color=c)

Tr

type

True range algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(handle_na) -> indie.Series[float]

Returns series of True Range values.

Static methods

new
(handle_na) -> indie.Series[float]

Returns series of True Range values.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Tr

@indicator('Example')
def Main(self):
    tr = Tr.new()
    return tr[0]

Tsi

type

True strength index algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, long_len, short_len) -> indie.Series[float]

Returns series of True Strength Index values.

Static methods

new
(src, long_len, short_len) -> indie.Series[float]

Returns series of True Strength Index values.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Tsi

@indicator('Example')
def Main(self):
    tsi = Tsi.new(self.close, long_len=21, short_len=12)
    return tsi[0]

Uo

type

Ultimate oscillator algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(fast_len, middle_len, slow_len) -> indie.Series[float]

Returns series of Ultimate Oscillator values calculated for fast_len, middle_len and slow_len bars periods.

Static methods

new
(fast_len, middle_len, slow_len) -> indie.Series[float]

Returns series of Ultimate Oscillator values calculated for fast_len, middle_len and slow_len bars periods.

# indie:lang_version = 5
from indie.algorithms import Uo

@indicator('Example', overlay_main_pane=True)
def Main(self):
    uo = Uo.new(fast_len=7, middle_len=14, slow_len=28)
    return uo[0]

Vwap

type

Volume weighted average price algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, anchor, std_dev_mult) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]

Returns series of Volume Weighted Average Price values with band of its standard deviation.

Static methods

new
(src, anchor, std_dev_mult) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]

Returns series of Volume Weighted Average Price values with band of its standard deviation.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Vwap

@indicator('Example', overlay_main_pane=True)
def Main(self):
    main_line, upper, lower = Vwap.new(self.close, anchor='Day', std_dev_mult=1.0)
    return main_line[0], upper[0], lower[0]

Vwma

type

Volume weighted moving average algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Volume Weighted Moving Average values calculated for src series for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Volume Weighted Moving Average values calculated for src series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Vwma

@indicator('Example', overlay_main_pane=True)
def Main(self):
    vwma = Vwma.new(self.close, length=12)
    return vwma[0]

Wma

type

Weighted moving average algorithm. Read here about how to use it.

Parent

Inherited fields

ctx
indie.Context

Represents context of an instrument which is currently bound to this algorithm instance. An indicator has at least one instrument — the main instrument of a chart where the indicator was added to. Besides the main instrument an indicator may have several additional instruments, which is done with the help of Context.calc_on function.

Methods

__init__
(ctx) -> None

Class constructor (initializer for the data type).

calc
(src, length) -> indie.Series[float]

Returns series of Weighted Moving Average values calculated for src series for the length bars period.

Static methods

new
(src, length) -> indie.Series[float]

Returns series of Weighted Moving Average values calculated for src series for the length bars period.

# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Wma

@indicator('Example', overlay_main_pane=True)
def Main(self):
    wma = Wma.new(self.close, length=12)
    return wma[0]