TakeProfit logo CommunityPlatform



Package indie

Main package of indie language.
 

  • CONTENTS

algorithm @band() Color color Context @ctx_func() @fill() Fill format @func() @indicator() IndieError @level() line_style mut_series() MutSeries Optional param @param_ref() @plot() Plot plot_style PlotDisplayOptions Series series() source SymbolInfo tf() TimeFrame

 


Types

 


Color

type

Data type to represent color.
 

  • MEMBERS

__call__()

  • SEE ALSO

Plot Fill color

 



Context

type

Data type that represents an instrument with OHLCV series values and other related information. A ctx: Context object is the first required parameter of the main() function of any indicator.
 

  • MEMBERS

bar_count bar_index calc_on() close high hl2 hlc3 info is_last_bar is_last_history_bar is_realtime low ohlc4 open time time_frame volume

  • SEE ALSO

Series

 



Fill

type

Class-container for a fill object.
 

  • MEMBERS

__init__()

  • SEE ALSO

@fill() Plot

 



IndieError

type

Data type for Indie errors.
 

  • MEMBERS

__init__()

 



MutSeries

type

Data type that represents read-write series of numeric values like prices of some instrument.
 

  • MEMBERS

__getitem__() __len__() __setitem__() get() request_size()

  • SEE ALSO

mut_series() Context Series

 



Optional[T]

type

Builtin Indie type (similar to Python typing.Optional).
 

  • MEMBERS

value() value_or()

 



Plot

type

Class-container for a plot object.
 

  • MEMBERS

__init__()

  • SEE ALSO

@plot() Fill

 



PlotDisplayOptions

type

Data type to represent the ways to display plot data.
 

  • MEMBERS

__init__()

 



Series

type

Data type that represents read only series of numeric values like prices of some instrument.
 

  • MEMBERS

__getitem__() __len__() __setitem__() get() request_size()

  • SEE ALSO

MutSeries Context

 



SymbolInfo

type

Data type to represent information about the context's instrument.
 

  • MEMBERS

exchange_aliases exchange_code marketdata_timezone price_precision tick_size ticker

  • SEE ALSO

Context

 



TimeFrame

type

Data type to represent time frame.
 

  • MEMBERS

to_minutes()

  • REMARKS

Use tf() to create TimeFrame instances.

  • SEE ALSO

tf()

 



format

type

Class-container for indicator values formatting ways.
 

  • MEMBERS

INHERITED PRICE VOLUME

  • SEE ALSO

@indicator()

 



line_style

type

Class-container for builtin line rendering ways.
 

  • MEMBERS

DASHED DOTTED SOLID

 



param

type

Class-container for decorators for indicator input parameters.
 

  • MEMBERS

@bool() @float() @int() @source() @string() @time_frame()

  • SEE ALSO

@indicator()

 



plot_style

type

Class-container for builtin plot rendering ways.
 

  • MEMBERS

COLUMNS HISTOGRAM LINE STEPS

 



source

type

Class-container for builtin series got from ctx used to initialize source input parameter.
 

  • MEMBERS

CLOSE HIGH HL2 HLC3 LOW OHLC4 OPEN VOLUME

  • SEE ALSO

@indicator()

 


Decorators

 


@band()

decorator

Creates a band (two horizontal lines usually with a semi-transparent fill in between them). Declares common attributes.
 

  • SIGNATURES
@band(
  value1: float,
  value2: float,
  title: indie.Optional[str] = None,
  fill_color: indie.Color = indie.color.GREEN(0.05),
  line_color: indie.Color = indie.color.GRAY(0.5),
  line_style: int = indie.line_style.DASHED,
  line_width: int = 1
) -> NoneType
  • PARAMETERS

    • value1 — Value of the first horizontal line of a band on a vertical scale of an indicator.

    • value2 — Value of the second horizontal line of a band on a vertical scale of an indicator.

    • title — Human readable title which is visible in the indicator's Settings panel.

    • fill_color — Color of the background.

    • line_color — Color of the line.

    • line_style — Style of the line. It is represented as enum value of type line_style.

    • line_width — Width of the line.

  • EXAMPLE

@indicator('Band example')
@band(145, 155, line_color=color.RED, line_width=4)
def main(ctx):
    return ctx.close[0]
  • SEE ALSO

@indicator() @level()

 



@ctx_func()

decorator

Decorates a function, making it a secondary main() function for additional instrument of an indicator. Additional instruments are requested with the help of ctx.calc_on() function and this decorator.
 

  • SIGNATURES
@ctx_func() -> NoneType
  • EXAMPLE
from indie import indicator, ctx_func, param

@ctx_func
def main2(ctx):
    return ctx.high[0], ctx.low[0]

@indicator('Minimal calc_on example', overlay_main_pane=True)
@param.time_frame('sec_time_frame', default='1D')
def main(ctx, sec_time_frame):
    sec_high, sec_low = ctx.calc_on(time_frame=sec_time_frame, ctx_func=main2)
    return sec_high[0], sec_low[0]
  • REMARKS

More info on this topic you can find in Request additional instruments chapter.

  • SEE ALSO

@indicator() Context Context.calc_on()

 



@fill()

decorator

Declares attributes of a fill between some two plots of an indicator. Could be applied only to the main() function of the indicator. Example of an indicator with a single colored fill is Bollinger Bands (BB), of a multicolored fill — Ichimoku Cloud. When applied, it must match with the result of the main() indicator function.
 

  • SIGNATURES
@fill(
  id1: str,
  id2: str,
  id: indie.Optional[str] = None,
  title: indie.Optional[str] = None,
  color: indie.Optional[indie.Color] = None
) -> NoneType
  • PARAMETERS

    • id1 — Identifier of the first plot to which the fill is applied.

    • id2 — Identifier of the second plot to which the fill is applied.

    • id — Identifier of the fill (auto generated).

    • title — Human readable title which is visible in the indicator's Settings panel.

    • color — Color of the fill on a chart. This color can be overwritten if the fill is a multicolored one.

  • EXAMPLE

@plot('one')
@plot('two')
@fill('one', 'two', color=color.GREEN)
def main(ctx):
    return ctx.high[0], ctx.low[0], Fill()
  • REMARKS

More info about fills (for example about multicolored ones) could be found in Fills, levels and bands chapter.

  • SEE ALSO

@plot() Fill

 



@func()

decorator

Decorates a function, making it a series processor function. Series processor functions are specifically designed to process series of data (it is allowed for them to work with Series and Context objects), like close prices of an instrument on a candle chart.
 

  • SIGNATURES
@func() -> NoneType
  • REMARKS

Most of the functions in the indie.algorithm package are decorated with @func() decorator. Read more about it in Series processors chapter.

  • SEE ALSO

Series Context

 



@indicator()

decorator

Main decorator for an indicator. Should decorate main() function. Declares common attributes.
 

  • SIGNATURES
@indicator(
  abbrev_title: str,
  overlay_main_pane: bool = False,
  format: int = indie.format.INHERITED,
  precision: indie.Optional[int] = None
) -> NoneType
  • PARAMETERS

    • abbrev_title — Abbreviated title of the indicator.

    • overlay_main_pane — Whether or not to overlay the indicator over the main pane of the chart. The main pane of a chart is the one with the main instrument on it.

    • format — Formatting style of indicator output values represented as enum value of type format.

    • precision — Number of digits after floating point for indicator output values.

 



@level()

decorator

Creates a level (horizontal line). Declares common attributes.
 

  • SIGNATURES
@level(
  value: float,
  title: indie.Optional[str] = None,
  line_color: indie.Color = indie.color.GRAY(0.5),
  line_style: int = indie.line_style.DASHED,
  line_width: int = 1
) -> NoneType
  • PARAMETERS

    • value — Value of the level on a vertical scale of an indicator.

    • title — Human readable title which is visible in the indicator's Settings panel.

    • line_color — Color of the line.

    • line_style — Style of the line. It is represented as enum value of type line_style.

    • line_width — Width of the line.

  • EXAMPLE

@indicator('Level example')
@level(150, line_color=color.RED, line_width=4)
def main(ctx):
    return ctx.close[0]
  • SEE ALSO

@indicator() @band()

 



@param.bool()

decorator

Declares a bool input parameter of indicator. Input parameters could be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in main() function definition.
 

  • SIGNATURES
@bool(
  id: str,
  default: bool,
  title: indie.Optional[str] = None
) -> NoneType
  • PARAMETERS

    • id — Name of main() parameter binded to the input parameter.

    • default — Default value for the parameter in settings pane.

    • title — Human readable title which is visible in the indicator's Settings panel.

  • EXAMPLE

@param.bool('is_something_enabled', default=False)
def main(ctx, is_something_enabled):
    # Use is_something_enabled variable...
  • SEE ALSO

@indicator() param

 



@param.float()

decorator

Declares a float input parameter of indicator. Input parameters could be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in main() function definition.
 

  • SIGNATURES
