indie
Algorithm.__init__()
Color.__call__()
Context.calc_on()
Context.is_first_in_regular_session()
Context.is_first_in_session()
Context.is_last_in_regular_session()
Context.is_last_in_session()
Context.new_mut_series()
Context.new_mut_series_f()
Context.new_var()
Fill.__init__()
IndieError.__init__()
MutSeries[T].__setitem__()
MutSeries[T].calc()
MutSeries[T].new()
Optional[T].__bool__()
Optional[T].value()
Optional[T].value_or()
Plot.__init__()
Series[T].__getitem__()
Series[T].__len__()
Series[T].get()
Series[T].request_size()
TimeFrame.__init__()
TimeFrame.from_str()
TimeFrame.to_minutes()
Var[T].get()
Var[T].new()
Var[T].set()
tf()
Algorithm.ctx
Context.bar_count
Context.bar_index
Context.close
Context.high
Context.hl2
Context.hlc3
Context.info
Context.is_closed_bar
Context.is_history
Context.is_last_bar
Context.is_last_history_bar
Context.is_new_bar
Context.is_realtime
Context.low
Context.ohlc4
Context.open
Context.time
Context.time_frame
Context.trading_session
Context.volume
SymbolInfo.exchange_aliases
SymbolInfo.exchange_code
SymbolInfo.marketdata_timezone
SymbolInfo.price_precision
SymbolInfo.tick_size
SymbolInfo.ticker
SymbolInfo.timezone
format.INHERITED
format.PRICE
format.VOLUME
line_style.DASHED
line_style.DOTTED
line_style.SOLID
plot_style.COLUMNS
plot_style.HISTOGRAM
plot_style.LINE
plot_style.STEPS
source.CLOSE
source.HIGH
source.HL2
source.HLC3
source.LOW
source.OHLC4
source.OPEN
source.VOLUME
time_frame_unit.DAY
time_frame_unit.HOUR
time_frame_unit.MINUTE
time_frame_unit.MONTH
time_frame_unit.WEEK
indie.algorithms
Adx.__init__()
Adx.calc()
Adx.new()
Atr.__init__()
Atr.calc()
Atr.new()
Bb.__init__()
Bb.calc()
Bb.new()
Cci.__init__()
Cci.calc()
Cci.new()
Change.__init__()
Change.calc()
Change.new()
Corr.__init__()
Corr.calc()
Corr.new()
CumSum.__init__()
CumSum.calc()
CumSum.new()
Dev.__init__()
Dev.calc()
Dev.new()
Donchian.__init__()
Donchian.calc()
Donchian.new()
Ema.__init__()
Ema.calc()
Ema.new()
FixNan.__init__()
FixNan.calc()
FixNan.new()
Highest.__init__()
Highest.calc()
Highest.new()
LinReg.__init__()
LinReg.calc()
LinReg.new()
Lowest.__init__()
Lowest.calc()
Lowest.new()
Ma.__init__()
Ma.calc()
Ma.new()
Median.__init__()
Median.calc()
Median.new()
Mfv.__init__()
Mfv.calc()
Mfv.new()
NanToZero.__init__()
NanToZero.calc()
NanToZero.new()
NetVolume.__init__()
NetVolume.calc()
NetVolume.new()
PercentRank.__init__()
PercentRank.calc()
PercentRank.new()
Rma.__init__()
Rma.calc()
Rma.new()
Roc.__init__()
Roc.calc()
Roc.new()
Rsi.__init__()
Rsi.calc()
Rsi.new()
SinceHighest.__init__()
SinceHighest.calc()
SinceHighest.new()
SinceLowest.__init__()
SinceLowest.calc()
SinceLowest.new()
Sma.__init__()
Sma.calc()
Sma.new()
StdDev.__init__()
StdDev.calc()
StdDev.new()
Stoch.__init__()
Stoch.calc()
Stoch.new()
Sum.__init__()
Sum.calc()
Sum.new()
Supertrend.__init__()
Supertrend.calc()
Supertrend.new()
Tr.__init__()
Tr.calc()
Tr.new()
Tsi.__init__()
Tsi.calc()
Tsi.new()
Vwap.__init__()
Vwap.calc()
Vwap.new()
Vwma.__init__()
Vwma.calc()
Vwma.new()
Wma.__init__()
Wma.calc()
Wma.new()
indie.color
indie.schedule
math
statistics
datetime
Optional[T].__isnone__()
abs()
bool.__init__()
float.__init__()
int.__init__()
len()
list[T].__add__()
list[T].__bool__()
list[T].__contains__()
list[T].__delitem__()
list[T].__delslice__()
list[T].__getitem__()
list[T].__getslice__()
list[T].__len__()
list[T].__mul__()
list[T].__setitem__()
list[T].__setslice__()
list[T].append()
list[T].clear()
list[T].copy()
list[T].extend()
list[T].index()
list[T].insert()
list[T].pop()
list[T].remove()
list[T].reverse()
max()
min()
range()
round()
str.__add__()
str.__contains__()
str.__getitem__()
str.__init__()
str.__len__()
str.__mul__()
str.capitalize()
str.center()
str.count()
str.endswith()
str.find()
str.index()
str.isalpha()
str.islower()
str.isspace()
str.isupper()
str.join()
str.ljust()
str.lower()
str.lstrip()
str.partition()
str.replace()
str.rfind()
str.rindex()
str.rjust()
str.rpartition()
str.rsplit()
str.rstrip()
str.split()
str.startswith()
str.strip()
str.swapcase()
str.upper()
sum()
indieMain package of Indie language.
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
Algorithmtype
Base class for the classes that perform some processing of series data.
Colortype
Data type to represent color.
Contexttype
Data type that represents an instrument with OHLCV series values and other related information.
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
MainContext SecContext SymbolInfo Series[T]
Filltype
Class that represents a fill object.
IndieErrortype
Data type for Indie errors.
MainContexttype
Base class for the class that represents main context.
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
MutSeriesFtype
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].
__getitem__() __len__() __setitem__() calc() get() new() request_size()
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.
__getitem__() __len__() __setitem__() calc() get() new() request_size()
Context.new_mut_series() Series[T] SeriesF MutSeriesF Context
Optional[T]type
Builtin Indie type (similar to Python's typing.Optional).
__bool__() __isnone__() value() value_or()
Plottype
Class that represents a plot object.
SecContexttype
Base class for the classes that represent additional contexts besides the main one.
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
SeriesFtype
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].
__getitem__() __len__() get() request_size()
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.
__getitem__() __len__() get() request_size()
SeriesF MutSeries[T] MutSeriesF Context
SymbolInfotype
Data type to represent information about the context's instrument.
exchange_aliases exchange_code marketdata_timezone price_precision tick_size ticker timezone
TimeFrametype
Data type that represents time frame.
__init__() from_str() to_minutes()
Use tf() to create TimeFrame instances.
TradingSessiontype
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.
__contains__() after_hours extended is_after_hours() is_extended() is_pre_market() is_regular() is_same_period() pre_market regular
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.
Context.new_var() Series[T] Context
formattype
Enum-like class with constants that determine how to format the indicator value on the price scale.
line_styletype
Enum-like class with constants of line styles.
paramtype
Class with decorators of indicator input parameters of various types.
@bool() @float() @int() @source() @str() @string() @time_frame()
plot_styletype
Enum-like class with constants of plot styles.
sourcetype
Enum-like class with constants for various price sources (it is used in @indie.param.source).
CLOSE HIGH HL2 HLC3 LOW OHLC4 OPEN VOLUME
time_frame_unittype
Enum-like class with constants for time frame units.
@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.
@algorithm() -> NoneType
Most of the functions in the indie.algorithms package are decorated with @indie.algorithm decorator. Read more about it in Series processors chapter.
@band()decorator
Use this decorator to add a band (two horizontal lines usually with a semi-transparent fill in between them) to indicator.
@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]
@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.
@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()
More info about fills (for example about multicolored ones) could be found in Fills, levels and bands chapter.
@indicator()decorator
Decorator that should be applied to the Main entry point of any indicator.
@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.
@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]
@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.
@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...
@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.
@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...
@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.
@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...
@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.
@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...
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.
@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.
@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...
If options parameter is used then in Settings panel there will be a combobox widget for changing value of this input.
@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.
@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...
If options parameter is used then in Settings panel there will be a combobox widget for changing value of this input.
@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.
@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...
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.
@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.
@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]
@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.
@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]
@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.
@sec_context() -> NoneType
# 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]
More info on this topic you can find in Request additional instruments chapter.
@indicator() Context Context.calc_on()
Algorithm.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Color.__call__()method
Creates a new Color instance with the given transparency applied to the existing color.
__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)`
Method __call__ should never be called directly, instead color_obj(value) syntax should be used.
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.
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.
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.
is_first_in_regular_session() -> bool
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).
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.
is_first_in_session() -> bool
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).
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.
is_last_in_regular_session() -> bool
The function will return False if the session ends without a valid last bar (e.g., due to missing data).
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.
is_last_in_session() -> bool
The function will return False if the session ends without a valid last bar (e.g., due to missing data).
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).
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).
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
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.
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).
__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
IndieError.__init__()method
Class constructor (initializer for the data type).
__init__(msg: str) -> NoneType
PARAMETERS
msg — Error message.SEE ALSO
MutSeries[T].__setitem__()method
Sets value of MutSeries[T] object at the specified index.
__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)`
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.
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.
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).
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.
__bool__() -> bool
This method is present for Optional[T] only if T can be converted to bool.
Optional[T].value()method
Returns value of indie.Optional[T] object. Raises a runtime error if the optional object is None.
value() -> T
Optional[T].value_or()method
Returns value of indie.Optional[T] object or given default if the optional object is None.
value_or(default: T) -> T
PARAMETERS
default — Default value that will be used if there is no value.SEE ALSO
Plot.__init__()method
Class constructor (initializer for the data type).
__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
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).
__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)`
Method __getitem__ should never be called directly. Instead syntax series_obj[index] should be used.
Series[T].__len__()method
Returns length (number of elements) of a Series[T] object.
__len__() -> int
l = len(self.close) # this implicitly calls `self.close.__len__()`
Method __len__ should never be called directly. Instead syntax len(series_obj) should be used.
Series[T].get()method
Returns value of Series[T] object at the specified index or given default if the value is missing.
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
Series[T].request_size()method
Expands the capacity of Series[T] object (number of elements that Series[T] object should store in memory).
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
TimeFrame.__init__()method
Class constructor (initializer for the data type).
__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.
from_str(tf_str: str) -> indie.TimeFrame
PARAMETERS
tf_str — String representation of time frame.SEE ALSO
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.
to_minutes() -> int
TimeFrame.from_str() TimeFrame
Var[T].get()method
Returns value of Var[T] object.
get() -> 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.
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.
set(T) -> NoneType
PARAMETERS
<unnamed param> — New value that will be put to Var object.SEE ALSO
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.
tf(s: str) -> indie.TimeFrame
PARAMETERS
s — String representation of time frame.SEE ALSO
Algorithm.ctxfield
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.
Context.bar_countfield
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.
Context.bar_indexfield
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.
Context.closefield
Series of 'close' prices of the context's instrument.
Context.highfield
Series of 'high' prices of the context's instrument.
Context.hl2field
Series of '(high + low) / 2' values of the context's instrument.
Context.hlc3field
Series of '(high + low + close) / 3' values of the context's instrument.
Context.infofield
Information about the context's instrument.
Context.is_closed_barfield
Flag that is True if the current bar is a historical bar or it is a final update for a realtime bar.
Context.is_historyfield
Flag that is True if the current bar is a historical bar.
Context.is_last_barfield
Flag that is True if the current bar is the last bar in the history or it is a realtime bar.
Context.is_last_history_barfield
Flag that is True if the current bar is the last bar of the historical part of prices data.
Context.is_new_barfield
Flag that is True if the current bar is a historical bar or it is a first update for a realtime bar.
Context.is_realtimefield
Flag that is True if the last (current) bar is a realtime bar.
Context.lowfield
Series of 'low' prices of the context's instrument.
Context.ohlc4field
Series of '(open + high + low + close) / 4' values of the context's instrument.
Context.openfield
Series of 'open' prices of the context's instrument.
Context.timefield
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.
Context.time_framefield
Time frame of the context's instrument.
Context.trading_sessionfield
Trading session of the context's instrument.
Context.volumefield
Series of 'volume' values of the context's instrument.
SymbolInfo.exchange_aliasesfield
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).
SymbolInfo.exchange_codefield
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'.
SymbolInfo.marketdata_timezonefield
[deprecated] Name of the exchange timezone of the context's instrument. For example, 'America/New_York'.
SymbolInfo.price_precisionfield
Price precision of the context's instrument. For example, price precision of 100 means that prices have two digits after the floating point.
SymbolInfo.tick_sizefield
Absolute value of a minimal movement of a price of the context's instrument in corresponding currency.
SymbolInfo.tickerfield
Ticker of the context's instrument.
SymbolInfo.timezonefield
Name of the exchange timezone of the context's instrument. For example, 'America/New_York'.
format.INHERITEDstatic field
Indicator output values are formatted same as values of the main chart instrument.
format.PRICEstatic 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.
format.VOLUMEstatic 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.
line_style.DASHEDstatic field
Built-in line style constant that determines how the line is rendered.
line_style.DOTTEDstatic field
Built-in line style constant that determines how the line is rendered.
line_style.SOLIDstatic field
Built-in line style constant that determines how the line is rendered.
plot_style.COLUMNSstatic field
Built-in plot style constant that determines how the plot data is rendered.
plot_style.HISTOGRAMstatic field
Built-in plot style constant that determines how the plot data is rendered.
plot_style.LINEstatic field
Built-in plot style constant that determines how the plot data is rendered.
plot_style.STEPSstatic field
Built-in plot style constant that determines how the plot data is rendered.
source.CLOSEstatic field
Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.
source.HIGHstatic field
Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.
source.HL2static field
Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.
source.HLC3static field
Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.
source.LOWstatic field
Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.
source.OHLC4static field
Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.
source.OPENstatic field
Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.
source.VOLUMEstatic field
Built-in source kind constant which corresponds to Context's series field and is used to initialize source input parameter.
time_frame_unit.DAYstatic field
Built-in constants that represent time frame units.
time_frame_unit.HOURstatic field
Built-in constants that represent time frame units.
time_frame_unit.MINUTEstatic field
Built-in constants that represent time frame units.
time_frame_unit.MONTHstatic field
Built-in constants that represent time frame units.
time_frame_unit.WEEKstatic field
Built-in constants that represent time frame units.
indie.algorithmsAlgorithms package of Indie language.
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
Adxtype
Average directional index algorithm. Read here about how to use it.
# 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
# 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]
Atrtype
Average true range algorithm. Read here about how to use it.
# 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)
# 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]
Bbtype
Bollinger bands algorithm. Read here about how to use it.
# 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)
# 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]
Ccitype
Commodity channel index algorithm. Read here about how to use it.
# 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)
# 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]
Changetype
Algorithm to calculate change of a series of values. Read here about how to use it.
# 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])
# 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]
Corrtype
Correlation coefficient algorithm. Read here about how to use it.
# 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)
# 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]
CumSumtype
Cumulative sum algorithm. Read here about how to use it.
# 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
# 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]
Devtype
Mean absolute deviation algorithm. Read here about how to use it.
# 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)
# 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]
Donchiantype
Donchian channels algorithm. Read here about how to use it.
# 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)
# 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]
Ematype
Exponential moving average algorithm. Read here about how to use it.
# 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)
# 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]
FixNantype
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.
# 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
# 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]
Highesttype
Algorithm that returns the maximum value over a given period. Read here about how to use it.
# 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)
# 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]
LinRegtype
Linear regression algorithm. Read here about how to use it.
# 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)
# 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]
Lowesttype
Algorithm that returns the minimum value over a given period. Read here about how to use it.
# 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)
# 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]
Matype
Moving average algorithm. Read here about how to use it.
# 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()
# 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]
Mediantype
Moving median algorithm. Read here about how to use it.
# 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)
# 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]
Mfvtype
Money flow volume algorithm. Read here about how to use it.
# 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)
# indie:lang_version = 4
from indie import indicator
from indie.algorithms import Mfv
@indicator('Example')
def Main(self):
mfv = Mfv.new()
return mfv[0]
NanToZerotype
Algorithm that replaces all math.nan values with zeros in a series. Read here about how to use it.
# 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)
# 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]
NetVolumetype
Net volume algorithm. Read here about how to use it.
# 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
# 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]
PercentRanktype
Percent rank algorithm. Read here about how to use it.
# 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)
# 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]
Rmatype
RMA algorithm is a moving average algorithm that is used to calculate RSI. Read here about how to use it.
# 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
# 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]
Roctype
Rate of change algorithm. Read here about how to use it.
# 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)
# 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]
Rsitype
Relative strength index algorithm. Read here about how to use it.
# 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)
# 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]
SinceHighesttype
Read here about how to use it.
# 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)
# 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]
SinceLowesttype
Read here about how to use it.
# 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)
# 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]
Smatype
Simple moving average algorithm. Read here about how to use it.
# 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)
# 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]
StdDevtype
Standard deviation algorithm. Read here about how to use it.
# 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_))
# 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]
Stochtype
Stochastic algorithm. Read here about how to use it.
# 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)
# 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]
Sumtype
Sliding sum algorithm. Read here about how to use it.
# 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)
# 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]
Supertrendtype
Supertrend algorithm. Read here about how to use it.
# 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)
# 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)
Trtype
True range algorithm. Read here about how to use it.
# 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)
# indie:lang_version = 4
from indie import indicator
from indie.algorithms import Tr
@indicator('Example')
def Main(self):
tr = Tr.new()
return tr[0]
Tsitype
True strength index algorithm. Read here about how to use it.
# 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)
# 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]
Vwaptype
Volume weighted average price algorithm. Read here about how to use it.
# 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
# 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]
Vwmatype
Volume weighted moving average algorithm. Read here about how to use it.
# 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)
# 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]
Wmatype
Weighted moving average algorithm. Read here about how to use it.
# 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)
# 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]
Adx.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Adx.calc()method
Returns series of Minus Directional Indicator, Average Directional Index and Plus Directional Indicator.
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.new()static method
Returns series of Minus Directional Indicator, Average Directional Index and Plus Directional Indicator.
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
Atr.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Atr.calc()method
Returns series of Average True Range values calculated for the length bars period using moving average specified by ma_algorithm argument.
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.new()static method
Returns series of Average True Range values calculated for the length bars period using moving average specified by ma_algorithm argument.
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
Bb.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Bb.calc()method
Returns middle, upper and lower series of Bollinger Bands calculated on src series for the length bars period.
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.new()static method
Returns middle, upper and lower series of Bollinger Bands calculated on src series for the length bars period.
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
Cci.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Cci.calc()method
Returns series of Commodity Channel Index values calculated on src series for the length bars period.
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.new()static method
Returns series of Commodity Channel Index values calculated on src series for the length bars period.
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
Change.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Change.calc()method
Returns the difference between current src value and its value length bars ago.
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.new()static method
Returns the difference between current src value and its value length bars ago.
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
Corr.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Corr.calc()method
Returns series of Correlation Coefficient values calculated from x and y series for the length bars period.
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.new()static method
Returns series of Correlation Coefficient values calculated from x and y series for the length bars period.
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
CumSum.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
CumSum.calc()method
Returns series of cumulative sum of src values.
calc(src: indie.Series[float]) -> indie.Series[float]
PARAMETERS
src — Series data to perform the calculation.SEE ALSO
CumSum.new()static method
Returns series of cumulative sum of src values.
new(src: indie.Series[float]) -> indie.Series[float]
PARAMETERS
src — Series data to perform the calculation.SEE ALSO
Dev.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Dev.calc()method
Returns series of Mean Absolute Deviation values calculated on src series for the length bars period.
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.new()static method
Returns series of Mean Absolute Deviation values calculated on src series for the length bars period.
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
Donchian.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Donchian.calc()method
Returns series of Middle Channel of Donchian Channels calculated for the length bars period.
calc(length: int) -> indie.Series[float]
PARAMETERS
length — Number of bars in calculation taken into account.SEE ALSO
Donchian.new()static method
Returns series of Middle Channel of Donchian Channels calculated for the length bars period.
new(length: int) -> indie.Series[float]
PARAMETERS
length — Number of bars in calculation taken into account.SEE ALSO
Ema.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Ema.calc()method
Returns series of Exponential Moving Average values calculated on src series for the length bars period.
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.new()static method
Returns series of Exponential Moving Average values calculated on src series for the length bars period.
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
FixNan.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
FixNan.calc()method
Returns series created from src by replacing math.nan values with previous nearest non-nan value.
calc(src: indie.Series[float]) -> indie.Series[float]
PARAMETERS
src — Series data to perform the calculation.SEE ALSO
FixNan.new()static method
Returns series created from src by replacing math.nan values with previous nearest non-nan value.
new(src: indie.Series[float]) -> indie.Series[float]
PARAMETERS
src — Series data to perform the calculation.SEE ALSO
Highest.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Highest.calc()method
Returns maximum value of given src series over a period of length bars.
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.new()static method
Returns maximum value of given src series over a period of length bars.
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
LinReg.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
LinReg.calc()method
Returns series of Linear Regression Curve values calculated on src series for the length bars period (with possible offset offset).
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.new()static method
Returns series of Linear Regression Curve values calculated on src series for the length bars period (with possible offset offset).
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
Lowest.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Lowest.calc()method
Returns minimum value of given src series over a period of length bars.
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.new()static method
Returns minimum value of given src series over a period of length bars.
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
Ma.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Ma.calc()method
Returns a moving average of src specified by algorithm argument.
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.new()static method
Returns a moving average of src specified by algorithm argument.
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
Median.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Median.calc()method
Returns series of Moving Median values calculated from series of src for the length bars period.
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.new()static method
Returns series of Moving Median values calculated from series of src for the length bars period.
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
Mfv.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Mfv.calc()method
Returns series of Money Flow Volume.
calc() -> indie.Series[float]
Mfv.new()static method
Returns series of Money Flow Volume.
new() -> indie.Series[float]
NanToZero.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
NanToZero.calc()method
Returns series created from src by replacing math.nan values with zeros.
calc(src: indie.Series[float]) -> indie.Series[float]
PARAMETERS
src — Series data to perform the calculation.SEE ALSO
NanToZero.new()static method
Returns series created from src by replacing math.nan values with zeros.
new(src: indie.Series[float]) -> indie.Series[float]
PARAMETERS
src — Series data to perform the calculation.SEE ALSO
NetVolume.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
NetVolume.calc()method
Returns series of Net Volume values calculated on src series.
calc(src: indie.Series[float]) -> indie.Series[float]
PARAMETERS
src — Series data to perform the calculation.SEE ALSO
NetVolume.new()static method
Returns series of Net Volume values calculated on src series.
new(src: indie.Series[float]) -> indie.Series[float]
PARAMETERS
src — Series data to perform the calculation.SEE ALSO
PercentRank.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
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.
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.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.
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.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Rma.calc()method
Returns a Moving Average that is used in calculations of Rsi.
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.new()static method
Returns a Moving Average that is used in calculations of Rsi.
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.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
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.
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.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.
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.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Rsi.calc()method
Returns series of Relative Strength Index values calculated on src series for the length bars period.
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.new()static method
Returns series of Relative Strength Index values calculated on src series for the length bars period.
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.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
SinceHighest.calc()method
Returns the number of bars after the maximum price for the length bars period.
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.new()static method
Returns the number of bars after the maximum price for the length bars period.
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.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
SinceLowest.calc()method
Returns the number of bars after the minimum price for the length bars period.
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.new()static method
Returns the number of bars after the minimum price for the length bars period.
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.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Sma.calc()method
Returns series of Simple Moving Average values calculated from series of src for the length bars period.
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.new()static method
Returns series of Simple Moving Average values calculated from series of src for the length bars period.
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.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
StdDev.calc()method
Returns series of Standard Deviation values calculated from series of src for the length bars period.
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.new()static method
Returns series of Standard Deviation values calculated from series of src for the length bars period.
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
Stoch.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
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.
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.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.
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
Sum.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Sum.calc()method
Returns series of Sliding Sum values calculated on src series for the length bars period.
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.new()static method
Returns series of Sliding Sum values calculated on src series for the length bars period.
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
Supertrend.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Supertrend.calc()method
Returns a tuple of two Supertrend series: Supertrend Line and Direction Of Trend.
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.new()static method
Returns a tuple of two Supertrend series: Supertrend Line and Direction Of Trend.
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
Tr.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Tr.calc()method
Returns series of True Range values.
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.new()static method
Returns series of True Range values.
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
Tsi.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Tsi.calc()method
Returns series of True Strength Index values.
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.new()static method
Returns series of True Strength Index values.
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
Vwap.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Vwap.calc()method
Returns series of Volume Weighted Average Price values with band of its standard deviation.
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.new()static method
Returns series of Volume Weighted Average Price values with band of its standard deviation.
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
Vwma.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Vwma.calc()method
Returns series of Volume Weighted Moving Average values calculated for src series for the length bars period.
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.new()static method
Returns series of Volume Weighted Moving Average values calculated for src series for the length bars period.
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.__init__()method
Class constructor (initializer for the data type).
__init__(ctx: indie.Context) -> NoneType
PARAMETERS
ctx — Context object.SEE ALSO
Wma.calc()method
Returns series of Weighted Moving Average values calculated for src series for the length bars period.
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.new()static method
Returns series of Weighted Moving Average values calculated for src series for the length bars period.
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
indie.colorClass-container for builtin colors and rgba function.
AQUA BLACK BLUE FUCHSIA GRAY GREEN LIME MAROON NAVY OLIVE PURPLE RED rgba() SILVER TEAL WHITE YELLOW
rgba()function
Creates a Color object by its RGB components and alpha channel.
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).
AQUAobject
Built-in color.
BLACKobject
Built-in color.
BLUEobject
Built-in color.
FUCHSIAobject
Built-in color.
GRAYobject
Built-in color.
GREENobject
Built-in color.
LIMEobject
Built-in color.
MAROONobject
Built-in color.
NAVYobject
Built-in color.
OLIVEobject
Built-in color.
PURPLEobject
Built-in color.
REDobject
Built-in color.
SILVERobject
Built-in color.
TEALobject
Built-in color.
WHITEobject
Built-in color.
YELLOWobject
Built-in color.
indie.scheduleSchedule package that contains classes for working with schedules.
ALL_DAYS Schedule ScheduleRule WeekDay WEEKEND WORKDAYS
Scheduletype
Data type that manages a collection of scheduling rules, allowing for specific times and exceptions to be defined.
__contains__() __init__() is_empty() is_same_period()
ScheduleRuletype
Data type to represent a rule for a schedule, specifying the start and end times, along with the weekdays when the rule is active.
# 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)
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.
WeekDaytype
Enum-like class with constants for days of week.
FRIDAY MONDAY SATURDAY SUNDAY THURSDAY TUESDAY WEDNESDAY
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.
__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.__init__()method
Class constructor (initializer for the data type).
__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.is_empty()method
Checks if the rules list in Schedule is empty. Returns True if list of rules is empty; otherwise, returns False.
is_empty() -> bool
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.
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.
ScheduleRule.__init__()method
Class constructor (initializer for the data type).
__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
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.
__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.is_after_hours()method
Determines whether a given timestamp falls within a after-hours trading session.
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).
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.
Context Schedule TradingSession
TradingSession.is_pre_market()method
Determines whether a given timestamp falls within a pre-market trading session.
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.
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.
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.
ALL_DAYSobject
List of WeekDay's from WeekDay.MONDAY to WeekDay.SUNDAY
TradingSession.after_hoursfield
Schedule instance that defines the rules and exceptions for the after-hours trading session.
Context Schedule TradingSession
TradingSession.extendedfield
Schedule instance that defines the rules and exceptions for the extended session (pre-market + after-hours).
Context Schedule TradingSession
TradingSession.pre_marketfield
Schedule instance that defines the rules and exceptions for the pre-market trading session.
Context Schedule TradingSession
TradingSession.regularfield
Schedule instance that defines the rules and exceptions for the regular trading session.
Context Schedule TradingSession
WEEKENDobject
List of WeekDay's from WeekDay.SATURDAY to WeekDay.SUNDAY
WORKDAYSobject
List of WeekDay's from WeekDay.MONDAY to WeekDay.FRIDAY
WeekDay.FRIDAYstatic field
Built-in constants that represent days of week.
WeekDay.MONDAYstatic field
Built-in constants that represent days of week.
WeekDay.SATURDAYstatic field
Built-in constants that represent days of week.
WeekDay.SUNDAYstatic field
Built-in constants that represent days of week.
WeekDay.THURSDAYstatic field
Built-in constants that represent days of week.
WeekDay.TUESDAYstatic field
Built-in constants that represent days of week.
WeekDay.WEDNESDAYstatic field
Built-in constants that represent days of week.
mathMath package.
acos() asin() atan() ceil() cos() e exp() exp2() floor() isclose() isnan() log() log10() log2() nan pi pow() sin() sqrt() tan()
See description in the official Python docs.
acos()function
Standard function of Indie math package (similar to Python's).
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).
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).
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).
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).
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).
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).
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).
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).
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).
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).
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).
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).
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).
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).
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).
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).
tan(float) -> float
PARAMETERS
<unnamed param> — Number on which the function will be calculated.
eobject
Standard constant of Indie math package (similar to Python's).
nanobject
Standard constant of Indie math package (similar to Python's).
piobject
Standard constant of Indie math package (similar to Python's).
statisticsStatistics package.
See description in the official Python docs.
fmean()function
Standard statistics function.
fmean(data: list[float]) -> float
PARAMETERS
data — List on which the function will be calculated.
mean()function
Standard statistics function.
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.
median(data: list[float]) -> float
PARAMETERS
data — List on which the function will be calculated.
datetimeThe datetime package supplies classes for manipulating dates and times.
See description in the official Python docs.
datetimetype
Represents date and time information.
__add__() __init__() __sub__() day hour microsecond minute month second utcfromtimestamp() weekday() year
timetype
Represents a time of day, independent of any particular day.
__add__() __init__() __sub__() hour microsecond minute second
timedeltatype
A timedelta object represents a duration, the difference between two datetimes.
__init__() days microseconds seconds total_seconds()
datetime.__add__()method
+ operator for datetime objects.
__add__(delta: datetime.timedelta) -> datetime.datetime
PARAMETERS
delta — Timedelta to add to the current datetime.SEE ALSO
datetime.__init__()method
Class constructor (initializer for the data type).
__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.__sub__()method
- operator for datetime objects.
__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.utcfromtimestamp()static method
Returns the UTC datetime corresponding to the POSIX timestamp.
utcfromtimestamp(timestamp: float) -> datetime.datetime
PARAMETERS
timestamp — Timestamp in UTC.SEE ALSO
datetime.weekday()method
Returns the day of the week as an integer, where Monday is 0 and Sunday is 6.
weekday() -> int
time.__add__()method
+ operator for time objects.
__add__(delta: datetime.timedelta) -> datetime.datetime
PARAMETERS
delta — Timedelta to add to the current time.SEE ALSO
time.__init__()method
Class constructor (initializer for the data type).
__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.__sub__()method
- operator for time objects.
__sub__(delta: datetime.timedelta) -> datetime.datetime
PARAMETERS
delta — Timedelta to subtract from the current time.SEE ALSO
timedelta.__init__()method
Class constructor (initializer for the data type).
__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.total_seconds()method
Returns the total number of seconds contained in the duration.
total_seconds() -> float
datetime.dayfield
The day value of the datetime object.
datetime.hourfield
The hour value of the datetime object.
datetime.microsecondfield
The microsecond value of the datetime object.
datetime.minutefield
The minute value of the datetime object.
datetime.monthfield
The month value of the datetime object.
datetime.secondfield
The second value of the datetime object.
datetime.yearfield
The year value of the datetime object.
time.hourfield
The hour value of the time object.
time.microsecondfield
The microsecond value of the time object.
time.minutefield
The minute value of the time object.
time.secondfield
The second value of the time object.
timedelta.daysfield
The days value of the timedelta object.
timedelta.microsecondsfield
The microseconds value of the timedelta object.
timedelta.secondsfield
The seconds value of the timedelta object.
NoneTypetype
Builtin Indie type (similar to Python's None type).
booltype
Built-in Indie type (similar to Python's).
dict[K, V]type
Built-in Indie type (similar to Python's).
floattype
Built-in Indie type (similar to Python's).
inttype
Built-in Indie type (similar to Python's).
list[T]type
Built-in Indie type (similar to Python's).
__add__() __bool__() __contains__() __delitem__() __delslice__() __getitem__() __getslice__() __len__() __mul__() __setitem__() __setslice__() append() clear() copy() extend() index() insert() pop() remove() reverse()
# 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]`
strtype
Built-in Indie type (similar to Python's).
__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).
Optional[T].__isnone__()method
Returns True if the optional value is None, otherwise False.
__isnone__() -> bool
my_val: Optional[int] = 4
my_bool = my_val is None
Method __isnone__ should never be called directly, instead val is None syntax should be used.
abs()function
Returns the absolute value of a number. It is a built-in Indie function (similar to Python's).
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.
__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
float.__init__()method
Cast constructor for built-in Indie type. Returns a float number constructed from a number or a string.
__init__(float) -> NoneType
__init__(int) -> NoneType
__init__(str) -> NoneType
__init__(bool) -> NoneType
PARAMETERS
<unnamed param> — Value to cast from.SEE ALSO
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.
__init__(int) -> NoneType
__init__(float) -> NoneType
__init__(str) -> NoneType
__init__(bool) -> NoneType
PARAMETERS
<unnamed param> — Value to cast from.SEE ALSO
len()function
Returns the length (the number of items) of an object. It is a built-in Indie function (similar to Python's).
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.
__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)`
Method __add__ should never be called directly, instead list1 + list2 syntax should be used.
list[T].__bool__()method
Returns True if the list is not empty.
__bool__() -> bool
list[T].__contains__()method
Returns True if the list contains the given value, otherwise False.
__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)`
Method __contains__ should never be called directly, instead val in lst syntax should be used.
list[T].__delitem__()method
Delete an item from the list at the given index.
__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)`
Method __delitem__ should never be called directly, instead del list_obj[key] syntax should be used.
list[T].__delslice__()method
Delete a slice from the list.
__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)`
Method __delslice__ should never be called directly, instead del list_obj[slice] syntax should be used.
list[T].__getitem__()method
Returns list element at given index.
__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)`)
Method __getitem__ should never be called directly, instead list_obj[key] syntax should be used.
list[T].__getslice__()method
Returns a slice of the list elements.
__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)`)
Method __getslice__ should never be called directly, instead list_obj[slice] syntax should be used.
list[T].__len__()method
Returns the length (the number of items) of a list[T].
__len__() -> int
nums = [40, 41, 42, 43]
len(nums) # returns 4 (this implicitly calls `nums.__len__()`)
Method __len__ should never be called directly, instead len(list_obj) syntax should be used.
list[T].__mul__()method
Returns a concatenation of the list with n its copies.
__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]
Method __mul__ should never be called directly, instead lst * n syntax should be used.
list[T].__setitem__()method
Assigns value to some_list[key].
__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]
Method __setitem__ should never be called directly, instead list_obj[key] = value syntax should be used.
list[T].__setslice__()method
Assigns given list to some_list[slice].
__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]
Method __setslice__ should never be called directly, instead list_obj[slice] = other_list syntax should be used.
list[T].append()method
Appends given param to the end of the list.
append(T) -> NoneType
PARAMETERS
<unnamed param> — New value that will be put to the list.SEE ALSO
list[T].clear()method
Remove all items from the list.
clear() -> NoneType
nums = [40, 41, 42, 43]
nums.clear() # now `nums` is []
list[T].copy()method
Returns a copy of the list.
copy() -> list[T]
list[T].extend()method
Extends the list by appending elements from the given list.
extend(list[T]) -> NoneType
PARAMETERS
<unnamed param> — List to concatenate with the current.SEE ALSO
list[T].index()method
Returns index of the first occurrence of the item in the list. If not found returns -1.
index(T) -> int
PARAMETERS
<unnamed param> — Element to find in the list.SEE ALSO
list[T].insert()method
Insert a value at the specified index.
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]
list[T].pop()method
Retrieves the item at given index and also removes it from the list.
pop() -> T
nums = [40, 41, 42, 43]
meaning_of_life = nums.pop(2) # now `nums` are [40, 41, 43], `meaning_of_life` is 42
list[T].remove()method
Removes the first item from list s where s[i] is equal to given param.
remove(T) -> NoneType
PARAMETERS
<unnamed param> — Value that will be removed from the listEXAMPLE
nums = [40, 41, 42, 40, 41, 42]
nums.remove(42) # now `nums` are [40, 41, 40, 41, 42]
list[T].reverse()method
Reverses the elements of the list in place.
reverse() -> NoneType
max()function
Returns the largest of two or more arguments. It is a built-in Indie function (similar to Python's).
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).
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).
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
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).
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.
__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)`
Method __add__ should never be called directly, instead str1 + str2 syntax should be used.
str.__contains__()method
Returns True if the string contains the given substring, otherwise False.
__contains__(str) -> bool
PARAMETERS
<unnamed param> — Substring to find in the string.EXAMPLE
my_bool = 'cd' in 'abcdef' # this implicitly calls `'abcdef'.__contains__('cd')`
Method __contains__ should never be called directly, instead str1 in str2 syntax should be used.
str.__getitem__()method
Returns substring at given index.
__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)`)
Method __getitem__ should never be called directly, instead my_str[key] syntax should be used.
str.__init__()method
Cast constructor for built-in Indie type. Returns a str version of object.
__init__(int) -> NoneType
__init__(float) -> NoneType
__init__(str) -> NoneType
__init__(bool) -> NoneType
PARAMETERS
<unnamed param> — Value to cast from.SEE ALSO
str.__len__()method
Returns the length (the number of characters) of a str.
__len__() -> int
s = 'foobar'
len(s) # returns 6 (this implicitly calls `s.__len__()`)
Method __len__ should never be called directly, instead len(str_obj) syntax should be used.
str.__mul__()method
Returns a concatenation of the string with n its copies.
__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'
Method __mul__ should never be called directly, instead my_str * n syntax should be used.
str.capitalize()method
Returns the string with the first letter capitalized.
capitalize() -> str
str.center()method
Centers the string within the specified width using a fill character.
center(length: int, character: str = " ") -> str
PARAMETERS
length — Length of the result string.
character — Fill character.
SEE ALSO
str.count()method
Returns the count of non-overlapping occurrences of a substring within [start, end].
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.endswith()method
Returns True if the string ends with the suffix, otherwise False.
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.find()method
Returns the lowest index where the substring is found.
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.
str.index()method
Returns the lowest index of the substring within [start, end], raising an error if not found.
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.isalpha()method
Returns True if the string contains only alphabetic characters and is not empty; otherwise, False.
isalpha() -> bool
str.islower()method
Returns True if all cased characters are lowercase and there is at least one, otherwise False.
islower() -> bool
str.isspace()method
Returns True if the string contains only whitespace and is not empty, otherwise False.
isspace() -> bool
str.isupper()method
Returns True if all cased characters are uppercase and there is at least one, otherwise False.
isupper() -> bool
str.join()method
Returns a string that joins the elements of the list, using the string as a separator.
join(list[str]) -> str
PARAMETERS
<unnamed param> — List of sctrings to join.SEE ALSO
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.
ljust(length: int, character: str = " ") -> str
PARAMETERS
length — Length of the result string.
character — Fill character.
SEE ALSO
str.lower()method
Returns a copy of the string with all cased characters in lowercase.
lower() -> str
str.lstrip()method
Returns a copy of the string with leading characters removed.
lstrip(symbols: str = " ") -> str
PARAMETERS
symbols — Characters to remove.SEE ALSO
str.partition()method
Splits the string at the first occurrence of sep and returns a list with the parts before, the separator, and after.
partition(str) -> list[str]
PARAMETERS
<unnamed param> — String separator value.SEE ALSO
str.replace()method
Returns a copy of the string with all occurrences of old replaced by new, or the first count occurrences if specified.
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.rfind()method
Returns the highest index of sub within [start, end], or -1 if not found.
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.rindex()method
Returns the highest index of sub within [start, end], raising an error if not found.
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.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.
rjust(length: int, character: str = " ") -> str
PARAMETERS
length — Length of the result string.
character — Fill character.
SEE ALSO
str.rpartition()method
Splits the string at the last occurrence of sep and returns a list with the parts before, the separator, and after.
rpartition(str) -> list[str]
PARAMETERS
<unnamed param> — String separator value.SEE ALSO
str.rsplit()method
Splits the string into words using sep as the delimiter, with an optional maxsplit from the right.
rsplit(separator: str = " ", maxsplit: int = -1) -> list[str]
PARAMETERS
separator — String separator value.
maxsplit — Number of splits.
SEE ALSO
str.rstrip()method
Returns a copy of the string with trailing characters removed.
rstrip(symbols: str = " ") -> str
PARAMETERS
symbols — Characters to remove.SEE ALSO
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.
split(separator: str = " ", maxsplit: int = -1) -> list[str]
PARAMETERS
separator — String separator value.
maxsplit — Number of splits.
SEE ALSO
str.startswith()method
Returns True if string starts with the prefix, otherwise False.
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.strip()method
Returns a string with the leading and trailing characters removed.
strip(symbols: str = " ") -> str
PARAMETERS
symbols — Characters to remove.SEE ALSO
str.swapcase()method
Returns a copy of the string with case swapped.
swapcase() -> str
str.upper()method
Returns a copy of the string with all cased characters in uppercase.
upper() -> 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).
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.
Falseobject
Built-in Indie object (similar to Python's).
Noneobject
Built-in Indie object (similar to Python's).
Trueobject
Built-in Indie object (similar to Python's).