Library reference



icon: book

Package indie

Main package of Indie language.

  • CONTENTS

Algorithm @algorithm() algorithms @band() Color color Context @fill() Fill format @indicator() IndieError @level() line_style MainContext MutSeries MutSeriesF Optional param @param_ref() @plot() Plot plot_style schedule @sec_context() SecContext Series SeriesF source SymbolInfo tf() time_frame_unit TimeFrame TradingSession Var


Types


Algorithm

type

Base class for the classes that perform some processing of series data.

  • MEMBERS

__init__() ctx

  • SEE ALSO

MainContext SecContext


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.

  • MEMBERS

bar_count bar_index calc_on() close high hl2 hlc3 info is_closed_bar is_first_in_regular_session() is_first_in_session() is_history is_last_bar is_last_history_bar is_last_in_regular_session() is_last_in_session() is_new_bar is_realtime low new_mut_series() new_mut_series_f() new_var() ohlc4 open time time_frame trading_session volume

  • SEE ALSO

MainContext SecContext SymbolInfo Series[T]


Fill

type

Class that represents a fill object.

  • MEMBERS

__init__()

  • SEE ALSO

@fill() Plot


IndieError

type

Data type for Indie errors.

  • MEMBERS

__init__()


MainContext

type

Base class for the class that represents main context.

  • PARENTS

Context

  • MEMBERS

bar_count bar_index calc_on() close high hl2 hlc3 info is_closed_bar is_first_in_regular_session() is_first_in_session() is_history is_last_bar is_last_history_bar is_last_in_regular_session() is_last_in_session() is_new_bar is_realtime low new_mut_series() new_mut_series_f() new_var() ohlc4 open time time_frame trading_session volume

  • SEE ALSO

SecContext Algorithm


MutSeriesF

type

Data type that represents read-write series of float values like prices of some instrument. Type MutSeriesF is nothing but an alias for type MutSeries[float].

  • PARENTS

Series[float]

  • MEMBERS

__getitem__() __len__() __setitem__() calc() get() new() request_size()

  • SEE ALSO

Context.new_mut_series_f() Series[T] SeriesF MutSeries[T] Context


MutSeries[T]

type

Generic data type that represents read-write series of values of type T. Type T could be float, int, str, or almost any other type.

  • PARENTS

Series[T]

  • MEMBERS

__getitem__() __len__() __setitem__() calc() get() new() request_size()

  • SEE ALSO

Context.new_mut_series() Series[T] SeriesF MutSeriesF Context


Optional[T]

type

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

  • MEMBERS

__bool__() __isnone__() value() value_or()


Plot

type

Class that represents a plot object.

  • MEMBERS

__init__()

  • SEE ALSO

@plot() Fill


SecContext

type

Base class for the classes that represent additional contexts besides the main one.

  • PARENTS

Context

  • MEMBERS

bar_count bar_index calc_on() close high hl2 hlc3 info is_closed_bar is_first_in_regular_session() is_first_in_session() is_history is_last_bar is_last_history_bar is_last_in_regular_session() is_last_in_session() is_new_bar is_realtime low new_mut_series() new_mut_series_f() new_var() ohlc4 open time time_frame trading_session volume

  • SEE ALSO

MainContext Algorithm


SeriesF

type

Data type that represents read only series of float values like prices of some instrument. Type SeriesF is nothing but an alias for type Series[float].

  • MEMBERS

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

  • SEE ALSO

Series[T] MutSeries[T] MutSeriesF Context


Series[T]

type

Generic data type that represents read only series of values of type T. Type T could be float, int, str, or almost any other type.

  • MEMBERS

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

  • SEE ALSO

SeriesF MutSeries[T] MutSeriesF 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 timezone

  • SEE ALSO

Context


TimeFrame

type

Data type that represents time frame.

  • MEMBERS

__init__() from_str() to_minutes()

  • REMARKS

Use tf() to create TimeFrame instances.

  • SEE ALSO

TimeFrame.from_str()


TradingSession

type

Data type to represent different trading periods within a day, including pre-market, regular, and after-hours sessions. Each period is defined by its own schedule.

  • MEMBERS

__contains__() after_hours extended is_after_hours() is_extended() is_pre_market() is_regular() is_same_period() pre_market regular

  • SEE ALSO

Context Schedule ScheduleRule


Var[T]

type

Generic data type that represents a rollbackable container for value of type T. Type T could be float, int, str, or almost any other type.

  • MEMBERS

get() new() set()

  • SEE ALSO

Context.new_var() Series[T] Context


format

type

Enum-like class with constants that determine how to format the indicator value on the price scale.

  • MEMBERS

INHERITED PRICE VOLUME

  • SEE ALSO

@indicator()


line_style

type

Enum-like class with constants of line styles.

  • MEMBERS

DASHED DOTTED SOLID


param

type

Class with decorators of indicator input parameters of various types.

  • MEMBERS

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

  • SEE ALSO

@indicator()


plot_style

type

Enum-like class with constants of plot styles.

  • MEMBERS

COLUMNS HISTOGRAM LINE STEPS


source

type

Enum-like class with constants for various price sources (it is used in @indie.param.source).

  • MEMBERS

CLOSE HIGH HL2 HLC3 LOW OHLC4 OPEN VOLUME

  • SEE ALSO

@indicator()


time_frame_unit

type

Enum-like class with constants for time frame units.

  • MEMBERS

DAY HOUR MINUTE MONTH WEEK

  • SEE ALSO

TimeFrame.from_str()


Decorators


@algorithm()

decorator

Decorates a function, making it a series processor algorithm. Such algorithms are specifically designed to process series of data, like close prices of an instrument of a candle chart. One way of using such an algorithm is to call new static method, read more here.

  • SIGNATURES
@algorithm() -> NoneType
  • REMARKS

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

  • SEE ALSO

SeriesF Context Algorithm


@band()

decorator

Use this decorator to add a band (two horizontal lines usually with a semi-transparent fill in between them) to indicator.

  • 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: indie.line_style = 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(self):
    return self.close[0]
  • SEE ALSO

@indicator() @level()


@fill()

decorator

Declares attributes of a fill between some two plots of an indicator. Could be applied only to the Main entry point 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 entry point.

  • 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(self):
    return self.high[0], self.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


@indicator()

decorator

Decorator that should be applied to the Main entry point of any indicator.

  • SIGNATURES