@float(
  id: str,
  default: float,
  min: float = -1000000.0,
  max: float = 1000000.0,
  step: float = 0.1,
  title: indie.Optional[str] = None
) -> NoneType
  • PARAMETERS

    • id — Name of main() parameter binded to the input parameter.

    • default — Default value for the parameter in settings pane.

    • min — Minimum value of the parameter.

    • max — Maximum value of the parameter.

    • step — Step between values of the parameter.

    • title — Human readable title which is visible in the indicator's Settings panel.

  • EXAMPLE

@param.float('speed_of_light', default=299_792.458)
def main(ctx, speed_of_light):
    # Use speed_of_light variable...
  • SEE ALSO

@indicator() param

 



@param.int()

decorator

Declares an integer input parameter of indicator. Input parameters could be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in main() function definition.
 

  • SIGNATURES
@int(
  id: str,
  default: int,
  min: int = -1000000,
  max: int = 1000000,
  step: int = 1,
  title: indie.Optional[str] = None
) -> NoneType
  • PARAMETERS

    • id — Name of main() parameter binded to the input parameter.

    • default — Default value for the parameter in settings pane.

    • min — Minimum value of the parameter.

    • max — Maximum value of the parameter.

    • step — Step between values of the parameter.

    • title — Human readable title which is visible in the indicator's Settings panel.

  • EXAMPLE

@param.int('meaning_of_life', default=42)
def main(ctx, meaning_of_life):
    # Use meaning_of_life variable...
  • SEE ALSO

@indicator() param

 



@param.source()

decorator

Declares a source input parameter of indicator. Input parameters could be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in main() function definition.
 

  • SIGNATURES
@source(
  id: str,
  default: int = source.CLOSE,
  options: indie.Optional[list[int]] = None,
  title: indie.Optional[str] = None
) -> NoneType
  • PARAMETERS

    • id — Name of main() parameter binded to the input parameter.

    • default — Default value for the parameter in settings pane.

    • options — List of the possible values of the parameter.

    • title — Human readable title which is visible in the indicator's Settings panel.

  • EXAMPLE

@param.source('src', default=source.CLOSE, options=[source.CLOSE, source.HL2, source.HLC3, source.OHLC4])
def main(ctx, src):
    # Use src variable...
  • REMARKS

Even if options parameter is not used then in Settings panel nevertheless there will be a combobox widget with all possible values from the source enum.

  • SEE ALSO

@indicator() param source

 



@param.string()

decorator

Declares a string input parameter of indicator. Input parameters could be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in main() function definition.
 

  • SIGNATURES
@string(
  id: str,
  default: str,
  options: indie.Optional[list[str]] = None,
  title: indie.Optional[str] = None
) -> NoneType
  • PARAMETERS

    • id — Name of main() parameter binded to the input parameter.

    • default — Default value for the parameter in settings pane.

    • options — List of the possible values of the parameter.

    • title — Human readable title which is visible in the indicator's Settings panel.

  • EXAMPLE

@param.string('name', default='Bart', options=['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'])
def main(ctx, name):
    # Use name variable...
  • REMARKS

If options parameter is used then in Settings panel there will be a combobox widget for changing value of this input.

  • SEE ALSO

@indicator() param

 



@param.time_frame()

decorator

Declares a time frame input parameter of indicator. Input parameters could be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in main() function definition.
 

  • SIGNATURES
@time_frame(
  id: str,
  default: str,
  options: indie.Optional[list[str]] = None,
  title: indie.Optional[str] = None
) -> NoneType
  • PARAMETERS

    • id — Name of main() parameter binded to the input parameter.

    • default — Default value for the parameter in settings pane.

    • options — List of the possible values of the parameter.

    • title — Human readable title which is visible in the indicator's Settings panel.

  • EXAMPLE

@param.time_frame('time_frame', default='30m', options=['1m', '30m', '1h', '4h', '1D', '1W', '1M', '1Y'])
def main(ctx, time_frame):
    # Use time_frame variable...
  • REMARKS

The type of time_frame in the example variable will be TimeFrame. But please note, that for the convenience, default value has str type.

If options parameter is used then in Settings panel there will be a combobox widget for changing value of this input.

  • SEE ALSO

@indicator() param TimeFrame tf()

 



@param_ref()

decorator

Declares an input parameter for @ctx_func function that is linked to the input parameter of main() by id.
 

  • SIGNATURES
@param_ref(id: str) -> NoneType
  • PARAMETERS

    • id — Name of main() parameter binded to the input parameter.
  • EXAMPLE

@ctx_func
@param_ref('referenced_param')
def sec_main(ctx, referenced_param) -> float:
    # Use referenced_param variable...

@indicator('Referenced param example')
@param.int('referenced_param', default=50)
def main(ctx, referenced_param):
    calc_on_result = ctx.calc_on(time_frame=tf('1D'), ctx_func=sec_main)
    return calc_on_result[0]
  • SEE ALSO

@indicator() param

 



@plot()

decorator

Declares attributes of a plot of an indicator. Could be applied only to the main() function of the indicator. It is optional, so may be omitted in some simple use cases and plot will be rendered using defaults. When applied, it must match with the result of the main() indicator function.
 

  • SIGNATURES
@plot(
  id: indie.Optional[str] = None,
  title: indie.Optional[str] = None,
  color: indie.Optional[indie.Color] = None,
  style: int = indie.plot_style.LINE,
  line_style: indie.Optional[int] = None,
  line_width: indie.Optional[int] = None,
  continuous: indie.Optional[bool] = None,
  base_value: indie.Optional[float] = None,
  rel_width: indie.Optional[float] = None,
  display_options: indie.PlotDisplayOptions = 
    indie.PlotDisplayOptions(pane=True, status_line=True, price_label=True)
) -> NoneType
  • PARAMETERS

    • id — A unique identifier of plot which is used in cases when a @fill() should be applied between some of the two plots of an indicator.

    • title — Human readable title which is visible in the indicator's Settings panel.

    • color — Color of the plot on a chart. This color could be overwritten if the plot is a multicolored one. Example of an indicator with a multicolored plot is Awesome Oscillator (AO).

    • style — Determines how the plot data is rendered. It is represented as enum value of type plot_style.

    • line_style — Style of the line. Could be only used in combination with plot_style.LINE. It is represented as enum value of type line_style.

    • line_width — Width of the line. Could be only used in combination with plot_style.LINE, plot_style.STEPS or plot_style.HISTOGRAM.

    • continuous — Whether the plot should be continuous when the indicator has NaN values. Could be only used in combination with plot_style.LINE.

    • base_value — Base value. Could be only used in combination with plot_style.HISTOGRAM or plot_style.COLUMNS.

    • rel_width — Relative width. Could be only used in combination with plot_style.COLUMNS.

    • display_options — Determines the ways to display plot data.

  • EXAMPLE

@plot()
@plot()
@plot(style=plot_style.HISTOGRAM)
# @plot() - for the fourth plot could be omitted
def main(ctx):
    return ctx.open[0], ctx.high[0], ctx.low[0], ctx.close[0]
  • SEE ALSO

@fill() Plot

 


Functions

 


Color.__call__()

method

Applies transparency to the color.
 

  • SIGNATURES
__call__(alpha: float) -> indie.Color
  • PARAMETERS

    • alpha — Transparency of color. 1.0 corresponds to opaque.
  • SEE ALSO

color Color

 



Context.calc_on()

method

Requests additional instrument (creates a context object for it) for indicator and returns one or more Series objects which matches with the arity of values ctx_func function returns. All the returned series values are merged with (onto) the timescale of current context's instrument.
 

  • SIGNATURES
calc_on(
  ctx_func: typing.Any = None,
  exchange: indie.Optional[str] = None,
  ticker: indie.Optional[str] = None,
  time_frame: indie.Optional[indie.TimeFrame] = None,
  lookahead: bool = False
) -> typing.Any
  • PARAMETERS

    • ctx_func — Function decorated with @ctx_func(). This function has the same semantics as Indie main(), but for additional instrument (not the main one).

    • exchange — Alias of exchange of additional instrument. If omitted, then the exchange of the current context's instrument will be used.

    • ticker — Ticker of an additional instrument. If omitted, then the ticker of the current context's instrument will be used.

    • time_frame — Time frame of additional instrument. If omitted, then the time frame of current context's instrument will be used. At the moment it is allowed to request only time frames which are higher or equal to the time frame of current context's instrument.

    • lookahead — If this flag is true, then when calculating history, the bars of the secondary context are merged with the bars of the current context based on their opening time. Such a data merge strategy may result in unintended use of data from future history.

  • REMARKS

At least one of optional arguments (exchange, ticker and time_frame) must be provided. More info about this function as well as code examples you may find in Request additional instruments chapter.

  • SEE ALSO

@ctx_func() Context

 



Fill.__init__()

method

Class constructor (initializer for the data type).
 

  • SIGNATURES
__init__(
  offset: int = 0,
  color: indie.Optional[indie.Color] = None
) -> indie.Fill
  • PARAMETERS

    • offset — Offset (in bars) of the fill during its rendering.

    • color — Color to overwrite the default one (that was set in a @fill() decorator).

  • SEE ALSO

Fill

 



IndieError.__init__()

method

Class constructor (initializer for the data type).
 

  • SIGNATURES
__init__(msg: str) -> indie.IndieError
  • PARAMETERS

    • msg — Error message.
  • SEE ALSO

IndieError

 



MutSeries.__getitem__()

method

Gets value of MutSeries object at the specified index.
 

  • SIGNATURES
__getitem__(int) -> float
  • PARAMETERS

    • <unnamed param> — Index to extract value at.
  • SEE ALSO

mut_series() MutSeries

 



MutSeries.__len__()

method

Gets len of MutSeries object.
 

  • SIGNATURES
__len__() -> int
  • SEE ALSO

MutSeries

 



MutSeries.__setitem__()

method

Sets value of MutSeries object at the specified index.
 

  • SIGNATURES
__setitem__(int, float) -> NoneType
  • PARAMETERS

    • <unnamed param> — Index to extract value at.

    • <unnamed param> — New value.

  • SEE ALSO

mut_series() MutSeries

 



MutSeries.get()

method

Tries to get value of MutSeries object at the specified index.
 

  • SIGNATURES
get(offset: int, default: float) -> float
  • PARAMETERS

    • offset — Index to extract value at.

    • default — Default value that will be used if an element at the specified index cannot be extracted.

  • SEE ALSO

mut_series() MutSeries

 



MutSeries.request_size()

method

Expands the number of elements that MutSeries object should persist in memory.
 

  • SIGNATURES
request_size(size: int) -> NoneType
  • PARAMETERS

    • size — Number of elements that Series object should persist in memory. Default and possible minimum size is 2, which means that series of size = 2 persists in memory value at the time of the last candle and value at the time of previous candle. Size is automatically expanded during history calculation of an indicator.
  • SEE ALSO

mut_series() MutSeries

 



Optional[T].value()

method

Tries to get value of Optional object.
 

  • SIGNATURES
value() -> T
  • SEE ALSO

Optional

 



Optional[T].value_or()

method

Tries to get value of Optional object and returns the value of default if there is no value.
 

  • SIGNATURES
value_or(default: T) -> T
  • PARAMETERS

    • default — Default value that will be used if there is no value.
  • SEE ALSO

Optional

 



Plot.__init__()

method

Class constructor (initializer for the data type).
 

  • SIGNATURES
__init__(
  value: float,
  offset: int = 0,
  color: indie.Optional[indie.Color] = None
) -> indie.Plot
  • PARAMETERS

    • value — Value that will be used as the current value of the plot.

    • offset — Offset (in bars) of the plot during its rendering.

    • color — Color to overwrite the default one (that was set in a @plot() decorator).

  • SEE ALSO

Plot

 



PlotDisplayOptions.__init__()

method

Class constructor (initializer for the data type).
 

  • SIGNATURES
__init__(
  pane: bool = False,
  status_line: bool = False,
  price_label: bool = False
) -> indie.PlotDisplayOptions
  • PARAMETERS

    • pane — Whether or not to draw (by default) the plot on the pane.

    • status_line — Whether or not to show the value of the plot in the status line.

    • price_label — Whether or not to show the value label of the plot on the price axis.

  • SEE ALSO

PlotDisplayOptions

 



Series.__getitem__()

method

Gets value of Series object at the specified index.
 

  • SIGNATURES
__getitem__(int) -> float
  • PARAMETERS

    • <unnamed param> — Index to extract value at.
  • SEE ALSO

Context Series

 



Series.__len__()

method

Gets len of Series object.
 

  • SIGNATURES
__len__() -> int
  • SEE ALSO

Series

 



Series.__setitem__()

method

Sets value of Series object at the specified index.
 

  • SIGNATURES
__setitem__(int, float) -> NoneType
  • PARAMETERS

    • <unnamed param> — Index to extract value at.

    • <unnamed param> — New value.

  • SEE ALSO

Context Series

 



Series.get()

method

Tries to get value of Series object at the specified index.
 

  • SIGNATURES
get(offset: int, default: float) -> float
  • PARAMETERS

    • offset — Index to extract value at.

    • default — Default value that will be used if an element at the specified index cannot be extracted.

  • SEE ALSO

Context Series

 



Series.request_size()

method

Expands the number of elements that Series object should persist in memory.
 

  • SIGNATURES
request_size(size: int) -> NoneType
  • PARAMETERS

    • size — Number of elements that Series object should persist in memory. Default and possible minimum size is 2, which means that series of size = 2 persists in memory value at the time of the last candle and value at the time of previous candle. Size is automatically expanded during history calculation of an indicator.
  • SEE ALSO

Context Series

 



TimeFrame.to_minutes()

method

Converts TimeFrame type to number of minutes. Month is considered as 30 days always, and year is 365 days.
 

  • SIGNATURES
to_minutes() -> int
  • SEE ALSO

TimeFrame tf()

 



mut_series()

function

Creates MutSeries objects which are containers for calculated values in Indie code. The main feature of MutSeries container is ability to store (or "remember") historical values of some variable, those values could be later accessed with the square brackets operator.
 

  • SIGNATURES
mut_series(
  reset: indie.Optional[float] = None,
  init: indie.Optional[float] = None,
  size: indie.Optional[int] = None,
  default: indie.Optional[float] = None
) -> indie.MutSeries
  • PARAMETERS

    • reset — Value that is written into the most recent element of the Series every time mut_series() function is executed.

    • init — Value that is written into the most recent element of the Series object only once after the Series object was created. Or, in other words, it is a value that is written only at the time of the first mut_series() function call.

    • size — Number of elements that Series object should persist in memory. Default and possible minimum size is 2, which means that series of size = 2 persists in memory value at the time of the last candle and value at the time of previous candle. Size is automatically expanded during history calculation of an indicator. Series objects also have a method request_size(new_size: int) which can be used to expand the size explicitly.

    • default — Value that is returned in certain cases when offset is out of bounds of Series object. The certain cases here are only those which happen before all the internal buffers are trimmed (this usually happens right after calculation of history).

  • EXAMPLE

# this:
s1 = mut_series(reset_val)
s2 = mut_series(init=init_val)

# is the same as:
s1 = mut_series()
s1[0] = reset_val
s2 = mut_series()
if ctx.bar_index == 0:
    s2[0] = init_val
  • REMARKS

At the moment this function only supports float type as MutSeries element.

  • SEE ALSO

mut_series() MutSeries Context

 



series()

function

Creates MutSeries objects which are containers for calculated values in Indie code. The main feature of MutSeries container is ability to store (or "remember") historical values of some variable, those values could be later accessed with the square brackets operator.
 

  • SIGNATURES
series(
  reset: indie.Optional[float] = None,
  init: indie.Optional[float] = None,
  size: indie.Optional[int] = None,
  default: indie.Optional[float] = None
) -> indie.MutSeries
  • PARAMETERS

    • reset — Value that is written into the most recent element of the Series every time mut_series() function is executed.

    • init — Value that is written into the most recent element of the Series object only once after the Series object was created. Or, in other words, it is a value that is written only at the time of the first mut_series() function call.

    • size — Number of elements that Series object should persist in memory. Default and possible minimum size is 2, which means that series of size = 2 persists in memory value at the time of the last candle and value at the time of previous candle. Size is automatically expanded during history calculation of an indicator. Series objects also have a method request_size(new_size: int) which can be used to expand the size explicitly.

    • default — Value that is returned in certain cases when offset is out of bounds of Series object. The certain cases here are only those which happen before all the internal buffers are trimmed (this usually happens right after calculation of history).

  • EXAMPLE

# this:
s1 = series(reset_val)
s2 = series(init=init_val)

# is the same as:
s1 = series()
s1[0] = reset_val
s2 = series()
if ctx.bar_index == 0:
    s2[0] = init_val
  • REMARKS

Deprecated, use mut_series function instead. At the moment this function only supports float type as MutSeries element.

  • SEE ALSO

mut_series() MutSeries Context

 



tf()

function

Converts string representation of time frame to TimeFrame type.
 

  • SIGNATURES
tf(s: str = None) -> indie.TimeFrame
  • PARAMETERS

    • s — String representation of time frame.
  • SEE ALSO

TimeFrame @param.time_frame()

 


Objects

 


Context.bar_count

field

Current total number of bars. It is always true that ctx.bar_count is equal to ctx.bar_index + 1.
 

  • TYPE

int

  • SEE ALSO

Context

 



Context.bar_index

field

Index of a current bar. The very first bar has index equal to 0.0 and this is the oldest bar.
 

  • TYPE

int

  • SEE ALSO

Context

 



Context.close

field

Series of close prices of the context's instrument.
 

  • TYPE

Series

  • SEE ALSO

Context

 



Context.high

field

Series of high prices of the context's instrument.
 

  • TYPE

Series

  • SEE ALSO

Context

 



Context.hl2

field

Series of (high + low) / 2 values of the context's instrument.
 

  • TYPE