@indicator(
  abbrev_title: str,
  overlay_main_pane: bool = False,
  format: indie.format = 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

Decorator that is used to create a level (horizontal line) in an indicator.

  • SIGNATURES
@level(
  value: float,
  title: indie.Optional[str] = None,
  line_color: indie.Color = indie.color.GRAY(0.5),
  line_style: indie.line_style = 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(self):
    return self.close[0]
  • SEE ALSO

@indicator() @band()


@param.bool()

decorator

Declares a bool input parameter of indicator. Values of input parameters can be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in Main entry point.

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

    • id — Name of Main function or class parameter bound 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(self, is_something_enabled):
    # Use is_something_enabled variable...
  • SEE ALSO

@indicator() param


@param.float()

decorator

Declares a float input parameter of indicator. Values of input parameters can be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in Main entry point.

  • 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 function or class parameter bound 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(self, speed_of_light):
    # Use speed_of_light variable...
  • SEE ALSO

@indicator() param


@param.int()

decorator

Declares an integer input parameter of indicator. Values of input parameters can be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in Main entry point.

  • 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 function or class parameter bound 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(self, meaning_of_life):
    # Use meaning_of_life variable...
  • SEE ALSO

@indicator() param


@param.source()

decorator

Declares a source input parameter of indicator. Values of input parameters can be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in Main entry point.

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

    • id — Name of Main function or class parameter bound 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(self, 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.str()

decorator

Declares a str input parameter of indicator. Values of input parameters can be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in Main entry point.

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

    • id — Name of Main function or class parameter bound 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.str('name', default='Lisa', options=['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'])
def Main(self, 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.string()

decorator

[Deprecated, use @indie.param.str instead] Declares a string input parameter of indicator. Values of input parameters can be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in Main entry point.

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

    • id — Name of Main function or class parameter bound 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(self, 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. Values of input parameters can be changed in indicator's Settings panel. Input parameters are used in combination with corresponding parameter declaration in Main entry point.

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

    • id — Name of Main function or class parameter bound 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(self, 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. String representation of TimeFrame has a form of <number>[m|h|D|W|M|Y] where suffixes mean: m - minutes, h - hours, D - days, W - weeks, M - months, Y - years.

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 TimeFrame.from_str()


@param_ref()

decorator

Declares an input parameter for @sec_context function that is linked to the input parameter of Main by id.

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

    • id — Name of Main function or class parameter bound to the input parameter.
  • EXAMPLE

@sec_context
@param_ref('referenced_param')
def SecMain(self, referenced_param) -> float:
    # Use referenced_param variable...

@indicator('Referenced param example')
@param.int('referenced_param', default=50)
class Main(MainContext):
    def __init__(self):
        self._calc_on_result = self.calc_on(time_frame=tf('1D'), sec_context=SecMain)

    def calc(self):
        return self._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 entry point 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 entry point.

  • SIGNATURES
@plot(
  id: indie.Optional[str] = None,
  title: indie.Optional[str] = None,
  color: indie.Optional[indie.Color] = None,
  style: indie.plot_style = indie.plot_style.LINE,
  line_style: indie.Optional[indie.line_style] = None,
  line_width: indie.Optional[int] = None,
  continuous: indie.Optional[bool] = None,
  base_value: indie.Optional[float] = None,
  rel_width: indie.Optional[float] = None
) -> 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.

  • EXAMPLE

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

@fill() Plot


@sec_context()

decorator

Decorates a function, making it a secondary Main entry point for additional instrument of an indicator. Additional instruments are requested with the help of Context.calc_on function and this decorator.

  • SIGNATURES
@sec_context() -> NoneType
  • EXAMPLE
# indie:lang_version = 4
from indie import indicator, sec_context, param

@sec_context
def Main2(self):
    return self.high[0], self.low[0]

@indicator('Minimal calc_on example', overlay_main_pane=True)
@param.time_frame('sec_time_frame', default='1D')
class Main(MainContext):
    def __init__(self, sec_time_frame):
        self._sec_high, self._sec_low = self.calc_on(time_frame=sec_time_frame, sec_context=Main2)

    def calc(self):
        return self._sec_high[0], self._sec_low[0]
  • REMARKS

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

  • SEE ALSO

@indicator() Context Context.calc_on()


Functions


Algorithm.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Algorithm


Color.__call__()

method

Creates a new Color instance with the given transparency applied to the existing color.

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

    • alpha — Alpha channel (component) of color which ranges from 0.0 (fully transparent) to 1.0 (fully opaque).
  • EXAMPLE

half_transparent_red = color.RED(0.5)  # This implicitly calls `color.RED.__call__(0.5)`
  • REMARKS

Method __call__ should never be called directly, instead color_obj(value) syntax should be used.

  • SEE ALSO

color Color


Context.calc_on()

method

Requests additional instrument (creates a secondary context object for it) for indicator and returns one or more SeriesF objects which match with the arity of values that sec_context function returns. All the returned series values are merged into the timescale of current context's instrument.

  • SIGNATURES
calc_on(
  sec_context: typing.Type[indie.SecContext],
  exchange: indie.Optional[str] = None,
  ticker: indie.Optional[str] = None,
  time_frame: indie.Optional[indie.TimeFrame] = None,
  lookahead: bool = False
) -> indie.SeriesF | tuple[indie.SeriesF, ...]
  • PARAMETERS

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

    • exchange — Alias for 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 or 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

@sec_context() Context


Context.is_first_in_regular_session()

method

Detects whether the current bar is the first bar of the regular trading session (excluding pre-market session). Returns True if the current bar is the first bar of the regular trading session or False if the current bar is not the first in the regular session or if no session has started.

  • SIGNATURES
is_first_in_regular_session() -> bool
  • REMARKS

The function will return False if the first bar of the regular session does not exist or is unavailable (e.g., due to data gaps or missing information).

  • SEE ALSO

Context TradingSession


Context.is_first_in_session()

method

Detects whether the current bar is the first bar of a new trading session (extended session included). Returns True if the current bar is the first bar of the trading session or False if the current bar is not the first in the session or if no session has started.

  • SIGNATURES
is_first_in_session() -> bool
  • REMARKS

The function will return False if the first bar of the session does not exist or is unavailable (e.g., due to data gaps or missing information).

  • SEE ALSO

Context TradingSession


Context.is_last_in_regular_session()

method

Detects whether the current bar is the last bar of the regular trading session (excluding after-hours session). Returns True if the current bar is the last bar of the regular trading session or False if the current bar is not the last in the regular session.

  • SIGNATURES
is_last_in_regular_session() -> bool
  • REMARKS

The function will return False if the session ends without a valid last bar (e.g., due to missing data).

  • SEE ALSO

Context TradingSession


Context.is_last_in_session()

method

Detects whether the current bar is the last bar of the trading session (extended session included). Returns True if the current bar is the last bar of the trading session or False if the current bar is not the last in the session.

  • SIGNATURES
is_last_in_session() -> bool
  • REMARKS

The function will return False if the session ends without a valid last bar (e.g., due to missing data).

  • SEE ALSO

Context TradingSession


Context.new_mut_series()

method

Creates a MutSeries[T] object, which is a container for T values in Indie code. The main feature of the MutSeries[T] container is its ability to store (or 'remember') the historical values of a variable. These values can be accessed later using the square brackets operator (via the __getitem__ method).

  • SIGNATURES
new_mut_series(default: T, size: int = 2) -> indie.MutSeries[T]
  • PARAMETERS

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

    • size — Number of elements that MutSeries object should store in memory. Default and possible minimum size is 2, which means that series of size = 2 stores 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. MutSeries objects also have a method request_size(new_size: int) which can be used to expand the size explicitly.

  • SEE ALSO

MutSeries[T].new() Context.new_mut_series_f() Context.new_var() Context


Context.new_mut_series_f()

method

Creates a MutSeriesF (an alias for MutSeries[float]) object, which is a container for float values in Indie code. The main feature of the MutSeriesF container is its ability to store (or 'remember') the historical values of a variable. These values can be accessed later using the square brackets operator (via the __getitem__ method).

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

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

    • size — Number of elements that MutSeriesF object should store in memory. Default and possible minimum size is 2, which means that series of size = 2 stores 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. MutSeriesF objects also have a method request_size(new_size: int) which can be used to expand the size explicitly.

  • SEE ALSO

MutSeries[T].new() Context


Context.new_var()

method

Creates a Var[T] object, which is a container for T value in Indie code. The main feature of the Var[T] container is its ability to rollback the value of the variable when a new realtime update appears to its value after the previous bar.

  • SIGNATURES
new_var(init: T) -> indie.Var[T]
  • PARAMETERS

    • init — Value that is written into Var object only once after the Var object was created.
  • SEE ALSO

Var[T].new() MutSeries[T].new() Context.new_mut_series() Context


Fill.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(
  offset: int = 0,
  color: indie.Optional[indie.Color] = None
) -> NoneType
  • 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) -> NoneType
  • PARAMETERS

    • msg — Error message.
  • SEE ALSO

IndieError


MutSeries[T].__setitem__()

method

Sets value of MutSeries[T] object at the specified index.

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

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

    • <unnamed param> — New value.

  • EXAMPLE

ms = MutSeries[float].new(init=0)
ms[0] = 42  # This implicitly calls `ms.__setitem__(0, 42)`
  • REMARKS
  1. The index must be equal to 0 (because historical values cannot be updated), otherwise the function will raise an error at runtime. Yes, this looks very weird and maybe it would be much better just to have a method MutSeriesF.set_last(value: float) but we like the syntax of square brackets. Maybe this will be fixed in the future versions of Indie, hard to say for sure. 2) Method __setitem__ should never be called directly, instead syntax series_obj[index] = value should be used.
  • SEE ALSO

MutSeries[T]


MutSeries[T].calc()

method

Recalculates a MutSeries[T] object. In most cases, you can simply use the s[i] = ... syntax instead, but this method allows you to pass an initialization value to the series.

  • SIGNATURES
calc(
  reset: indie.Optional[T] = None,
  init: indie.Optional[T] = None,
  size: int = 2
) -> indie.MutSeries[T]
  • PARAMETERS

    • reset — Value that is written into the most recent element of the MutSeries every time MutSeries.new function is executed.

    • init — Value that is written into the most recent element of the MutSeries object only once after the MutSeries object was created.

    • size — Number of elements that MutSeries object should store in memory. Default and possible minimum size is 2, which means that series of size = 2 stores 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. MutSeries objects also have a method request_size(new_size: int) which can be used to expand the size explicitly.

  • SEE ALSO

Context.new_mut_series_f() MutSeries[T].new() MutSeries[T]


MutSeries[T].new()

static method

Creates a MutSeries[T] object, which is a container for T values in Indie code. The main feature of the MutSeries[T] container is its ability to store (or 'remember') the historical values of a variable. These values can be accessed later using the square brackets operator (via the __getitem__ method).

  • SIGNATURES
new(
  reset: indie.Optional[T] = None,
  init: indie.Optional[T] = None,
  size: int = 2
) -> indie.MutSeries[T]
  • PARAMETERS

    • reset — Value that is written into the most recent element of the MutSeries every time MutSeries.new function is executed.

    • init — Value that is written into the most recent element of the MutSeries object only once after the MutSeries object was created.

    • size — Number of elements that MutSeries object should store in memory. Default and possible minimum size is 2, which means that series of size = 2 stores 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. MutSeries objects also have a method request_size(new_size: int) which can be used to expand the size explicitly.

  • SEE ALSO

Context.new_mut_series_f() MutSeries[T]


Optional[T].__bool__()

method

Casts Optional object to bool.

  • SIGNATURES
__bool__() -> bool
  • REMARKS

This method is present for Optional[T] only if T can be converted to bool.

  • SEE ALSO

Optional[T]


Optional[T].value()

method

Returns value of indie.Optional[T] object. Raises a runtime error if the optional object is None.

  • SIGNATURES
value() -> T
  • SEE ALSO

Optional[T]


Optional[T].value_or()

method

Returns value of indie.Optional[T] object or given default if the optional object is None.

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

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

Optional[T]


Plot.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(
  value: float,
  offset: int = 0,
  color: indie.Optional[indie.Color] = None
) -> NoneType
  • 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


Series[T].__getitem__()

method

Returns value of Series[T] object at the specified index. If the value is missing, then the default value of type T is returned (e.g. math.nan if T is float).

  • SIGNATURES
__getitem__(int) -> T
  • PARAMETERS

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

@indicator('Example')
def Main(self):
    return self.close[0]  # This implicitly calls `self.close.__getitem__(0)`
  • REMARKS

Method __getitem__ should never be called directly. Instead syntax series_obj[index] should be used.

  • SEE ALSO

Context Series[T]


Series[T].__len__()

method

Returns length (number of elements) of a Series[T] object.

  • SIGNATURES
__len__() -> int
  • EXAMPLE
l = len(self.close)  # this implicitly calls `self.close.__len__()`
  • REMARKS

Method __len__ should never be called directly. Instead syntax len(series_obj) should be used.

  • SEE ALSO

Series[T]


Series[T].get()

method

Returns value of Series[T] object at the specified index or given default if the value is missing.

  • SIGNATURES
get(offset: int, default: T, neg_offset_ok: bool = False) -> T
  • PARAMETERS

    • offset — Offset to extract value at.

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

    • neg_offset_ok — If False then get method raises an error on any offset < 0. If True then get method returns default value on negative offsets too. Default value is False.

  • SEE ALSO

Context Series[T]


Series[T].request_size()

method

Expands the capacity of Series[T] object (number of elements that Series[T] object should store in memory).

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

    • size — Number of elements that SeriesF object should store in memory. Default and possible minimum size is 2, which means that series of size = 2 stores 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[T]


TimeFrame.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(count: int, unit: indie.time_frame_unit) -> NoneType
  • PARAMETERS

    • count — Numeric part of time frame.

    • unit — Unit of time frame, can be 'm', 'h', 'D', 'W' or 'M'.

  • SEE ALSO

TimeFrame.from_str() TimeFrame


TimeFrame.from_str()

static method

Converts string representation of time frame to TimeFrame type. String representation of TimeFrame has a form of <number>[m|h|D|W|M|Y] where suffixes mean: m - minutes, h - hours, D - days, W - weeks, M - months, Y - years. For example TimeFrame.from_str('15m') creates a TimeFrame object which corresponds to 15 minute time frame.

  • SIGNATURES
from_str(tf_str: str) -> indie.TimeFrame
  • PARAMETERS

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

TimeFrame


TimeFrame.to_minutes()

method

Converts TimeFrame object to corresponding number of minutes. Month is always considered to be of 30 days long, and year is always of 365 days long.

  • SIGNATURES
to_minutes() -> int
  • SEE ALSO

TimeFrame.from_str() TimeFrame


Var[T].get()

method

Returns value of Var[T] object.

  • SIGNATURES
get() -> T
  • SEE ALSO

Var[T].set() Context Var[T]


Var[T].new()

static method

Creates a Var[T] object, which is a container for T value in Indie code. The main feature of the Var[T] container is its ability to rollback the value of the variable when a new realtime update appears to its value after the previous bar.

  • SIGNATURES
new(init: T) -> indie.Var[T]
  • PARAMETERS

    • init — Value that is written into Var object only once after the Var object was created.
  • SEE ALSO

Context.new_mut_series_f() Var[T]


Var[T].set()

method

Sets value of Var[T] object.

  • SIGNATURES
set(T) -> NoneType
  • PARAMETERS

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

Var[T].get() Context Var[T]


tf()

function

[deprecated] Converts string representation of time frame to TimeFrame type. String representation of TimeFrame has a form of <number>[m|h|D|W|M|Y] where suffixes mean: m - minutes, h - hours, D - days, W - weeks, M - months, Y - years. For example tf('15m') creates a TimeFrame object which corresponds to 15 minute time frame.

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

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

TimeFrame @param.time_frame()


Objects


Algorithm.ctx

field

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.

  • TYPE

Context

  • SEE ALSO

Algorithm


Context.bar_count

field

Current total number of bars in this context's instrument which the indicator has received. It is always true that self.bar_count is equal to self.bar_index + 1.

  • TYPE

int

  • SEE ALSO

Context


Context.bar_index

field

Index of a last (current) bar in this context's instrument which the indicator has received. The very first bar has index equal to 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[float]

  • SEE ALSO

Context


Context.high

field

Series of 'high' prices of the context's instrument.

  • TYPE

Series[float]

  • SEE ALSO

Context


Context.hl2

field

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

  • TYPE

Series[float]

  • SEE ALSO

Context


Context.hlc3

field

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

  • TYPE

Series[float]

  • SEE ALSO

Context


Context.info

field

Information about the context's instrument.

  • TYPE

SymbolInfo

  • SEE ALSO

Context


Context.is_closed_bar

field

Flag that is True if the current bar is a historical bar or it is a final update for a realtime bar.

  • TYPE

bool

  • SEE ALSO

Context


Context.is_history

field

Flag that is True if the current bar is a historical bar.

  • TYPE

bool

  • 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 of the historical part of prices data.

  • TYPE

bool

  • SEE ALSO

Context


Context.is_new_bar

field

Flag that is True if the current bar is a historical bar or it is a first update for a realtime bar.

  • TYPE

bool

  • SEE ALSO

Context


Context.is_realtime

field

Flag that is True if the last (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[float]

  • SEE ALSO

Context


Context.ohlc4

field

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

  • TYPE

Series[float]

  • SEE ALSO

Context


Context.open

field

Series of 'open' prices of the context's instrument.

  • TYPE

Series[float]

  • SEE ALSO

Context


Context.time

field

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

  • TYPE

Series[float]

  • SEE ALSO

Context


Context.time_frame

field

Time frame of the context's instrument.

  • TYPE

TimeFrame

  • SEE ALSO

Context


Context.trading_session

field

Trading session of the context's instrument.

  • TYPE

TradingSession

  • SEE ALSO

Context


Context.volume

field

Series of 'volume' values of the context's instrument.

  • TYPE

Series[float]

  • SEE ALSO

Context


SymbolInfo.exchange_aliases

field

Commonly recognized (but not exactly standardized) alias for an exchange. For example, an alias for 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

[deprecated] 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


SymbolInfo.timezone

field

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

  • TYPE

str

  • SEE ALSO

SymbolInfo


format.INHERITED

static field

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

  • TYPE

format

  • 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

format

  • 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

format

  • SEE ALSO

format


line_style.DASHED

static field

Built-in line style constant that determines how the line is rendered.

  • TYPE

line_style

  • SEE ALSO

line_style


line_style.DOTTED

static field

Built-in line style constant that determines how the line is rendered.

  • TYPE

line_style

  • SEE ALSO

line_style


line_style.SOLID

static field

Built-in line style constant that determines how the line is rendered.

  • TYPE

line_style

  • SEE ALSO

line_style


plot_style.COLUMNS

static field

Built-in plot style constant that determines how the plot data is rendered.

  • TYPE

plot_style

  • SEE ALSO

plot_style


plot_style.HISTOGRAM

static field

Built-in plot style constant that determines how the plot data is rendered.

  • TYPE

plot_style

  • SEE ALSO

plot_style


plot_style.LINE

static field

Built-in plot style constant that determines how the plot data is rendered.

  • TYPE

plot_style

  • SEE ALSO

plot_style


plot_style.STEPS

static field

Built-in plot style constant that determines how the plot data is rendered.

  • TYPE

plot_style

  • SEE ALSO

plot_style


source.CLOSE

static field

Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.

  • TYPE

source

  • SEE ALSO

source


source.HIGH

static field

Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.

  • TYPE

source

  • SEE ALSO

source


source.HL2

static field

Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.

  • TYPE

source

  • SEE ALSO

source


source.HLC3

static field

Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.

  • TYPE

source

  • SEE ALSO

source


source.LOW

static field

Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.

  • TYPE

source

  • SEE ALSO

source


source.OHLC4

static field

Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.

  • TYPE

source

  • SEE ALSO

source


source.OPEN

static field

Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.

  • TYPE

source

  • SEE ALSO

source


source.VOLUME

static field

Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.

  • TYPE

source

  • SEE ALSO

source


time_frame_unit.DAY

static field

Built-in constants that represent time frame units.

  • TYPE

time_frame_unit

  • SEE ALSO

time_frame_unit


time_frame_unit.HOUR

static field

Built-in constants that represent time frame units.

  • TYPE

time_frame_unit

  • SEE ALSO

time_frame_unit


time_frame_unit.MINUTE

static field

Built-in constants that represent time frame units.

  • TYPE

time_frame_unit

  • SEE ALSO

time_frame_unit


time_frame_unit.MONTH

static field

Built-in constants that represent time frame units.

  • TYPE

time_frame_unit

  • SEE ALSO

time_frame_unit


time_frame_unit.WEEK

static field

Built-in constants that represent time frame units.

  • TYPE

time_frame_unit

  • SEE ALSO

time_frame_unit


Package indie.algorithms

Algorithms package of Indie language.

  • CONTENTS

Adx Atr Bb Cci Change Corr CumSum Dev Donchian Ema FixNan Highest LinReg Lowest Ma Median Mfv NanToZero NetVolume PercentRank Rma Roc Rsi SinceHighest SinceLowest Sma StdDev Stoch Sum Supertrend Tr Tsi Vwap Vwma Wma


Types


Adx

type

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

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import nan, isclose
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Change, Rma, Tr, FixNan


@algorithm
def Adx(self, adx_len: int, di_len: int) -> tuple[SeriesF, SeriesF, SeriesF]:
    '''Average Directional Index'''
    up = Change.new(self.ctx.high)[0]
    down = -Change.new(self.ctx.low)[0]
    plus_dm = MutSeriesF.new(0 if up <= down or up <= 0 else up)
    minus_dm = MutSeriesF.new(0 if down <= up or down <= 0 else down)

    truerange = Rma.new(Tr.new(), di_len)

    plus = MutSeriesF.new(init=nan)
    minus = MutSeriesF.new(init=nan)
    if not isclose(truerange[0], 0):
        plus[0] = 100 * Rma.new(plus_dm, di_len)[0] / truerange[0]
        minus[0] = 100 * Rma.new(minus_dm, di_len)[0] / truerange[0]
    plus[0] = FixNan.new(plus)[0]
    minus[0] = FixNan.new(minus)[0]

    sum = plus[0] + minus[0]
    res = 100 * Rma.new(MutSeriesF.new(abs(plus[0] - minus[0]) / (sum if sum != 0 else 1)), adx_len)[0]
    return minus, MutSeriesF.new(res), plus
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF
from indie.algorithms import Tr, Ma


@algorithm
def Atr(self, length: int, ma_algorithm: str = 'RMA') -> SeriesF:
    '''Average True Range'''
    return Ma.new(Tr.new(True), length, ma_algorithm)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sma, StdDev


@algorithm
def Bb(self, src: SeriesF, length: int, mult: float) -> tuple[SeriesF, SeriesF, SeriesF]:
    '''Bollinger Bands'''
    middle = Sma.new(src, length)[0]
    dev = mult * StdDev.new(src, length)[0]
    lower = middle - dev
    upper = middle + dev
    return MutSeriesF.new(lower), MutSeriesF.new(middle), MutSeriesF.new(upper)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import nan, isclose
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sma, Dev


@algorithm
def Cci(self, src: SeriesF, length: int) -> SeriesF:
    '''Commodity Channel Index'''
    ma = Sma.new(src, length)[0]
    dv = Dev.new(src, length)[0]
    res = nan
    if not isclose(dv, 0):
        res = (src[0] - ma) / (0.015 * dv)
    return MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF


@algorithm
def Change(self, src: SeriesF, length: int = 1) -> SeriesF:
    return MutSeriesF.new(src[0] - src[length])
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isclose
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sma, StdDev


@algorithm
def Corr(self, x: SeriesF, y: SeriesF, length: int) -> SeriesF:
    # NOTE: `cov` could be calculated as `E(x*y) - E(x)*E(y)`,
    # but that may cause precision issues with floating-point arithmetic
    e_x = Sma.new(x, length)[0]
    e_y = Sma.new(y, length)[0]
    cov = 0.0
    for i in range(length):
        cov += (x[i] - e_x) * (y[i] - e_y)
    cov /= length
    std_devs = StdDev.new(x, length)[0] * StdDev.new(y, length)[0]
    corr = 0.0
    if not isclose(std_devs, 0):
        corr = cov / std_devs
    return MutSeriesF.new(corr)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF


@algorithm
def CumSum(self, src: SeriesF) -> SeriesF:
    res = MutSeriesF.new(init=0)
    res[0] += src[0]
    return res
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sma


@algorithm
def Dev(self, src: SeriesF, length: int) -> SeriesF:
    '''Mean Absolute Deviation'''
    mean = Sma.new(src, length)[0]
    sum = 0.0
    for i in range(length):
        sum += abs(src[i] - mean)
    return MutSeriesF.new(sum / length)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, MutSeriesF, SeriesF
from indie.algorithms import Lowest, Highest


@algorithm
def Donchian(self, length: int) -> SeriesF:
    lowest = Lowest.new(self.ctx.low, length)[0]
    highest = Highest.new(self.ctx.high, length)[0]
    return MutSeriesF.new((lowest + highest) / 2)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isnan, nan
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sma


@algorithm
def Ema(self, src: SeriesF, length: int) -> SeriesF:
    '''Exponential Moving Average'''
    alpha = 2 / (length + 1)
    s = MutSeriesF.new(init=0)
    res_sma = Sma.new(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 MutSeriesF.new(result)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isnan
from indie import algorithm, SeriesF, MutSeriesF


@algorithm
def FixNan(self, src: SeriesF) -> SeriesF:
    res = MutSeriesF.new(init=src[0])
    if not isnan(src[0]):
        res[0] = src[0]
    return res
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF


@algorithm
def Highest(self, src: SeriesF, length: int) -> SeriesF:
    src.request_size(length)
    result = src[0]
    for i in range(1, length):
        result = max(src[i], result)
    return MutSeriesF.new(result)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isclose, nan
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sma, StdDev, Corr


@algorithm
def LinReg(self, y: SeriesF, length: int, offset: int = 0) -> SeriesF:
    x = MutSeriesF.new(self.ctx.bar_index)
    e_x = Sma.new(x, length)[0]
    e_y = Sma.new(y, length)[0]
    dev_x = StdDev.new(x, length)[0]
    dev_y = StdDev.new(y, length)[0]
    corr = Corr.new(x, y, length)[0]
    slope = nan
    if not isclose(dev_x, 0):
        slope = corr * (dev_y / dev_x)
    inter = e_y - slope * e_x
    reg = (x[0] - offset) * slope + inter
    return MutSeriesF.new(reg)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF


@algorithm
def Lowest(self, src: SeriesF, length: int) -> SeriesF:
    src.request_size(length)
    result = src[0]
    for i in range(1, length):
        result = min(src[i], result)
    return MutSeriesF.new(result)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF, Optional, IndieError
from indie.algorithms import Ema, Sma, Rma, Vwma, Wma


@algorithm
def Ma(self, src: SeriesF, length: int, algorithm: str) -> SeriesF:
    '''Moving Average'''
    result: Optional[SeriesF]
    if algorithm == 'EMA':
        result = Ema.new(src, length)
    elif algorithm == 'SMA':
        result = Sma.new(src, length)
    elif algorithm == 'SMMA (RMA)' or algorithm == 'RMA':
        result = Rma.new(src, length)
    elif algorithm == 'VWMA':
        result = Vwma.new(src, length)
    elif algorithm == 'WMA':
        result = Wma.new(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()
  • EXAMPLE
# indie:lang_version = 4
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]

Median

type

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

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF
from statistics import median as stats_median


# TODO: Use quickselect median find algorithm, see more https://rcoh.me/posts/linear-time-median-finding/
@algorithm
def Median(self, src: SeriesF, length: int) -> SeriesF:
    prices: list[float] = []  # TODO: Create list of size=length only once and clear+refill it
    for i in range(length):
        prices.append(src[i])
    res = stats_median(prices)  # type: ignore
    return MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
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]

Mfv

type

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

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isclose
from indie import algorithm, MutSeriesF, SeriesF


@algorithm
def Mfv(self) -> SeriesF:
    '''Money Flow Volume'''
    h = self.ctx.high[0]
    l = self.ctx.low[0]
    c = self.ctx.close[0]
    v = self.ctx.volume[0]

    res = 0.0
    if not isclose(h - l, 0):
        res = ((c - l) - (h - c)) / (h - l) * v
    return MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isnan
from indie import algorithm, SeriesF, MutSeriesF


@algorithm
def NanToZero(self, src: SeriesF) -> SeriesF:
    res = 0 if isnan(src[0]) else src[0]
    return MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import nan
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Change


@algorithm
def NetVolume(self, src: SeriesF) -> SeriesF:
    der = Change.new(src)[0]
    nv = MutSeriesF.new(init=nan)
    if der > 0:
        nv[0] = self.ctx.volume[0]
    elif der < 0:
        nv[0] = -self.ctx.volume[0]
    elif der == 0:
        nv[0] = 0
    return nv
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF


@algorithm
def PercentRank(self, src: SeriesF, length: int) -> SeriesF:
    num_leq = 0
    for idx in range(1, length + 1):
        if src[idx] <= src[0]:
            num_leq += 1
    return MutSeriesF.new(100.0 * num_leq / length)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isnan
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sma


@algorithm
def Rma(self, src: SeriesF, length: int) -> SeriesF:
    '''RSI Moving Average'''
    result = MutSeriesF.new(init=0)
    if isnan(result[1]):
        result[0] = Sma.new(src, length)[0]
    else:
        result[0] = (src[0] + (length - 1) * result[1]) / length
    return result
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import nan, isclose
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Change


@algorithm
def Roc(self, src: SeriesF, length: int) -> SeriesF:
    '''Rate Of Change'''
    res = nan
    if not isclose(src[length], 0):
        res = 100 * Change.new(src, length)[0] / src[length]
    return MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isclose
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import NanToZero, Change, Rma


@algorithm
def Rsi(self, src: SeriesF, length: int) -> SeriesF:
    '''Relative Strength Index'''
    u = max(NanToZero.new(Change.new(src))[0], 0)  # upward change
    rma_u = Rma.new(MutSeriesF.new(u), length)[0]

    d = max(-NanToZero.new(Change.new(src))[0], 0)  # downward change
    rma_d = Rma.new(MutSeriesF.new(d), length)[0]

    res = 100.0
    if not isclose(rma_d, 0):
        rs = rma_u / rma_d
        res = 100 - 100 / (1 + rs)
    return MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
from indie import indicator
from indie.algorithms import Rsi

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

SinceHighest

type

Read here about how to use it.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, MutSeriesF, SeriesF


@algorithm
def SinceHighest(self, src: SeriesF, length: int) -> SeriesF:
    offset = 0
    for idx in range(length):
        if src[idx] >= src[offset]:
            offset = idx
    return MutSeriesF.new(offset)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, MutSeriesF, SeriesF


@algorithm
def SinceLowest(self, src: SeriesF, length: int) -> SeriesF:
    offset = 0
    for idx in range(length):
        if src[idx] <= src[offset]:
            offset = idx
    return MutSeriesF.new(offset)
  • EXAMPLE
# indie:lang_version = 4
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


Sma

type

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

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sum


@algorithm
def Sma(self, src: SeriesF, length: int) -> SeriesF:
    '''Simple Moving Average'''
    s = Sum.new(src, length)
    return MutSeriesF.new(s[0] / length)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import sqrt
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sma


@algorithm
def StdDev(self, src: SeriesF, length: int) -> SeriesF:
    # NOTE: `var_` could be calculated as `E(src^2) - E(src)^2`,
    # but that may cause precision issues with floating-point arithmetic
    avg = Sma.new(src, length)[0]
    var_ = 0.0
    for i in range(length):
        dev = src[i] - avg
        var_ += dev * dev
    var_ /= length
    return MutSeriesF.new(sqrt(var_))
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isclose
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Lowest, Highest


@algorithm
def Stoch(self, src: SeriesF, low: SeriesF, high: SeriesF, length: int) -> SeriesF:
    lowest_low = Lowest.new(low, length)[0]
    highest_high = Highest.new(high, length)[0]

    res = 100.0
    if not isclose(highest_high - lowest_low, 0):
        res = 100 * (src[0] - lowest_low) / (highest_high - lowest_low)
    return MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isnan, nan
from indie import algorithm, SeriesF, MutSeriesF, Var


def nan_to_zero(val: float) -> float:
    return 0 if isnan(val) else val


@algorithm
def Sum(self, src: SeriesF, length: int) -> SeriesF:
    src.request_size(length + 1)
    nan_count = Var[int].new(0)
    sum = Var[float].new(0)
    sum.set(sum.get() + nan_to_zero(src[0]))

    result = 0.0
    if isnan(src[0]):
        nan_count.set(nan_count.get() + 1)
        result = nan
    else:
        if len(src) - nan_count.get() > length:
            sum.set(sum.get() - src[length])
        if len(src) - nan_count.get() < length:
            result = nan
        else:
            result = sum.get()
    return MutSeriesF.new(result)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import isnan
from indie import algorithm, MutSeriesF, SeriesF
from indie.algorithms import Atr


def nan_to_val(maybe_nan: float, val: float) -> float:
    return val if isnan(maybe_nan) else maybe_nan


@algorithm
def Supertrend(self, factor: float, atr_period: int, ma_algorithm: str) -> tuple[SeriesF, SeriesF]:
    src = self.ctx.hl2
    atr = Atr.new(atr_period, ma_algorithm)
    upper_band = MutSeriesF.new(src[0] + factor * atr[0])
    lower_band = MutSeriesF.new(src[0] - factor * atr[0])
    prev_lower_band = nan_to_val(lower_band[1], 0)
    prev_upper_band = nan_to_val(upper_band[1], 0)
    lower_band[0] = lower_band[0] \
                    if lower_band[0] > prev_lower_band or self.ctx.close[1] < prev_lower_band \
                    else prev_lower_band
    upper_band[0] = upper_band[0] \
                    if upper_band[0] < prev_upper_band or self.ctx.close[1] > prev_upper_band \
                    else prev_upper_band
    direction: float
    super_trend = MutSeriesF.new(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 self.ctx.close[0] > upper_band[0] else 1.0
    else:
        direction = 1.0 if self.ctx.close[0] < lower_band[0] else -1.0
    super_trend[0] = lower_band[0] if direction < 0 else upper_band[0]
    return super_trend, MutSeriesF.new(direction)
  • EXAMPLE
# indie:lang_version = 4
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(st[0], color=c)

Tr

type

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

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import nan, isnan
from indie import algorithm, SeriesF, MutSeriesF


@algorithm
def Tr(self, handle_na: bool = False) -> SeriesF:
    '''True Range'''
    res = nan if handle_na else self.ctx.high[0] - self.ctx.low[0]
    if not isnan(self.ctx.close[1]):
        res = max(
            self.ctx.high[0] - self.ctx.low[0],
            abs(self.ctx.high[0] - self.ctx.close[1]),
            abs(self.ctx.low[0] - self.ctx.close[1]),
        )
    return MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import nan, isclose
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Ema, Change


@algorithm
def DoubleSmooth(self, src: SeriesF, long_len: int, short_len: int) -> SeriesF:
    return Ema.new(Ema.new(src, long_len), short_len)


@algorithm
def Tsi(self, src: SeriesF, long_len: int, short_len: int) -> SeriesF:
    '''True Strength Index'''
    pc = Change.new(src)
    double_smoothed_pc = DoubleSmooth.new(pc, long_len, short_len)[0]
    abs_pc = MutSeriesF.new(abs(pc[0]))
    double_smoothed_abs_pc = DoubleSmooth.new(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 MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
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]

Vwap

type

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

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import sqrt
from datetime import datetime
from indie import algorithm, SeriesF, MutSeriesF, Var


@algorithm
def Vwap(self, src: SeriesF, anchor: str, std_dev_mult: float) -> tuple[SeriesF, SeriesF, SeriesF]:
    '''
    Volume Weighted Average Price
    anchor can be 'Session', 'Week', 'Month', 'Year'
    '''
    cum_weighted_price = Var[float].new(0)
    cum_volume = Var[float].new(0)
    vwap_sum = Var[float].new(0)
    vwap_count = Var[int].new(0)
    vwap_dev_squares = Var[float].new(0)

    current_datetime = datetime.utcfromtimestamp(self.ctx.time[0])
    prev_datetime = datetime.utcfromtimestamp(self.ctx.time.get(1, 0))
    need_reset = False
    if anchor == 'Session' and \
            not self.ctx.trading_session.is_same_period(self.ctx.time[0], self.ctx.time.get(1, 0)):
        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.set(0)
        cum_volume.set(0)
        vwap_sum.set(0)
        vwap_count.set(0)
        vwap_dev_squares.set(0)

    cum_weighted_price.set(cum_weighted_price.get() + src[0] * self.ctx.volume[0])
    cum_volume.set(cum_volume.get() + self.ctx.volume[0])
    vwap_value = cum_weighted_price.get() / cum_volume.get()

    vwap_sum.set(vwap_sum.get() + vwap_value)
    vwap_count.set(vwap_count.get() + 1)
    vwap_avg = vwap_sum.get() / vwap_count.get()
    vwap_dev_squares.set(vwap_dev_squares.get() + (vwap_value - vwap_avg) ** 2)
    vwap_std_dev = sqrt(vwap_dev_squares.get() / vwap_count.get())

    std_dev = std_dev_mult * vwap_std_dev
    lower = MutSeriesF.new(vwap_value - std_dev)
    upper = MutSeriesF.new(vwap_value + std_dev)

    return MutSeriesF.new(vwap_value), upper, lower
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from math import nan, isclose
from indie import algorithm, SeriesF, MutSeriesF
from indie.algorithms import Sma


@algorithm
def Vwma(self, src: SeriesF, length: int) -> SeriesF:
    '''Volume Weighted Moving Average'''
    src_vol = MutSeriesF.new(src[0] * self.ctx.volume[0])
    sma_src_vol = Sma.new(src_vol, length)
    sma_vol = Sma.new(self.ctx.volume, length)
    res = nan
    if not isclose(sma_vol[0], 0):
        res = sma_src_vol[0] / sma_vol[0]
    return MutSeriesF.new(res)
  • EXAMPLE
# indie:lang_version = 4
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.

  • PARENTS

Algorithm

  • MEMBERS

__init__() calc() ctx new()

  • SOURCE CODE
# indie:lang_version = 4
from indie import algorithm, SeriesF, MutSeriesF


@algorithm
def Wma(self, src: SeriesF, length: int) -> SeriesF:
    '''Weighted Moving Average'''
    norm = 0.0
    s = 0.0
    for i in range(length):
        weight = length - i
        norm += weight
        s += src[i] * weight
    return MutSeriesF.new(s / norm)
  • EXAMPLE
# indie:lang_version = 4
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]

Functions


Adx.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Adx


Adx.calc()

method

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

  • SIGNATURES
calc(
  adx_len: int,
  di_len: int
) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]
  • PARAMETERS

    • adx_len — Number of bars to calculate smoothing.

    • di_len — Number of bars to calculate directional indicator.

  • SEE ALSO

Adx


Adx.new()

static method

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

  • SIGNATURES
new(
  adx_len: int,
  di_len: int
) -> tuple[indie.Series[float], indie.Series[float], indie.Series[float]]
  • PARAMETERS

    • adx_len — Number of bars to calculate smoothing.

    • di_len — Number of bars to calculate directional indicator.

  • SEE ALSO

Adx


Atr.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Atr


Atr.calc()

method

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

  • SIGNATURES
calc(length: int, ma_algorithm: str = "RMA") -> indie.Series[float]
  • PARAMETERS

    • 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'.

  • SEE ALSO

Atr


Atr.new()

static method

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

  • SIGNATURES
new(length: int, ma_algorithm: str = "RMA") -> indie.Series[float]
  • PARAMETERS

    • 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'.

  • SEE ALSO

Atr


Bb.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Bb


Bb.calc()

method

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

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

    • src — Series data to perform the calculation.

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

    • mult — Multiplier for standard deviation.

  • SEE ALSO

Bb


Bb.new()

static method

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

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

    • src — Series data to perform the calculation.

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

    • mult — Multiplier for standard deviation.

  • SEE ALSO

Bb


Cci.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Cci


Cci.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Cci


Cci.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Cci


Change.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Change


Change.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int = 1) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Change


Change.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int = 1) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Change


Corr.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Corr


Corr.calc()

method

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

  • SIGNATURES
calc(
  x: indie.Series[float],
  y: indie.Series[float],
  length: int
) -> indie.Series[float]
  • PARAMETERS

    • x — First series to calculate correlation with.

    • y — Second series to calculate correlation with.

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

  • SEE ALSO

Corr


Corr.new()

static method

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

  • SIGNATURES
new(
  x: indie.Series[float],
  y: indie.Series[float],
  length: int
) -> indie.Series[float]
  • PARAMETERS

    • x — First series to calculate correlation with.

    • y — Second series to calculate correlation with.

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

  • SEE ALSO

Corr


CumSum.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

CumSum


CumSum.calc()

method

Returns series of cumulative sum of src values.

  • SIGNATURES
calc(src: indie.Series[float]) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SEE ALSO

CumSum


CumSum.new()

static method

Returns series of cumulative sum of src values.

  • SIGNATURES
new(src: indie.Series[float]) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SEE ALSO

CumSum


Dev.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Dev


Dev.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Dev


Dev.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Dev


Donchian.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Donchian


Donchian.calc()

method

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

  • SIGNATURES
calc(length: int) -> indie.Series[float]
  • PARAMETERS

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

Donchian


Donchian.new()

static method

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

  • SIGNATURES
new(length: int) -> indie.Series[float]
  • PARAMETERS

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

Donchian


Ema.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Ema


Ema.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Ema


Ema.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Ema


FixNan.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

NanToZero.new() FixNan


FixNan.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float]) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SEE ALSO