Series

  • SEE ALSO

Context

 



Context.hlc3

field

Series of (high + low + close) / 3 values of the context's instrument.
 

  • TYPE

Series

  • SEE ALSO

Context

 



Context.info

field

Information about the context's instrument.
 

  • TYPE

SymbolInfo

  • SEE ALSO

Context

 



Context.is_last_bar

field

Flag that is true if the current bar is the last bar in the history or it is a realtime bar.
 

  • TYPE

bool

  • SEE ALSO

Context

 



Context.is_last_history_bar

field

Flag that is true if the current bar is the last bar in the history.
 

  • TYPE

bool

  • SEE ALSO

Context

 



Context.is_realtime

field

Flag that is true if the current bar is a realtime bar.
 

  • TYPE

bool

  • SEE ALSO

Context

 



Context.low

field

Series of low prices of the context's instrument.
 

  • TYPE

Series

  • SEE ALSO

Context

 



Context.ohlc4

field

Series of (open + high + low + close) / 4 values of the context's instrument.
 

  • TYPE

Series

  • SEE ALSO

Context

 



Context.open

field

Series of open prices of the context's instrument.
 

  • TYPE

Series

  • SEE ALSO

Context

 



Context.time

field

Series of timestamps (in seconds) of the context's instrument. Every timestamp corresponds to start time of some bar on a chart.
 

  • TYPE

Series

  • SEE ALSO

Context

 



Context.time_frame

field

Time frame of the context's instrument.
 

  • TYPE

TimeFrame

  • SEE ALSO

Context

 



Context.volume

field

Series of volume values of the context's instrument.
 

  • TYPE

Series

  • SEE ALSO

Context

 



SymbolInfo.exchange_aliases

field

Commonly recognized (but not exactly standardized) alias of an exchange. For example, an alias of the New York Stock Exchange, Inc. is 'NYSE'. In most cases exchange alias matches with the exchange acronym (see ISO10383).
 

  • TYPE

list[str]

  • SEE ALSO

SymbolInfo

 



SymbolInfo.exchange_code

field

Exchange code of the context's instrument. For stocks it is a MIC. For crypto instruments it is just some identifier, not commonly recognized as MIC but unique within TakeProfit. For example, exchange_code for the New York Stock Exchange, Inc. is 'XNYS'.
 

  • TYPE

str

  • SEE ALSO

SymbolInfo

 



SymbolInfo.marketdata_timezone

field

Name of the exchange timezone of the context's instrument. For example, 'America/New_York'.
 

  • TYPE

str

  • SEE ALSO

SymbolInfo

 



SymbolInfo.price_precision

field

Price precision of the context's instrument. For example, price precision of 100 means that prices have two digits after the floating point.
 

  • TYPE

int

  • SEE ALSO

SymbolInfo

 



SymbolInfo.tick_size

field

Absolute value of a minimal movement of a price of the context's instrument in corresponding currency.
 

  • TYPE

float

  • SEE ALSO

SymbolInfo

 



SymbolInfo.ticker

field

Ticker of the context's instrument.
 

  • TYPE

str

  • SEE ALSO

SymbolInfo

 



format.INHERITED

static field

Indicator output values are formatted same as values of the main chart instrument.
 

  • TYPE

int

  • SEE ALSO

format

 



format.PRICE

static field

Indicator output values are formatted using fixed number of digits after the floating point. The number of digits is set with additional parameter precision of @indicator(). The precision param has effect only in combination with the format.PRICE format.
 

  • TYPE

int

  • SEE ALSO

format

 



format.VOLUME

static field

Indicator output values are formatted according to the rules of formatting large numbers, such as volumes of trades. For example 100500.0 will be formatted as 100.5K.
 

  • TYPE

int

  • SEE ALSO

format

 



line_style.DASHED

static field

Builtin line style that determines how the line is rendered.
 

  • TYPE

int

  • SEE ALSO

line_style

 



line_style.DOTTED

static field

Builtin line style that determines how the line is rendered.
 

  • TYPE

int

  • SEE ALSO

line_style

 



line_style.SOLID

static field

Builtin line style that determines how the line is rendered.
 

  • TYPE

int

  • SEE ALSO

line_style

 



plot_style.COLUMNS

static field

Builtin plot style that determines how the plot data is rendered.
 

  • TYPE

int

  • SEE ALSO

plot_style

 



plot_style.HISTOGRAM

static field

Builtin plot style that determines how the plot data is rendered.
 

  • TYPE

int

  • SEE ALSO

plot_style

 



plot_style.LINE

static field

Builtin plot style that determines how the plot data is rendered.
 

  • TYPE

int

  • SEE ALSO

plot_style

 



plot_style.STEPS

static field

Builtin plot style that determines how the plot data is rendered.
 

  • TYPE

int

  • SEE ALSO

plot_style

 



source.CLOSE

static field

Builtin series got from ctx used to initialize source input parameter.
 

  • TYPE

int

  • SEE ALSO

source

 



source.HIGH

static field

Builtin series got from ctx used to initialize source input parameter.
 

  • TYPE

int

  • SEE ALSO

source

 



source.HL2

static field

Builtin series got from ctx used to initialize source input parameter.
 

  • TYPE

int

  • SEE ALSO

source

 



source.HLC3

static field

Builtin series got from ctx used to initialize source input parameter.
 

  • TYPE

int

  • SEE ALSO

source

 



source.LOW

static field

Builtin series got from ctx used to initialize source input parameter.
 

  • TYPE

int

  • SEE ALSO

source

 



source.OHLC4

static field

Builtin series got from ctx used to initialize source input parameter.
 

  • TYPE

int

  • SEE ALSO

source

 



source.OPEN

static field

Builtin series got from ctx used to initialize source input parameter.
 

  • TYPE

int

  • SEE ALSO

source

 



source.VOLUME

static field

Builtin series got from ctx used to initialize source input parameter.
 

  • TYPE

int

  • SEE ALSO

source

 



Package indie.algorithm

Algorithms package of indie language.
 

  • CONTENTS

adx() atr() bb() cci() change() cum_sum() dev() donchian() ema() fix_nan() highest() lowest() ma() median() mfv() nan_to_zero() net_volume() percent_rank() rma() roc() rsi() since_highest() since_lowest() sma() std_dev() stoch() sum() supertrend() tr() tsi() vwap() vwma() wma()

 


Functions

 


adx()

function

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

  • SIGNATURES
adx(
  ctx: indie.Context,
  adx_len: int,
  di_len: int
) -> tuple[indie.MutSeries, indie.MutSeries, indie.MutSeries]
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • adx_len — Number of bars to calculate smoothing.

    • di_len — Number of bars to calculate directional indicator.

  • SOURCE CODE

from math import nan, isclose
from indie import func, MutSeries, mut_series, Context
from indie.algorithm import change, rma, tr, fix_nan


@func
def adx(ctx: Context, adx_len: int, di_len: int) -> tuple[MutSeries, MutSeries, MutSeries]:
    '''Average Directional Index'''
    up = change(ctx.high)[0]
    down = -change(ctx.low)[0]
    plus_dm = mut_series(0 if up <= down or up <= 0 else up)
    minus_dm = mut_series(0 if down <= up or down <= 0 else down)
    truerange = rma(tr(ctx), di_len)

    plus = mut_series(init=nan)
    minus = mut_series(init=nan)
    if not isclose(truerange[0], 0):
        plus[0] = 100 * rma(plus_dm, di_len)[0] / truerange[0]
        minus[0] = 100 * rma(minus_dm, di_len)[0] / truerange[0]
    plus = fix_nan(plus)
    minus = fix_nan(minus)

    sum = plus[0] + minus[0]
    res = 100 * rma(mut_series(abs(plus[0] - minus[0]) / (sum if sum != 0 else 1)), adx_len)[0]
    return minus, mut_series(res), plus

 



atr()

function

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

  • SIGNATURES
atr(
  ctx: indie.Context,
  length: int,
  ma_algorithm: str = "RMA"
) -> indie.MutSeries
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • length — Number of bars in calculation taken into account.

    • ma_algorithm — Moving average algorithm name, should be one of 'EMA', 'SMA', 'SMMA (RMA)', 'RMA', 'VWMA' or 'WMA'.

  • SOURCE CODE

from indie import func, MutSeries, Context
from indie.algorithm import tr, ma


@func
def atr(ctx: Context, length: int, ma_algorithm: str = 'RMA') -> MutSeries:
    '''Average True Range'''
    return ma(ctx, tr(ctx, True), length, ma_algorithm)

 



bb()

function

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

  • SIGNATURES
bb(
  src: indie.Series,
  length: int,
  mult: float
) -> tuple[indie.MutSeries, indie.MutSeries, indie.MutSeries]
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

    • mult — Multiplier for standard deviation.

  • SOURCE CODE

from indie import func, Series, MutSeries, mut_series
from indie.algorithm import sma, std_dev