NanToZero.calc() FixNan


FixNan.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float]) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SEE ALSO

NanToZero.new() FixNan


Highest.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

SinceHighest.new() Highest


Highest.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

SinceHighest.calc() Highest


Highest.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

SinceHighest.new() Highest


LinReg.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

LinReg


LinReg.calc()

method

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

  • SIGNATURES
calc(
  src: indie.Series[float],
  length: int,
  offset: int = 0
) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

    • offset — Offset of the argument to calculate LinReg.

  • SEE ALSO

LinReg


LinReg.new()

static method

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

  • SIGNATURES
new(
  src: indie.Series[float],
  length: int,
  offset: int = 0
) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

    • offset — Offset of the argument to calculate LinReg.

  • SEE ALSO

LinReg


Lowest.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

SinceLowest.new() Lowest


Lowest.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

SinceLowest.calc() Lowest


Lowest.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

SinceLowest.new() Lowest


Ma.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Ma


Ma.calc()

method

Returns a moving average of src specified by algorithm argument.

  • SIGNATURES
calc(
  src: indie.Series[float],
  length: int,
  algorithm: str
) -> indie.Series[float]
  • PARAMETERS

    • 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'.

  • SEE ALSO

Ma


Ma.new()

static method

Returns a moving average of src specified by algorithm argument.

  • SIGNATURES
new(
  src: indie.Series[float],
  length: int,
  algorithm: str
) -> indie.Series[float]
  • PARAMETERS

    • 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'.

  • SEE ALSO

Ma


Median.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Median


Median.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Median


Median.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Median


Mfv.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Mfv


Mfv.calc()

method

Returns series of Money Flow Volume.

  • SIGNATURES
calc() -> indie.Series[float]
  • SEE ALSO

Mfv


Mfv.new()

static method

Returns series of Money Flow Volume.

  • SIGNATURES
new() -> indie.Series[float]
  • SEE ALSO

Mfv


NanToZero.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

FixNan.new() NanToZero


NanToZero.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float]) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SEE ALSO

FixNan.calc() NanToZero


NanToZero.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float]) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SEE ALSO

FixNan.new() NanToZero


NetVolume.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

NetVolume


NetVolume.calc()

method

Returns series of Net Volume values calculated on src series.

  • SIGNATURES
calc(src: indie.Series[float]) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SEE ALSO

NetVolume


NetVolume.new()

static method

Returns series of Net Volume values calculated on src series.

  • SIGNATURES
new(src: indie.Series[float]) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.
  • SEE ALSO

NetVolume


PercentRank.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

PercentRank


PercentRank.calc()

method

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
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

PercentRank


PercentRank.new()