@func
def bb(src: Series, length: int, mult: float) -> tuple[MutSeries, MutSeries, MutSeries]:
    '''Bollinger Bands'''
    middle = sma(src, length)[0]
    dev = mult * std_dev(src, length)[0]
    lower = middle - dev
    upper = middle + dev
    return mut_series(lower), mut_series(middle), mut_series(upper)

 



cci()

function

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

  • SIGNATURES
cci(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from math import nan, isclose
from indie import func, Series, MutSeries, mut_series
from indie.algorithm import sma, dev


@func
def cci(src: Series, length: int) -> MutSeries:
    '''Commodity Channel Index'''
    ma = sma(src, length)
    dv = dev(src, length)[0]
    res = nan
    if not isclose(dv, 0):
        res = (src[0] - ma[0]) / (0.015 * dv)
    return mut_series(res)

 



change()

function

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

  • SIGNATURES
change(src: indie.Series, length: int = 1) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars ago to compare the current value.

  • SOURCE CODE

from indie import func, Series, MutSeries, mut_series


@func
def change(src: Series, length: int = 1) -> MutSeries:
    return mut_series(src[0] - src[length])

 



cum_sum()

function

Returns series of cumulative sum of src values.
 

  • SIGNATURES
cum_sum(src: indie.Series) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SOURCE CODE

from indie import func, Series, MutSeries, mut_series


@func
def cum_sum(src: Series) -> MutSeries:
    res = mut_series(init=0)
    res[0] += src[0]
    return mut_series(res[0])

 



dev()

function

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

  • SIGNATURES
dev(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from indie import func, Series, MutSeries, mut_series
from indie.algorithm import sma


@func
def dev(src: Series, length: int) -> MutSeries:
    '''Mean Absolute Deviation'''
    mean = sma(src, length)[0]
    sum = 0.0
    for i in range(length):
        sum += abs(src[i] - mean)
    return mut_series(sum / length)

 



donchian()

function

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

  • SIGNATURES
donchian(ctx: indie.Context, length: int) -> indie.MutSeries
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from indie import func, MutSeries, mut_series, Context
from indie.algorithm import lowest, highest


@func
def donchian(ctx: Context, length: int) -> MutSeries:
    return mut_series((lowest(length, ctx.low)[0] + highest(length, ctx.high)[0]) / 2)

 



ema()

function

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

  • SIGNATURES
ema(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from math import isnan, nan
from indie import func, Series, MutSeries, mut_series
from indie.algorithm import sma


@func
def ema(src: Series, length: int) -> MutSeries:
    '''Exponential Moving Average'''
    alpha = 2 / (length + 1)
    s = mut_series(init=0)
    res_sma = sma(src, length)[0]
    result = 0.0
    if isnan(src[0]):
        s[0] = nan
        result = res_sma
    elif isnan(s[1]):
        s[0] = res_sma
        result = s[0]
    else:
        s[0] = alpha * src[0] + (1 - alpha) * s[1]
        result = s[0]
    return mut_series(result)

 



fix_nan()

function

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

  • SIGNATURES
fix_nan(src: indie.Series) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SOURCE CODE

from math import isnan
from indie import func, Series, MutSeries, mut_series


@func
def fix_nan(src: Series) -> MutSeries:
    res = mut_series(init=src[0])
    if not isnan(src[0]):
        res[0] = src[0]
    return mut_series(res[0])

 



highest()

function

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

  • SIGNATURES
highest(length: int, src: indie.Series) -> indie.MutSeries
  • PARAMETERS

    • length — Number of bars in calculation taken into account.

    • src — Series data to perform the calculation.

  • SOURCE CODE

from indie import func, Series, MutSeries, mut_series


@func
def highest(length: int, src: Series) -> MutSeries:
    src.request_size(length)
    result = src[0]
    for i in range(1, length):
        result = max(src[i], result)
    return mut_series(result)

 



lowest()

function

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

  • SIGNATURES
lowest(length: int, src: indie.Series) -> indie.MutSeries
  • PARAMETERS

    • length — Number of bars in calculation taken into account.

    • src — Series data to perform the calculation.

  • SOURCE CODE

from indie import func, Series, MutSeries, mut_series


@func
def lowest(length: int, src: Series) -> MutSeries:
    src.request_size(length)
    result = src[0]
    for i in range(1, length):
        result = min(src[i], result)
    return mut_series(result)

 



ma()

function

Returns a moving average of src specified by algorithm argument.
 

  • SIGNATURES
ma(
  ctx: indie.Context,
  src: indie.Series,
  length: int,
  algorithm: str
) -> indie.MutSeries
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

    • algorithm — Moving average algorithm name, should be one of 'EMA', 'SMA', 'SMMA (RMA)', 'RMA', 'VWMA' or 'WMA'.

  • SOURCE CODE

from indie import func, Series, MutSeries, Optional, IndieError, Context
from indie.algorithm import ema, sma, rma, vwma, wma


@func
def ma(ctx: Context, src: Series, length: int, algorithm: str) -> MutSeries:
    '''Moving Average'''
    result: Optional[MutSeries]
    if algorithm == 'EMA':
        result = ema(src, length)
    elif algorithm == 'SMA':
        result = sma(src, length)
    elif algorithm == 'SMMA (RMA)' or algorithm == 'RMA':
        result = rma(src, length)
    elif algorithm == 'VWMA':
        result = vwma(ctx, src, length)
    elif algorithm == 'WMA':
        result = wma(src, length)
    else:
        raise IndieError("moving average algorithm should be one of 'EMA', 'SMA', "
                         "'SMMA (RMA)', 'RMA', 'VWMA' or 'WMA' but it is " + algorithm)
    return result.value()

 



median()

function

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

  • SIGNATURES
median(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • REMARKS

Indie implementation is currently unavailable.

 



mfv()

function

Returns series of Money Flow Volume.
 

  • SIGNATURES
mfv(ctx: indie.Context) -> indie.MutSeries
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.
  • SOURCE CODE

from math import isclose
from indie import func, MutSeries, Context, mut_series


@func
def mfv(ctx: Context) -> MutSeries:
    '''Money Flow Volume'''
    h = ctx.high[0]
    l = ctx.low[0]
    c = ctx.close[0]
    v = ctx.volume[0]

    res = 0.0
    if not isclose(h - l, 0):
        res = ((c - l) - (h - c)) / (h - l) * v
    return mut_series(res)

 



nan_to_zero()

function

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

  • SIGNATURES
nan_to_zero(src: indie.Series) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SOURCE CODE

from math import isnan
from indie import func, Series, MutSeries, mut_series


@func
def nan_to_zero(src: Series) -> MutSeries:
    res = 0 if isnan(src[0]) else src[0]
    return mut_series(res)

 



net_volume()

function

Returns series of Net Volume values calculated on src series.
 

  • SIGNATURES
net_volume(ctx: indie.Context, src: indie.Series) -> indie.MutSeries
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • src — Series data to perform the calculation.

  • SOURCE CODE

from math import nan
from indie import func, Series, MutSeries, mut_series, Context
from indie.algorithm import change


@func
def net_volume(ctx: Context, src: Series) -> MutSeries:
    der = change(src)[0]
    nv = mut_series(init=nan)
    if der > 0:
        nv[0] = ctx.volume[0]
    elif der < 0:
        nv[0] = -ctx.volume[0]
    elif der == 0:
        nv[0] = 0
    return mut_series(nv[0])

 



percent_rank()

function

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.
 

  • SIGNATURES
percent_rank(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from indie import func, Series, MutSeries, mut_series


@func
def percent_rank(src: Series, length: int) -> MutSeries:
    num_leq = 0
    for idx in range(1, length + 1):
        if src[idx] <= src[0]:
            num_leq += 1
    return mut_series(100.0 * num_leq / length)

 



rma()

function

Returns a Moving Average that is used in calculations of rsi().
 

  • SIGNATURES
rma(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from math import isnan
from indie import func, Series, MutSeries, mut_series
from indie.algorithm import sma


@func
def rma(src: Series, length: int) -> MutSeries:
    '''RSI Moving Average'''
    result = mut_series(init=0)
    if isnan(result[1]):
        result[0] = sma(src, length)[0]
    else:
        result[0] = (src[0] + (length - 1) * result[1]) / length

    return mut_series(result[0])

 



roc()

function

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

  • SIGNATURES
roc(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from math import nan, isclose
from indie import func, Series, MutSeries, mut_series
from indie.algorithm import change


@func
def roc(src: Series, length: int) -> MutSeries:
    '''Rate Of Change'''
    res = nan
    if not isclose(src[length], 0):
        res = 100 * change(src, length)[0] / src[length]
    return mut_series(res)

 



rsi()

function

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

  • SIGNATURES
rsi(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from math import isclose
from indie import func, Series, MutSeries, mut_series
from indie.algorithm import nan_to_zero, change, rma


@func
def rsi(src: Series, length: int) -> MutSeries:
    '''Relative Strength Index'''
    u = max(nan_to_zero(change(src))[0], 0)  # upward change
    rma_u = rma(mut_series(u), length)

    d = max(-nan_to_zero(change(src))[0], 0)  # downward change
    rma_d = rma(mut_series(d), length)

    res = 100.0
    if not isclose(rma_d[0], 0):
        rs = rma_u[0] / rma_d[0]
        res = 100 - 100 / (1 + rs)
    return mut_series(res)

 



since_highest()

function

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

  • SIGNATURES
since_highest(ctx: indie.Context, length: int) -> indie.MutSeries
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from indie import func, MutSeries, Context, mut_series


@func
def since_highest(ctx: Context, length: int) -> MutSeries:
    offset = 0
    for idx in range(length):
        if ctx.high[idx] >= ctx.high[offset]:
            offset = idx
    return mut_series(offset)

 



since_lowest()

function

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

  • SIGNATURES
since_lowest(ctx: indie.Context, length: int) -> indie.MutSeries
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from indie import func, MutSeries, Context, mut_series


@func
def since_lowest(ctx: Context, length: int) -> MutSeries:
    offset = 0
    for idx in range(length):
        if ctx.low[idx] <= ctx.low[offset]:
            offset = idx
    return mut_series(offset)

 



sma()

function

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

  • SIGNATURES
sma(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from indie import func, Series, MutSeries, mut_series
from indie.algorithm import sum


@func
def sma(src: Series, length: int) -> MutSeries:
    '''Simple Moving Average'''
    s = sum(src, length)
    return mut_series(s[0] / length)

 



std_dev()

function

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

  • SIGNATURES
std_dev(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from math import sqrt
from indie import func, Series, MutSeries, mut_series
from indie.algorithm import sma


@func
def std_dev(src: Series, length: int) -> MutSeries:
    avg = sma(src, length)
    sum_of_square_deviations = 0.0
    for i in range(length):
        dev = src[i] - avg[0]
        sum_of_square_deviations += dev * dev

    return mut_series(sqrt(sum_of_square_deviations / length))

 



stoch()

function

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

  • SIGNATURES
stoch(
  src: indie.Series,
  low: indie.Series,
  high: indie.Series,
  length: int
) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • low — Series of low values.

    • high — Series of high values.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from math import isclose
from indie import func, Series, MutSeries, mut_series
from indie.algorithm import lowest, highest


@func
def stoch(src: Series, low: Series, high: Series, length: int) -> MutSeries:
    lowest_low = lowest(length, low)[0]
    highest_high = highest(length, high)[0]

    res = 100.0
    if not isclose(highest_high - lowest_low, 0):
        res = 100 * (src[0] - lowest_low) / (highest_high - lowest_low)
    return mut_series(res)

 



sum()

function

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

  • SIGNATURES
sum(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from math import isnan, nan
from indie import func, Series, MutSeries, mut_series


@func
def sum(src: Series, length: int) -> MutSeries:
    src.request_size(length + 1)
    nan_count = mut_series(init=0)
    s = mut_series(init=0)
    s[0] += src.get(0, 0)

    result = 0.0
    if isnan(src[0]):
        nan_count[0] += 1
        result = nan
    else:
        if len(src) - nan_count[0] > length:
            s[0] -= src[length]
        if len(src) - nan_count[0] < length:
            result = nan
        else:
            result = s[0]
    return mut_series(result)

 



supertrend()

function

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

  • SIGNATURES
supertrend(
  ctx: indie.Context,
  factor: float,
  atr_period: int,
  ma_algorithm: str
) -> tuple[indie.MutSeries, indie.MutSeries]
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • factor — The multiplier by which the ATR will get multiplied.

    • atr_period — Number of bars to calculate ATR.

    • ma_algorithm — Moving average algorithm name, should be one of 'EMA', 'SMA', 'SMMA (RMA)', 'RMA', 'VWMA' or 'WMA'.

  • SOURCE CODE

from math import isnan
from indie import func, MutSeries, Context, mut_series
from indie.algorithm import atr as atr_alg


@func
def supertrend(ctx: Context, factor: float, atr_period: int, ma_algorithm: str) -> tuple[MutSeries, MutSeries]:
    src = ctx.hl2
    atr = atr_alg(ctx, atr_period, ma_algorithm)
    upper_band = mut_series(src[0] + factor * atr[0])
    lower_band = mut_series(src[0] - factor * atr[0])
    prev_lower_band = lower_band.get(1, 0)
    prev_upper_band = upper_band.get(1, 0)
    lower_band[0] = lower_band[0] \
                    if lower_band[0] > prev_lower_band or ctx.close[1] < prev_lower_band \
                    else prev_lower_band
    upper_band[0] = upper_band[0] \
                    if upper_band[0] < prev_upper_band or ctx.close[1] > prev_upper_band \
                    else prev_upper_band
    direction: float
    super_trend = mut_series(init=0)
    prev_super_trend = super_trend[1]
    if isnan(atr[1]):
        direction = 1.0
    elif prev_super_trend == prev_upper_band:
        direction = -1.0 if ctx.close[0] > upper_band[0] else 1.0
    else:
        direction = 1.0 if ctx.close[0] < lower_band[0] else -1.0
    super_trend[0] = lower_band[0] if direction < 0 else upper_band[0]
    return mut_series(super_trend[0]), mut_series(direction)

 



tr()

function

Returns series of True Range values.
 

  • SIGNATURES
tr(ctx: indie.Context, handle_na: bool = False) -> indie.MutSeries
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • handle_na — Flag that says how NaN close values of the previous day are handled.

  • SOURCE CODE

from math import nan, isnan
from indie import func, MutSeries, mut_series, Context


@func
def tr(ctx: Context, handle_na: bool = False) -> MutSeries:
    '''True Range'''
    res = nan if handle_na else ctx.high[0] - ctx.low[0]
    if not isnan(ctx.close[1]):
        res = max(ctx.high[0] - ctx.low[0],
            abs(ctx.high[0] - ctx.close[1]),
            abs(ctx.low[0] - ctx.close[1]),
        )
    return mut_series(res)

 



tsi()

function

Returns series of True Strength Index values.
 

  • SIGNATURES
tsi(src: indie.Series, long_len: int, short_len: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • long_len — Long length.

    • short_len — Short length.

  • SOURCE CODE

from math import nan, isclose
from indie import func, Series, MutSeries, mut_series
from indie.algorithm import ema, change


@func
def double_smooth(src: Series, long_len: int, short_len: int) -> MutSeries:
    return ema(ema(src, long_len), short_len)


@func
def tsi(src: Series, long_len: int, short_len: int) -> MutSeries:
    '''True Strength Index'''
    pc = change(src)
    double_smoothed_pc = double_smooth(pc, long_len, short_len)[0]
    abs_pc = mut_series(abs(pc[0]))
    double_smoothed_abs_pc = double_smooth(abs_pc, long_len, short_len)[0]
    res = nan
    if not isclose(double_smoothed_abs_pc, 0):
        res = double_smoothed_pc / double_smoothed_abs_pc
    return mut_series(res)

 



vwap()

function

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

  • SIGNATURES
vwap(
  ctx: indie.Context,
  src: indie.Series,
  anchor: str,
  std_dev_mult: float
) -> tuple[indie.MutSeries, indie.MutSeries, indie.MutSeries]
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • src — Series data to perform the calculation.

    • anchor — At what points in time do we need to reset the accumulated amounts. Valid values are: 'day', 'week', 'month', 'year'.

    • std_dev_mult — Multiplier for standard deviation.

  • SOURCE CODE

from math import sqrt
from indie import func, Series, MutSeries, mut_series, Context
from datetime import datetime


@func
def vwap(
    ctx: Context, src: Series, anchor: str, std_dev_mult: float
) -> tuple[MutSeries, MutSeries, MutSeries]:
    '''
    Volume Weighted Average Price
    anchor can be 'day', 'week', 'month', 'year'
    '''
    cum_weighted_price = mut_series(init=0)
    cum_volume = mut_series(init=0)
    vwap_values = mut_series(init=0)
    vwap_sum = mut_series(init=0)
    vwap_count = mut_series(init=0)
    vwap_avg = mut_series(init=0)
    vwap_dev_squares = mut_series(init=0)
    vwap_std_dev = mut_series(init=0)

    current_datetime = datetime.utcfromtimestamp(float(ctx.time[0])/1000.0)
    prev_datetime = datetime.utcfromtimestamp(float(ctx.time.get(1, 0))/1000.0)
    need_reset = False
    if anchor == "day" and (current_datetime.day != prev_datetime.day or
                            (current_datetime-prev_datetime).days >= 1):
        need_reset = True
    elif anchor == "week" and ((current_datetime.weekday() == 0 and prev_datetime.weekday() != 0) or
                               (current_datetime-prev_datetime).days >= 7):
        need_reset = True
    elif anchor == "month" and (current_datetime.month != prev_datetime.month or
                                (current_datetime-prev_datetime).days >= 31):
        need_reset = True
    elif anchor == "year" and current_datetime.year != prev_datetime.year:
        need_reset = True

    if need_reset:
        cum_weighted_price[0] = 0.0
        cum_volume[0] = 0.0
        vwap_sum[0] = 0.0
        vwap_count[0] = 0
        vwap_dev_squares[0] = 0.0

    cum_weighted_price[0] += src[0] * ctx.volume[0]
    cum_volume[0] += ctx.volume[0]
    vwap_values[0] = cum_weighted_price[0] / cum_volume[0]

    vwap_sum[0] += vwap_values[0]
    vwap_count[0] += 1
    vwap_avg[0] = vwap_sum[0] / vwap_count[0]
    vwap_dev_squares[0] += (vwap_values[0] - vwap_avg[0]) ** 2
    vwap_std_dev[0] = sqrt(vwap_dev_squares[0] / vwap_count[0])

    std_dev = std_dev_mult * vwap_std_dev[0]
    lower = mut_series(vwap_values[0] - std_dev)
    upper = mut_series(vwap_values[0] + std_dev)

    return vwap_values, upper, lower

 



vwma()

function

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

  • SIGNATURES
vwma(ctx: indie.Context, src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • ctx — Context object from main() or @ctx_func() function that represents an instrument with OHLCV series values.

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from math import nan, isclose
from indie import func, Series, MutSeries, mut_series, Context
from indie.algorithm import sma


@func
def vwma(ctx: Context, src: Series, length: int) -> MutSeries:
    '''Volume Weighted Moving Average'''
    src_vol = mut_series(src[0] * ctx.volume[0])
    sma_src_vol = sma(src_vol, length)
    sma_vol = sma(ctx.volume, length)
    res = nan
    if not isclose(sma_vol[0], 0):
        res = sma_src_vol[0] / sma_vol[0]
    return mut_series(res)

 



wma()

function

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

  • SIGNATURES
wma(src: indie.Series, length: int) -> indie.MutSeries
  • PARAMETERS

    • src — Series data to perform the calculation.

    • length — Number of bars in calculation taken into account.

  • SOURCE CODE

from indie import func, Series, MutSeries, mut_series


@func
def wma(src: Series, length: int) -> MutSeries:
    '''Weighted Moving Average'''
    norm = 0.0
    s = 0.0
    for i in range(length):
        weight = length - i
        norm += weight
        s += src[i] * weight
    return mut_series(s / norm)

 



Package indie.color

Class-container for builtin colors and rgba() function.
 

  • CONTENTS

AQUA BLACK BLUE FUCHSIA GRAY GREEN LIME MAROON NAVY OLIVE PURPLE RED rgba() SILVER TEAL WHITE YELLOW

  • SEE ALSO

Plot Fill Color

 


Functions

 


rgba()

function

Returns color by its RGB components and transparency.
 

  • SIGNATURES
rgba(red: int, green: int, blue: int, alpha: float = 1.0) -> indie.Color
  • PARAMETERS

    • red — Red component of color.

    • green — Green component of color.

    • blue — Blue component of color.

    • alpha — Transparency of color. 1.0 corresponds to opaque.

 


Objects

 


AQUA

object

Builtin color.
 

  • TYPE

Color

 



BLACK

object

Builtin color.
 

  • TYPE

Color

 



BLUE

object

Builtin color.
 

  • TYPE

Color

 



FUCHSIA

object

Builtin color.
 

  • TYPE

Color

 



GRAY

object

Builtin color.
 

  • TYPE

Color

 



GREEN

object

Builtin color.
 

  • TYPE

Color

 



LIME

object

Builtin color.
 

  • TYPE

Color

 



MAROON

object

Builtin color.
 

  • TYPE

Color

 



NAVY

object

Builtin color.
 

  • TYPE

Color

 



OLIVE

object

Builtin color.
 

  • TYPE

Color

 



PURPLE

object

Builtin color.
 

  • TYPE

Color

 



RED

object

Builtin color.
 

  • TYPE

Color

 



SILVER

object

Builtin color.
 

  • TYPE

Color

 



TEAL

object

Builtin color.
 

  • TYPE

Color

 



WHITE

object

Builtin color.
 

  • TYPE

Color

 



YELLOW

object

Builtin color.
 

  • TYPE

Color

 



Package math

Math package.
 

  • CONTENTS

acos() asin() atan() ceil() cos() e exp() exp2() floor() isclose() isnan() log() log10() log2() nan pi pow() sin() sqrt() tan()

  • REMARKS

See description in the official Python docs.

 


Functions

 


acos()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
acos(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



asin()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
asin(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



atan()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
atan(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



ceil()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
ceil(float) -> int
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



cos()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
cos(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



exp()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
exp(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



exp2()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
exp2(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



floor()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
floor(float) -> int
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



isclose()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
isclose(float, float, rel_tol: float = 1e-9, abs_tol: float = 0.0) -> bool
  • PARAMETERS

    • <unnamed param> — First value to check for proximity.

    • <unnamed param> — Second value to check for proximity.

    • rel_tol — Relative tolerance for proximity check.

    • abs_tol — Absolute tolerance for proximity check.

 



isnan()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
isnan(float) -> bool
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



log()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
log(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



log10()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
log10(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



log2()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
log2(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



pow()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
pow(float, float) -> float
  • PARAMETERS

    • <unnamed param> — Base value to calculate exponentiation.

    • <unnamed param> — Exponent (power) value to calculate exponentiation.

 



sin()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
sin(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



sqrt()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
sqrt(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



tan()

function

Standard function of Indie math package (similar to Python one).
 

  • SIGNATURES
tan(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 


Objects

 


e

object

Standard constant of Indie math package (similar to Python one).
 

  • TYPE

float

 



nan

object

Standard constant of Indie math package (similar to Python one).
 

  • TYPE

float

 



pi

object

Standard constant of Indie math package (similar to Python one).
 

  • TYPE

float

 



Package statistics

Statistics package.
 

  • CONTENTS

fmean() mean() median()

  • REMARKS

See description in the official Python docs.

 


Functions

 


fmean()

function

Standard statistics function.
 

  • SIGNATURES
fmean(data: list[float]) -> float
  • PARAMETERS

    • data — List on which the function will be calculated.

 



mean()

function

Standard statistics function.
 

  • SIGNATURES
mean(data: list[float]) -> float
mean(data: list[int]) -> float
  • PARAMETERS

    • data — List on which the function will be calculated.

 



median()

function

Standard statistics function.
 

  • SIGNATURES
median(data: list[float]) -> float
  • PARAMETERS

    • data — List on which the function will be calculated.

 



Package datetime

The datetime package supplies classes for manipulating dates and times.
 

  • CONTENTS

datetime timedelta

  • REMARKS

See description in the official Python docs.

 


Types

 


datetime

type

Represents date and time information.
 

  • MEMBERS

__add__() __init__() __sub__() day hour microsecond minute month second utcfromtimestamp() weekday() year

  • SEE ALSO

timedelta

 



timedelta

type

A timedelta object represents a duration, the difference between two dates or times.
 

  • MEMBERS

__init__() days microseconds seconds total_seconds()

  • SEE ALSO

datetime

 


Functions

 


datetime.__add__()

method

+ operator for datetime objects.
 

  • SIGNATURES
__add__(delta: datetime.timedelta) -> datetime.datetime
  • PARAMETERS

    • delta — Timedelta to add to the current datetime.
  • SEE ALSO

datetime

 



datetime.__init__()

method

Class constructor (initializer for the data type).
 

  • SIGNATURES
__init__(
  year: int,
  month: int,
  day: int,
  hour: int = 0,
  minute: int = 0,
  second: int = 0,
  microsecond: int = 0
) -> datetime.datetime
  • PARAMETERS

    • year — Year value.

    • month — Month value.

    • day — Day value.

    • hour — Hour value.

    • minute — Minute value.

    • second — Second value.

    • microsecond — Microsecond value.

  • SEE ALSO

datetime

 



datetime.__sub__()

method

- operator for datetime objects.
 

  • SIGNATURES
__sub__(delta: datetime.timedelta) -> datetime.datetime
__sub__(other: datetime.datetime) -> datetime.timedelta
  • PARAMETERS

    • delta — Timedelta to subtract from the current datetime.

    • other — Datetime to subtract from the current datetime.

  • SEE ALSO

datetime

 



datetime.utcfromtimestamp()

static method

Returns the UTC datetime corresponding to the POSIX timestamp.
 

  • SIGNATURES
utcfromtimestamp(timestamp: float) -> datetime.datetime
  • PARAMETERS

    • timestamp — Timestamp in UTC.
  • SEE ALSO

datetime

 



datetime.weekday()

method

Returns the day of the week as an integer, where Monday is 0 and Sunday is 6.
 

  • SIGNATURES
weekday() -> int
  • SEE ALSO

datetime

 



timedelta.__init__()

method

Class constructor (initializer for the data type).
 

  • SIGNATURES
__init__(
  days: int = 0,
  seconds: int = 0,
  microseconds: int = 0,
  milliseconds: int = 0,
  minutes: int = 0,
  hours: int = 0,
  weeks: int = 0
) -> datetime.timedelta
  • PARAMETERS

    • days — Number of days.

    • seconds — Number of seconds.

    • microseconds — Number of microseconds.

    • milliseconds — Number of milliseconds.

    • minutes — Number of minutes.

    • hours — Number of hours.

    • weeks — Number of weeks.

  • SEE ALSO

timedelta

 



timedelta.total_seconds()

method

Returns the total number of seconds contained in the duration.
 

  • SIGNATURES
total_seconds() -> float
  • SEE ALSO

timedelta

 


Objects

 


datetime.day

field

The day value of the datetime object.
 

  • TYPE

int

  • SEE ALSO

datetime

 



datetime.hour

field

The hour value of the datetime object.
 

  • TYPE

int

  • SEE ALSO

datetime

 



datetime.microsecond

field

The microsecond value of the datetime object.
 

  • TYPE

int

  • SEE ALSO

datetime

 



datetime.minute

field

The minute value of the datetime object.
 

  • TYPE

int

  • SEE ALSO

datetime

 



datetime.month

field

The month value of the datetime object.
 

  • TYPE

int

  • SEE ALSO

datetime

 



datetime.second

field

The second value of the datetime object.
 

  • TYPE

int

  • SEE ALSO

datetime

 



datetime.year

field

The year value of the datetime object.
 

  • TYPE

int

  • SEE ALSO

datetime

 



timedelta.days

field

The days value of the timedelta object.
 

  • TYPE

int

  • SEE ALSO

timedelta

 



timedelta.microseconds

field

The microseconds value of the timedelta object.
 

  • TYPE

int

  • SEE ALSO

timedelta

 



timedelta.seconds

field

The seconds value of the timedelta object.
 

  • TYPE

int

  • SEE ALSO

timedelta

 


Builtins

 

Types

 


NoneType

type

Builtin Indie type (similar to Python None type).
 

 



bool

type

Builtin Indie type (similar to Python one).
 

  • MEMBERS

__init__()

 



dict[K, V]

type

Builtin Indie type (similar to Python one).
 

 



float

type

Builtin Indie type (similar to Python one).
 

  • MEMBERS

__init__()

 



int

type

Builtin Indie type (similar to Python one).
 

  • MEMBERS

__init__()

 



list[T]

type

Builtin Indie type (similar to Python one).
 

  • MEMBERS

__getitem__() __init__() __len__() __setitem__() append() pop() remove()

  • EXAMPLE
# examples of list creation:
a = [1, 2, 3]  # `a` has type `list[int]`
b = [1, 2, 3, 4.2]  # `b` has type `list[float]`
c = ["a", "b", "c"]  # `c` has type `list[str]`
d = [(1, "a"), (2, "b"), (3, "c")]  # `d` has type `list[tuple[int, str]]`

e = [0, 1, 2, 3, 4, 5, 6, 7]
f = e[2:5]  # `f` is `[2, 3, 4]`
g = e[:5]  # `g` is `[0, 1, 2, 3, 4]`
h = e[2:]  # `h` is `[2, 3, 4, 5, 6, 7]`
i = e[:]  # `i` is a copy of `e`
j = e[1:7:2]  # `j` is `[1, 3, 5]`
k = e[5:2:-1]  # `k` is `[5, 4, 3]`
l = e[5::-1]  # `l` is `[5, 4, 3, 2, 1, 0]`
m = e[::-1]  # `m` is `[7, 6, 5, 4, 3, 2, 1, 0]`

 



str

type

Builtin Indie type (similar to Python one).
 

  • MEMBERS

__init__() __len__()

 



tuple[...]

type

Builtin Indie type (similar to Python one).
 

  • MEMBERS

__getitem__()

 


Functions

 


abs()

function

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
abs(int) -> int
abs(float) -> float
  • PARAMETERS

    • <unnamed param> — Number on which the function will be calculated.

 



bool.__init__()

method

Cast constructor for builtin Indie type.
 

  • SIGNATURES
__init__(bool) -> bool
__init__(int) -> bool
__init__(float) -> bool
__init__(str) -> bool
__init__(NoneType) -> bool
__init__(indie.Optional[bool]) -> bool
__init__(indie.Optional[int]) -> bool
__init__(indie.Optional[float]) -> bool
__init__(indie.Optional[str]) -> bool
  • PARAMETERS

    • <unnamed param> — Value to cast from.
  • SEE ALSO

bool

 



float.__init__()

method

Cast constructor for builtin Indie type.
 

  • SIGNATURES
__init__(float) -> float
__init__(int) -> float
__init__(str) -> float
__init__(bool) -> float
  • PARAMETERS

    • <unnamed param> — Value to cast from.
  • SEE ALSO

float

 



int.__init__()

method

Cast constructor for builtin Indie type.
 

  • SIGNATURES
__init__(int) -> int
__init__(float) -> int
__init__(str) -> int
__init__(bool) -> int
  • PARAMETERS

    • <unnamed param> — Value to cast from.
  • SEE ALSO

int

 



len()

function

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
len(list[float]) -> int
len(list[int]) -> int
len(list[str]) -> int
len(str) -> int
len(indie.Series) -> int
len(indie.MutSeries) -> int
  • PARAMETERS

    • <unnamed param> — List on which the function will be calculated.

    • <unnamed param> — String on which the function will be calculated.

    • <unnamed param> — Series on which the function will be calculated.

    • <unnamed param> — MutSeries on which the function will be calculated.

 



list[T].__getitem__()

method

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
__getitem__(int) -> T
__getitem__(slice) -> list[T]
  • PARAMETERS

    • <unnamed param> — Index of an element in the list.

    • <unnamed param> — Slice of elements in the list, similar to Python slices. Slices allow to specify a start and end index, as well as a step size, in the format [start:stop:step]. Any of the slice indices can be omitted. See more examples here.

  • SEE ALSO

list

 



list[T].__init__()

method

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
__init__(list[T]) -> list[T]
  • PARAMETERS

    • <unnamed param> — List of elements.
  • SEE ALSO

list

 



list[T].__len__()

method

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
__len__() -> int
  • SEE ALSO

list

 



list[T].__setitem__()

method

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
__setitem__(int, T) -> NoneType
  • PARAMETERS

    • <unnamed param> — Index of an element in the list.

    • <unnamed param> — New value that will be put to the list.

  • SEE ALSO

list

 



list[T].append()

method

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
append(T) -> NoneType
  • PARAMETERS

    • <unnamed param> — New value that will be put to the list.
  • SEE ALSO

list

 



list[T].pop()

method

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
pop(int) -> T
  • PARAMETERS

    • <unnamed param> — Index of an element in the list.
  • SEE ALSO

list

 



list[T].remove()

method

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
remove(T) -> NoneType
  • PARAMETERS

    • <unnamed param> — Value that will be removed from the list
  • SEE ALSO

list

 



max()

function

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
max(int, int) -> int
max(int, int, int) -> int
max(float, float) -> float
max(float, float, float) -> float
  • PARAMETERS

    • <unnamed param> — First number to calculate the function.

    • <unnamed param> — Second number to calculate the function.

    • <unnamed param> — Third number to calculate the function.

 



min()

function

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
min(int, int) -> int
min(int, int, int) -> int
min(float, float) -> float
min(float, float, float) -> float
  • PARAMETERS

    • <unnamed param> — First number to calculate the function.

    • <unnamed param> — Second number to calculate the function.

    • <unnamed param> — Third number to calculate the function.

 



range()

function

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
range(stop: int) -> list[int]
range(start: int, stop: int, step: int = 1) -> list[int]
  • PARAMETERS

    • stop — Last value of the range (exclusive).

    • start — First value of the range.

    • step — Step value of the range.

 



round()

function

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
round(number: float) -> int
round(number: float, ndigits: indie.Optional[int] = None) -> float
  • PARAMETERS

    • number — Number on which the function will be calculated.

    • ndigits — Rounding precision.

 



str.__init__()

method

Cast constructor for builtin Indie type.
 

  • SIGNATURES
__init__(int) -> str
__init__(float) -> str
__init__(str) -> str
__init__(bool) -> str
  • PARAMETERS

    • <unnamed param> — Value to cast from.
  • SEE ALSO

str

 



str.__len__()

method

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
__len__() -> int
  • SEE ALSO

str

 



sum()

function

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
sum(list[int], start: int = 0) -> int
sum(list[float], start: float = 0.0) -> float
  • PARAMETERS

    • <unnamed param> — List on which the function will be calculated.

    • start — Initial value to calculate sum of the list.

 



tuple[...].__getitem__()

method

Builtin Indie function (similar to Python one).
 

  • SIGNATURES
__getitem__(int) -> NoneType
  • PARAMETERS

    • <unnamed param> — Index of an element in the tuple.
  • SEE ALSO

tuple

 


Objects

 


False

object

Builtin Indie object (similar to Python one).
 

  • TYPE

bool

 



None

object

Builtin Indie object (similar to Python one).
 

  • TYPE

NoneType

 



True

object

Builtin Indie object (similar to Python one).
 

  • TYPE

bool