static method

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
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

PercentRank


Rma.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Rma


Rma.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Rma


Rma.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Rma


Roc.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Roc


Roc.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Roc


Roc.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Roc


Rsi.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Rsi


Rsi.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Rsi


Rsi.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Rsi


SinceHighest.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Highest.new() SinceHighest


SinceHighest.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Highest.calc() SinceHighest


SinceHighest.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Highest.new() SinceHighest


SinceLowest.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Lowest.new() SinceLowest


SinceLowest.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Lowest.calc() SinceLowest


SinceLowest.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Lowest.new() SinceLowest


Sma.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Sma


Sma.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Sma


Sma.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Sma


StdDev.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

StdDev


StdDev.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

StdDev


StdDev.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

StdDev


Stoch.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Stoch


Stoch.calc()

method

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

  • SIGNATURES
calc(
  src: indie.Series[float],
  low: indie.Series[float],
  high: indie.Series[float],
  length: int
) -> indie.Series[float]
  • 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.

  • SEE ALSO

Stoch


Stoch.new()

static method

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

  • SIGNATURES
new(
  src: indie.Series[float],
  low: indie.Series[float],
  high: indie.Series[float],
  length: int
) -> indie.Series[float]
  • 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.

  • SEE ALSO

Stoch


Sum.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Sum


Sum.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Sum


Sum.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Sum


Supertrend.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Supertrend


Supertrend.calc()

method

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

  • SIGNATURES
calc(
  factor: float,
  atr_period: int,
  ma_algorithm: str
) -> tuple[indie.Series[float], indie.Series[float]]
  • PARAMETERS

    • 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'.

  • SEE ALSO

Supertrend


Supertrend.new()

static method

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

  • SIGNATURES
new(
  factor: float,
  atr_period: int,
  ma_algorithm: str
) -> tuple[indie.Series[float], indie.Series[float]]
  • PARAMETERS

    • 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'.

  • SEE ALSO

Supertrend


Tr.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Tr


Tr.calc()

method

Returns series of True Range values.

  • SIGNATURES
calc(handle_na: bool = False) -> indie.Series[float]
  • PARAMETERS

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

Tr


Tr.new()

static method

Returns series of True Range values.

  • SIGNATURES
new(handle_na: bool = False) -> indie.Series[float]
  • PARAMETERS

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

Tr


Tsi.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Tsi


Tsi.calc()

method

Returns series of True Strength Index values.

  • SIGNATURES
calc(
  src: indie.Series[float],
  long_len: int,
  short_len: int
) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

    • long_len — Long length.

    • short_len — Short length.

  • SEE ALSO

Tsi


Tsi.new()

static method

Returns series of True Strength Index values.

  • SIGNATURES
new(
  src: indie.Series[float],
  long_len: int,
  short_len: int
) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

    • long_len — Long length.

    • short_len — Short length.

  • SEE ALSO

Tsi


Vwap.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Vwap


Vwap.calc()

method

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

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

    • 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.

  • SEE ALSO

Vwap


Vwap.new()

static method

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

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

    • 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.

  • SEE ALSO

Vwap


Vwma.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Vwma


Vwma.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Vwma


Vwma.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Vwma


Wma.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(ctx: indie.Context) -> NoneType
  • PARAMETERS

    • ctx — Context object.
  • SEE ALSO

Wma


Wma.calc()

method

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

  • SIGNATURES
calc(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Wma


Wma.new()

static method

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

  • SIGNATURES
new(src: indie.Series[float], length: int) -> indie.Series[float]
  • PARAMETERS

    • src — Series data to perform the calculation.

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

  • SEE ALSO

Wma


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

Creates a Color object by its RGB components and alpha channel.

  • 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 — Alpha channel (component) of color which ranges from 0.0 (fully transparent) to 1.0 (fully opaque).


Objects


AQUA

object

Built-in color.

  • TYPE

Color


BLACK

object

Built-in color.

  • TYPE

Color


BLUE

object

Built-in color.

  • TYPE

Color


FUCHSIA

object

Built-in color.

  • TYPE

Color


GRAY

object

Built-in color.

  • TYPE

Color


GREEN

object

Built-in color.

  • TYPE

Color


LIME

object

Built-in color.

  • TYPE

Color


MAROON

object

Built-in color.

  • TYPE

Color


object

Built-in color.

  • TYPE

Color


OLIVE

object

Built-in color.

  • TYPE

Color


PURPLE

object

Built-in color.

  • TYPE

Color


RED

object

Built-in color.

  • TYPE

Color


SILVER

object

Built-in color.

  • TYPE

Color


TEAL

object

Built-in color.

  • TYPE

Color


WHITE

object

Built-in color.

  • TYPE

Color


YELLOW

object

Built-in color.

  • TYPE

Color


Package indie.schedule

Schedule package that contains classes for working with schedules.

  • CONTENTS

ALL_DAYS Schedule ScheduleRule WeekDay WEEKEND WORKDAYS


Types


Schedule

type

Data type that manages a collection of scheduling rules, allowing for specific times and exceptions to be defined.

  • MEMBERS

__contains__() __init__() is_empty() is_same_period()

  • SEE ALSO

ScheduleRule


ScheduleRule

type

Data type to represent a rule for a schedule, specifying the start and end times, along with the weekdays when the rule is active.

  • MEMBERS

__init__()

  • EXAMPLE
# this rule applies from 9:00 AM to 6:30 PM (6:30 is not included) on weekdays (Monday through Friday).
rule = ScheduleRule(start=time(hour=9), end=time(hour=18, minute=30), days=WORKDAYS)
# this overnight_rule applies from 8:15 PM to 7:30 AM on weekdays (Monday through Friday).
overnight_rule = ScheduleRule(start=time(hour=20, minute=15), end=time(hour=7, minute=30), days=WORKDAYS)
  • REMARKS

For rules that span overnight (e.g., from 10:00 PM to 6:00 AM), the end time should be on the day listed in days, while the start time is understood to be on the previous day. This allows the rule to cover activities that occur late in the evening and extend into the early hours of the next day.

  • SEE ALSO

Schedule


WeekDay

type

Enum-like class with constants for days of week.

  • MEMBERS

FRIDAY MONDAY SATURDAY SUNDAY THURSDAY TUESDAY WEDNESDAY


Functions


Schedule.__contains__()

method

Checks whether a given timestamp falls within the defined schedule. Returns True if the timestamp falls within the schedule's active periods, otherwise returns False.

  • SIGNATURES
__contains__(float) -> bool
__contains__(datetime.datetime) -> bool
  • PARAMETERS

    • <unnamed param> — Timestamp to check in defined schedule.

    • <unnamed param> — Datetime to check in defined schedule.

  • SEE ALSO

Schedule


Schedule.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(
  rules: list[indie.schedule.ScheduleRule],
  except_once: list[datetime.datetime] = [],
  except_yearly: list[datetime.datetime] = [],
  timezone: str = "UTC"
) -> NoneType
  • PARAMETERS

    • rules — List of ScheduleRule instances that define the active scheduling rules.

    • except_once — List of dates that are excluded from the schedule only once.

    • except_yearly — List of dates that are excluded from the schedule every year.

    • timezone — Timezone for schedule.

  • SEE ALSO

Schedule


Schedule.is_empty()

method

Checks if the rules list in Schedule is empty. Returns True if list of rules is empty; otherwise, returns False.

  • SIGNATURES
is_empty() -> bool
  • SEE ALSO

Schedule


Schedule.is_same_period()

method

Determines whether two timestamps fall within the same schedule period on the same day. Returns True if both timestamps fall within the same period of the schedule, even if they are in different calendar days. False if the timestamps belong to different periods within the schedule.

  • SIGNATURES
is_same_period(timestamp1: float, timestamp2: float) -> bool
  • PARAMETERS

    • timestamp1 — First timestamp to check.

    • timestamp2 — Second timestamp to check.

  • REMARKS

This method checks if two timestamps, which may belong to different calendar days, are part of the same schedule period. It handles cases where a schedule spans across two consecutive days (e.g., a trading schedule that extends past midnight) and ensures both timestamps belong to the same logical period within the schedule.

  • SEE ALSO

Schedule


ScheduleRule.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(
  start: datetime.time,
  end: datetime.time,
  days: list[int] = indie.schedule.ALL_DAYS
) -> NoneType
  • PARAMETERS

    • start — Start time of the rule.

    • end — End time of the rule.

    • days — List of weekdays when the rule is active.

  • SEE ALSO

ScheduleRule


TradingSession.__contains__()

method

Checks whether a given timestamp falls within the defined trading session. Returns True if the timestamp falls within the trading session's active periods, otherwise returns False.

  • SIGNATURES
__contains__(float) -> bool
__contains__(datetime.datetime) -> bool
  • PARAMETERS

    • <unnamed param> — Timestamp to check in defined trading session.

    • <unnamed param> — Datetime to check in defined trading session.

  • SEE ALSO

TradingSession


TradingSession.is_after_hours()

method

Determines whether a given timestamp falls within a after-hours trading session.

  • SIGNATURES
is_after_hours(timestamp: float) -> bool
  • PARAMETERS

    • timestamp — Timestamp to check against the specific part of trading sessions.
  • SEE ALSO

Context Schedule TradingSession


TradingSession.is_extended()

method

Determines whether a given timestamp falls within an extended trading session (either pre-market or after-hours).

  • SIGNATURES
is_extended(timestamp: float) -> bool
  • PARAMETERS

    • timestamp — Timestamp to check against the specific part of trading sessions.
  • REMARKS

Returns True if the provided timestamp falls within either the pre-market or after-hours session. Returns False otherwise.

  • SEE ALSO

Context Schedule TradingSession


TradingSession.is_pre_market()

method

Determines whether a given timestamp falls within a pre-market trading session.

  • SIGNATURES
is_pre_market(timestamp: float) -> bool
  • PARAMETERS

    • timestamp — Timestamp to check against the specific part of trading sessions.
  • SEE ALSO

Context Schedule TradingSession


TradingSession.is_regular()

method

Determines whether a given timestamp falls within a regular trading session.

  • SIGNATURES
is_regular(timestamp: float) -> bool
  • PARAMETERS

    • timestamp — Timestamp to check against the specific part of trading sessions.
  • SEE ALSO

Context Schedule TradingSession


TradingSession.is_same_period()

method

Determines whether two timestamps fall within the same trading session period on the same day. Returns True if both timestamps fall within the same period of the trading session, even if they are in different calendar days. False if the timestamps belong to different periods within the trading session.

  • SIGNATURES
is_same_period(timestamp1: float, timestamp2: float) -> bool
  • PARAMETERS

    • timestamp1 — First timestamp to check.

    • timestamp2 — Second timestamp to check.

  • REMARKS

This method checks if two timestamps, which may belong to different calendar days, are part of the same trading session period. It handles cases where a trading session spans across two consecutive days (e.g., a trading schedule that extends past midnight) and ensures both timestamps belong to the same logical period within the schedule.

  • SEE ALSO

TradingSession


Objects


ALL_DAYS

object

List of WeekDay's from WeekDay.MONDAY to WeekDay.SUNDAY

  • TYPE

list[int]


TradingSession.after_hours

field

Schedule instance that defines the rules and exceptions for the after-hours trading session.

  • TYPE

Schedule

  • SEE ALSO

Context Schedule TradingSession


TradingSession.extended

field

Schedule instance that defines the rules and exceptions for the extended session (pre-market + after-hours).

  • TYPE

Schedule

  • SEE ALSO

Context Schedule TradingSession


TradingSession.pre_market

field

Schedule instance that defines the rules and exceptions for the pre-market trading session.

  • TYPE

Schedule

  • SEE ALSO

Context Schedule TradingSession


TradingSession.regular

field

Schedule instance that defines the rules and exceptions for the regular trading session.

  • TYPE

Schedule

  • SEE ALSO

Context Schedule TradingSession


WEEKEND

object

List of WeekDay's from WeekDay.SATURDAY to WeekDay.SUNDAY

  • TYPE

list[int]


WORKDAYS

object

List of WeekDay's from WeekDay.MONDAY to WeekDay.FRIDAY

  • TYPE

list[int]


WeekDay.FRIDAY

static field

Built-in constants that represent days of week.

  • TYPE

WeekDay

  • SEE ALSO

WeekDay


WeekDay.MONDAY

static field

Built-in constants that represent days of week.

  • TYPE

WeekDay

  • SEE ALSO

WeekDay


WeekDay.SATURDAY

static field

Built-in constants that represent days of week.

  • TYPE

WeekDay

  • SEE ALSO

WeekDay


WeekDay.SUNDAY

static field

Built-in constants that represent days of week.

  • TYPE

WeekDay

  • SEE ALSO

WeekDay


WeekDay.THURSDAY

static field

Built-in constants that represent days of week.

  • TYPE

WeekDay

  • SEE ALSO

WeekDay


WeekDay.TUESDAY

static field

Built-in constants that represent days of week.

  • TYPE

WeekDay

  • SEE ALSO

WeekDay


WeekDay.WEDNESDAY

static field

Built-in constants that represent days of week.

  • TYPE

WeekDay

  • SEE ALSO

WeekDay


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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • 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's).

  • TYPE

float


nan

object

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

  • TYPE

float


pi

object

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

  • 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 time 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 time


time

type

Represents a time of day, independent of any particular day.

  • MEMBERS

__add__() __init__() __sub__() hour microsecond minute second

  • SEE ALSO

datetime timedelta


timedelta

type

A timedelta object represents a duration, the difference between two datetimes.

  • MEMBERS

__init__() days microseconds seconds total_seconds()

  • SEE ALSO

datetime time


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
) -> NoneType
  • 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


time.__add__()

method

+ operator for time objects.

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

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

time


time.__init__()

method

Class constructor (initializer for the data type).

  • SIGNATURES
__init__(
  hour: int = 0,
  minute: int = 0,
  second: int = 0,
  microsecond: int = 0
) -> NoneType
  • PARAMETERS

    • hour — Hour value.

    • minute — Minute value.

    • second — Second value.

    • microsecond — Microsecond value.

  • SEE ALSO

time


time.__sub__()

method

- operator for time objects.

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

    • delta — Timedelta to subtract from the current time.
  • SEE ALSO

time


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
) -> NoneType
  • 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


time.hour

field

The hour value of the time object.

  • TYPE

int

  • SEE ALSO

time


time.microsecond

field

The microsecond value of the time object.

  • TYPE

int

  • SEE ALSO

time


time.minute

field

The minute value of the time object.

  • TYPE

int

  • SEE ALSO

time


time.second

field

The second value of the time object.

  • TYPE

int

  • SEE ALSO

time


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's None type).


bool

type

Built-in Indie type (similar to Python's).

  • MEMBERS

__init__()


dict[K, V]

type

Built-in Indie type (similar to Python's).


float

type

Built-in Indie type (similar to Python's).

  • MEMBERS

__init__()


int

type

Built-in Indie type (similar to Python's).

  • MEMBERS

__init__()


list[T]

type

Built-in Indie type (similar to Python's).

  • MEMBERS

__add__() __bool__() __contains__() __delitem__() __delslice__() __getitem__() __getslice__() __len__() __mul__() __setitem__() __setslice__() append() clear() copy() extend() index() insert() pop() remove() reverse()

  • 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

Built-in Indie type (similar to Python's).

  • MEMBERS

__add__() __contains__() __getitem__() __init__() __len__() __mul__() capitalize() center() count() endswith() find() index() isalpha() islower() isspace() isupper() join() ljust() lower() lstrip() partition() replace() rfind() rindex() rjust() rpartition() rsplit() rstrip() split() startswith() strip() swapcase() upper()


tuple[...]

type

Built-in Indie type (similar to Python's).


Functions


Optional[T].__isnone__()

method

Returns True if the optional value is None, otherwise False.

  • SIGNATURES
__isnone__() -> bool
  • EXAMPLE
my_val: Optional[int] = 4
my_bool = my_val is None
  • REMARKS

Method __isnone__ should never be called directly, instead val is None syntax should be used.

  • SEE ALSO

Optional[T]


abs()

function

Returns the absolute value of a number. It is a built-in Indie function (similar to Python's).

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

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

bool.__init__()

method

Cast constructor for built-in Indie type. Returns a bool value, i.e. one of True or False. The argument is converted using the standard Python's truth testing procedure. If the argument is false or omitted, this returns False; otherwise, it returns True.

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

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

bool


float.__init__()

method

Cast constructor for built-in Indie type. Returns a float number constructed from a number or a string.

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

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

float


int.__init__()

method

Cast constructor for built-in Indie type. Returns an int object constructed from a number or a string, or return 0 if no arguments are given.

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

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

int


len()

function

Returns the length (the number of items) of an object. It is a built-in Indie function (similar to Python's).

  • SIGNATURES
len(typing.Any) -> int
  • PARAMETERS

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

list[T].__add__()

method

Returns a concatenation of two lists.

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

    • <unnamed param> — List to concatenate with the current.
  • EXAMPLE

nums1 = [40, 41]
nums2 = [42, 43]
nums3 = nums1 + nums2  # this implicitly calls `nums1.__add__(nums2)`
  • REMARKS

Method __add__ should never be called directly, instead list1 + list2 syntax should be used.

  • SEE ALSO

list[T]


list[T].__bool__()

method

Returns True if the list is not empty.

  • SIGNATURES
__bool__() -> bool
  • SEE ALSO

list[T]


list[T].__contains__()

method

Returns True if the list contains the given value, otherwise False.

  • SIGNATURES
__contains__(T) -> bool
  • PARAMETERS

    • <unnamed param> — Element to find in the list.
  • EXAMPLE

nums = [40, 41, 42, 43]
my_bool = 41 in nums  # this implicitly calls `nums.__contains__(41)`
  • REMARKS

Method __contains__ should never be called directly, instead val in lst syntax should be used.

  • SEE ALSO

list[T]


list[T].__delitem__()

method

Delete an item from the list at the given index.

  • SIGNATURES
__delitem__(int) -> NoneType
  • PARAMETERS

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

nums = [40, 41, 42, 43]
del nums[2]  # this implicitly calls `nums.__delitem__(2)`
  • REMARKS

Method __delitem__ should never be called directly, instead del list_obj[key] syntax should be used.

  • SEE ALSO

list[T]


list[T].__delslice__()

method

Delete a slice from the list.

  • SIGNATURES
__delslice__(
  start: indie.Optional[int] = None,
  stop: indie.Optional[int] = None,
  step: int = 1
) -> NoneType
  • PARAMETERS

    • start — Starting index for slice. Can be omitted. [See more examples here.](#class_builtin_list

    • stop — Ending index for slice (not included). Can be omitted. See more examples here.

    • step — Step between indexes of slice. Can be omitted. See more examples here.

  • EXAMPLE

nums = [40, 41, 42, 43]
del nums[0:2]  # this implicitly calls `nums.__delslice__(0, 2, 1)`
  • REMARKS

Method __delslice__ should never be called directly, instead del list_obj[slice] syntax should be used.

  • SEE ALSO

list[T]


list[T].__getitem__()

method

Returns list element at given index.

  • SIGNATURES
__getitem__(int) -> T
  • PARAMETERS

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

nums = [40, 41, 42, 43]
meaning_of_life = nums[2]  # returns 42 (this implicitly calls `nums.__getitem__(2)`)
  • REMARKS

Method __getitem__ should never be called directly, instead list_obj[key] syntax should be used.

  • SEE ALSO

list[T]


list[T].__getslice__()

method

Returns a slice of the list elements.

  • SIGNATURES
__getslice__(
  start: indie.Optional[int] = None,
  stop: indie.Optional[int] = None,
  step: int = 1
) -> list[T]
  • PARAMETERS

    • start — Starting index for slice. Can be omitted. [See more examples here.](#class_builtin_list

    • stop — Ending index for slice (not included). Can be omitted. See more examples here.

    • step — Step between indexes of slice. Can be omitted. See more examples here.

  • EXAMPLE

nums = [40, 41, 42, 43]
meaning_of_life = nums[1:3]  # returns [41, 42] (this implicitly calls `nums.__getslice__(1, 3, 1)`)
  • REMARKS

Method __getslice__ should never be called directly, instead list_obj[slice] syntax should be used.

  • SEE ALSO

list[T]


list[T].__len__()

method

Returns the length (the number of items) of a list[T].

  • SIGNATURES
__len__() -> int
  • EXAMPLE
nums = [40, 41, 42, 43]
len(nums)  # returns 4 (this implicitly calls `nums.__len__()`)
  • REMARKS

Method __len__ should never be called directly, instead len(list_obj) syntax should be used.

  • SEE ALSO

list[T]


list[T].__mul__()

method

Returns a concatenation of the list with n its copies.

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

    • <unnamed param> — How many copies of the list to concatenate.
  • EXAMPLE

nums1 = [40, 41]
nums2 = nums1 * 3  # this implicitly calls `nums1.__mul__(3)`
                   # and now `nums2` is [40, 41, 40, 41, 40, 41]
  • REMARKS

Method __mul__ should never be called directly, instead lst * n syntax should be used.

  • SEE ALSO

list[T]


list[T].__setitem__()

method

Assigns value to some_list[key].

  • 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.

  • EXAMPLE

nums = [40, 41, 42, 43]
nums[2] = 100500  # this implicitly calls `nums.__setitem__(2, 100500)`
                  # and now `nums` are [40, 41, 100500, 43]
  • REMARKS

Method __setitem__ should never be called directly, instead list_obj[key] = value syntax should be used.

  • SEE ALSO

list[T]


list[T].__setslice__()

method

Assigns given list to some_list[slice].

  • SIGNATURES
__setslice__(
  start: indie.Optional[int] = None,
  stop: indie.Optional[int] = None,
  step: int = 1,
  list[T]
) -> NoneType
  • PARAMETERS

    • start — Starting index for slice. Can be omitted. [See more examples here.](#class_builtin_list

    • stop — Ending index for slice (not included). Can be omitted. See more examples here.

    • step — Step between indexes of slice. Can be omitted. See more examples here.

    • <unnamed param> — List to get values from.

  • EXAMPLE

nums = [40, 41, 42, 43]
nums[1:3] = [50, 51, 52]  # this implicitly calls `nums.__setslice__(1, 3, 1, [50, 51, 52])`
                          # and now `nums` are [40, 50, 51, 52, 43]
  • REMARKS

Method __setslice__ should never be called directly, instead list_obj[slice] = other_list syntax should be used.

  • SEE ALSO

list[T]


list[T].append()

method

Appends given param to the end of the list.

  • SIGNATURES
append(T) -> NoneType
  • PARAMETERS

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

list[T]


list[T].clear()

method

Remove all items from the list.

  • SIGNATURES
clear() -> NoneType
  • EXAMPLE
nums = [40, 41, 42, 43]
nums.clear()  # now `nums` is []
  • SEE ALSO

list[T]


list[T].copy()

method

Returns a copy of the list.

  • SIGNATURES
copy() -> list[T]
  • SEE ALSO

list[T]


list[T].extend()

method

Extends the list by appending elements from the given list.

  • SIGNATURES
extend(list[T]) -> NoneType
  • PARAMETERS

    • <unnamed param> — List to concatenate with the current.
  • SEE ALSO

list[T]


list[T].index()

method

Returns index of the first occurrence of the item in the list. If not found returns -1.

  • SIGNATURES
index(T) -> int
  • PARAMETERS

    • <unnamed param> — Element to find in the list.
  • SEE ALSO

list[T]


list[T].insert()

method

Insert a value at the specified index.

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

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

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

  • EXAMPLE

nums = [40, 41, 42, 43]
nums.insert(2, 50)  # now `nums` are [40, 41, 50, 42, 43]
  • SEE ALSO

list[T]


list[T].pop()

method

Retrieves the item at given index and also removes it from the list.

  • SIGNATURES
pop() -> T
  • EXAMPLE
nums = [40, 41, 42, 43]
meaning_of_life = nums.pop(2)  # now `nums` are [40, 41, 43], `meaning_of_life` is 42
  • SEE ALSO

list[T]


list[T].remove()

method

Removes the first item from list s where s[i] is equal to given param.

  • SIGNATURES
remove(T) -> NoneType
  • PARAMETERS

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

nums = [40, 41, 42, 40, 41, 42]
nums.remove(42)  # now `nums` are [40, 41, 40, 41, 42]
  • SEE ALSO

list[T]


list[T].reverse()

method

Reverses the elements of the list in place.

  • SIGNATURES
reverse() -> NoneType
  • SEE ALSO

list[T]


max()

function

Returns the largest of two or more arguments. It is a built-in Indie function (similar to Python's).

  • SIGNATURES
max(int, int) -> int
max(int, int, int) -> int
max(float, float) -> float
max(float, float, float) -> float
max(list[int]) -> int
max(list[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.

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


min()

function

Returns the smallest of two or more arguments. It is a built-in Indie function (similar to Python's).

  • 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

Creates a list containing the specified range of numbers that is used in for loops. It is a built-in Indie function (similar to Python's).

  • 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.

  • EXAMPLE

x = 0
for i in range(10):
    x += i
  • REMARKS

The behavior of this function is similar to Python's 2 built-in function range and is ineffective. This will be fixed in future versions of Indie.


round()

function

Returns number rounded to ndigits precision after the decimal point. If ndigits is omitted or is None, it returns the nearest integer to its input. It is a built-in Indie function (similar to Python's).

  • 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.__add__()

method

Returns a concatenation of two strings.

  • SIGNATURES
__add__(str) -> str
  • PARAMETERS

    • <unnamed param> — String to concatenate with the current.
  • EXAMPLE

str1 = 'ab'
str2 = 'cf'
str3 = str1 + str2  # this implicitly calls `str1.__add__(str2)`
  • REMARKS

Method __add__ should never be called directly, instead str1 + str2 syntax should be used.

  • SEE ALSO

str


str.__contains__()

method

Returns True if the string contains the given substring, otherwise False.

  • SIGNATURES
__contains__(str) -> bool
  • PARAMETERS

    • <unnamed param> — Substring to find in the string.
  • EXAMPLE

my_bool = 'cd' in 'abcdef'  # this implicitly calls `'abcdef'.__contains__('cd')`
  • REMARKS

Method __contains__ should never be called directly, instead str1 in str2 syntax should be used.

  • SEE ALSO

str


str.__getitem__()

method

Returns substring at given index.

  • SIGNATURES
__getitem__(int) -> str
  • PARAMETERS

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

my_str = 'abc'
substr = my_str[1]  # returns "b" (this implicitly calls `my_str.__getitem__(1)`)
  • REMARKS

Method __getitem__ should never be called directly, instead my_str[key] syntax should be used.

  • SEE ALSO

str


str.__init__()

method

Cast constructor for built-in Indie type. Returns a str version of object.

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

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

str


str.__len__()

method

Returns the length (the number of characters) of a str.

  • SIGNATURES
__len__() -> int
  • EXAMPLE
s = 'foobar'
len(s)  # returns 6 (this implicitly calls `s.__len__()`)
  • REMARKS

Method __len__ should never be called directly, instead len(str_obj) syntax should be used.

  • SEE ALSO

str


str.__mul__()

method

Returns a concatenation of the string with n its copies.

  • SIGNATURES
__mul__(int) -> str
  • PARAMETERS

    • <unnamed param> — How many copies of the string to concatenate.
  • EXAMPLE

my_str = 'abc'
my_str2 = 'abc' * 3  # this implicitly calls `'abc'.__mul__(3)`
                     # and now `my_str2` is 'abcabcabc'
  • REMARKS

Method __mul__ should never be called directly, instead my_str * n syntax should be used.

  • SEE ALSO

str


str.capitalize()

method

Returns the string with the first letter capitalized.

  • SIGNATURES
capitalize() -> str
  • SEE ALSO

str


str.center()

method

Centers the string within the specified width using a fill character.

  • SIGNATURES
center(length: int, character: str = " ") -> str
  • PARAMETERS

    • length — Length of the result string.

    • character — Fill character.

  • SEE ALSO

str


str.count()

method

Returns the count of non-overlapping occurrences of a substring within [start, end].

  • SIGNATURES
count(value: str, start: int, end: int) -> int
  • PARAMETERS

    • value — Value to search for.

    • start — Start index to search.

    • end — End index to search.

  • SEE ALSO

str


str.endswith()

method

Returns True if the string ends with the suffix, otherwise False.

  • SIGNATURES
endswith(value: str, start: int, end: int) -> bool
  • PARAMETERS

    • value — Value to check if the end of the string equals.

    • start — Start index to check the end of the string.

    • end — End index to check the end of the string.

  • SEE ALSO

str


str.find()

method

Returns the lowest index where the substring is found.

  • SIGNATURES
find(value: str, start: int, end: int) -> int
  • PARAMETERS

    • value — Value to search for.

    • start — Start index for searching.

    • end — End index for searching.

  • REMARKS

Use the find() method to get the position of a substring. To check for its presence, use the in operator.

  • SEE ALSO

str


str.index()

method

Returns the lowest index of the substring within [start, end], raising an error if not found.

  • SIGNATURES
index(value: str, start: int, end: int) -> int
  • PARAMETERS

    • value — Value to search for.

    • start — Start index for searching.

    • end — End index for searching.

  • SEE ALSO

str


str.isalpha()

method

Returns True if the string contains only alphabetic characters and is not empty; otherwise, False.

  • SIGNATURES
isalpha() -> bool
  • SEE ALSO

str


str.islower()

method

Returns True if all cased characters are lowercase and there is at least one, otherwise False.

  • SIGNATURES
islower() -> bool
  • SEE ALSO

str


str.isspace()

method

Returns True if the string contains only whitespace and is not empty, otherwise False.

  • SIGNATURES
isspace() -> bool
  • SEE ALSO

str


str.isupper()

method

Returns True if all cased characters are uppercase and there is at least one, otherwise False.

  • SIGNATURES
isupper() -> bool
  • SEE ALSO

str


str.join()

method

Returns a string that joins the elements of the list, using the string as a separator.

  • SIGNATURES
join(list[str]) -> str
  • PARAMETERS

    • <unnamed param> — List of sctrings to join.
  • SEE ALSO

str


str.ljust()

method

Left justifies the string within the specified width, padding with the fill character. Returns the original string if width is less than or equal to its length.

  • SIGNATURES
ljust(length: int, character: str = " ") -> str
  • PARAMETERS

    • length — Length of the result string.

    • character — Fill character.

  • SEE ALSO

str


str.lower()

method

Returns a copy of the string with all cased characters in lowercase.

  • SIGNATURES
lower() -> str
  • SEE ALSO

str


str.lstrip()

method

Returns a copy of the string with leading characters removed.

  • SIGNATURES
lstrip(symbols: str = " ") -> str
  • PARAMETERS

    • symbols — Characters to remove.
  • SEE ALSO

str


str.partition()

method

Splits the string at the first occurrence of sep and returns a list with the parts before, the separator, and after.

  • SIGNATURES
partition(str) -> list[str]
  • PARAMETERS

    • <unnamed param> — String separator value.
  • SEE ALSO

str


str.replace()

method

Returns a copy of the string with all occurrences of old replaced by new, or the first count occurrences if specified.

  • SIGNATURES
replace(oldvalue: str, newvalue: str, count: int = -1) -> str
  • PARAMETERS

    • oldvalue — Old value to search.

    • newvalue — New value to replace with.

    • count — How many occurrences to replace.

  • SEE ALSO

str


str.rfind()

method

Returns the highest index of sub within [start, end], or -1 if not found.

  • SIGNATURES
rfind(value: str, start: int, end: int) -> int
  • PARAMETERS

    • value — Value to search for.

    • start — Start index for searching.

    • end — End index for searching.

  • SEE ALSO

str


str.rindex()

method

Returns the highest index of sub within [start, end], raising an error if not found.

  • SIGNATURES
rindex(value: str, start: int, end: int) -> int
  • PARAMETERS

    • value — Value to search for.

    • start — Start index for searching.

    • end — End index for searching.

  • SEE ALSO

str


str.rjust()

method

Right justifies the string within the specified width, padding with the fill character. Returns the original string if width is less than or equal to its length.

  • SIGNATURES
rjust(length: int, character: str = " ") -> str
  • PARAMETERS

    • length — Length of the result string.

    • character — Fill character.

  • SEE ALSO

str


str.rpartition()

method

Splits the string at the last occurrence of sep and returns a list with the parts before, the separator, and after.

  • SIGNATURES
rpartition(str) -> list[str]
  • PARAMETERS

    • <unnamed param> — String separator value.
  • SEE ALSO

str


str.rsplit()

method

Splits the string into words using sep as the delimiter, with an optional maxsplit from the right.

  • SIGNATURES
rsplit(separator: str = " ", maxsplit: int = -1) -> list[str]
  • PARAMETERS

    • separator — String separator value.

    • maxsplit — Number of splits.

  • SEE ALSO

str


str.rstrip()

method

Returns a copy of the string with trailing characters removed.

  • SIGNATURES
rstrip(symbols: str = " ") -> str
  • PARAMETERS

    • symbols — Characters to remove.
  • SEE ALSO

str


str.split()

method

Splits the string into words using sep as the delimiter, with at most maxsplit splits, resulting in up to maxsplit+1 elements.

  • SIGNATURES
split(separator: str = " ", maxsplit: int = -1) -> list[str]
  • PARAMETERS

    • separator — String separator value.

    • maxsplit — Number of splits.

  • SEE ALSO

str


str.startswith()

method

Returns True if string starts with the prefix, otherwise False.

  • SIGNATURES
startswith(value: str, start: int, end: int) -> bool
  • PARAMETERS

    • value — Value to check if the beginning of the string equals.

    • start — Start index to check the beginning of the string.

    • end — End index to check the beginning of the string.

  • SEE ALSO

str


str.strip()

method

Returns a string with the leading and trailing characters removed.

  • SIGNATURES
strip(symbols: str = " ") -> str
  • PARAMETERS

    • symbols — Characters to remove.
  • SEE ALSO

str


str.swapcase()

method

Returns a copy of the string with case swapped.

  • SIGNATURES
swapcase() -> str
  • SEE ALSO

str


str.upper()

method

Returns a copy of the string with all cased characters in uppercase.

  • SIGNATURES
upper() -> str
  • SEE ALSO

str


sum()

function

Sums start and the items of a list from left to right and returns the total. It is a built-in Indie function (similar to Python's).

  • 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.


Objects


False

object

Built-in Indie object (similar to Python's).

  • TYPE

bool


None

object

Built-in Indie object (similar to Python's).

  • TYPE

NoneType


True

object

Built-in Indie object (similar to Python's).

  • TYPE

bool