Documentation Index
Fetch the complete documentation index at: https://takeprofit.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Algorithms package of Indie language.
Types
Adx
type
Average directional index algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Adx
@indicator('Example')
def Main(self):
minus_di, adx, plus_di = Adx.new(adx_len=9, di_len=12)
return minus_di[0], adx[0], plus_di[0]
Atr
type
Average true range algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Atr
@indicator('Example')
def Main(self):
atr = Atr.new(length=12, ma_algorithm='SMA')
return atr[0]
type
Bollinger bands algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Bb
@indicator('Example', overlay_main_pane=True)
def Main(self):
lower, middle, upper = Bb.new(self.close, length=20, mult=2.0)
return lower[0], middle[0], upper[0]
Cci
type
Commodity channel index algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Cci
@indicator('Example')
def Main(self):
cci = Cci.new(self.close, length=20)
return cci[0]
Change
type
Algorithm to calculate change of a series of values. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Change
@indicator('Example')
def Main(self):
ch = Change.new(self.close)
return ch[0]
Corr
type
Correlation coefficient algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Corr
@indicator('Example')
def Main(self):
corr = Corr.new(self.close, self.open, length=14)
return corr[0]
CumSum
type
Cumulative sum algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import CumSum
@indicator('Example')
def Main(self):
cs = CumSum.new(self.close)
return cs[0]
Dev
type
Mean absolute deviation algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Dev
@indicator('Example')
def Main(self):
dev = Dev.new(self.close, length=12)
return dev[0]
Donchian
type
Donchian channels algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Donchian
@indicator('DC', overlay_main_pane=True)
def Main(self):
d = Donchian.new(length=20)
return d[0]
Ema
type
Exponential moving average algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Ema
@indicator('Example', overlay_main_pane=True)
def Main(self):
ema = Ema.new(self.close, length=9)
return ema[0]
FixNan
type
Algorithm that replaces all math.nan values with the most recent corresponding non-nan values in a series. Read here about how to use it.
# indie:lang_version = 5
import math
from indie import indicator, MutSeriesF
from indie.algorithms import FixNan
@indicator('Example', overlay_main_pane=True)
def Main(self):
# Variable `s` is just an example of a series with `nan` values:
s = MutSeriesF.new(math.nan)
if self.close[0] > self.open[0]:
s[0] = self.close[0]
# `FixNan` replaces every `nan` value in `s` with the closest non-`nan` value on the left of it:
s2 = FixNan.new(s)
return s2[0]
Highest
type
Algorithm that returns the maximum value over a given period. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Highest
@indicator('My Indie 1', overlay_main_pane=True)
def Main(self):
h = Highest.new(self.high, length=12)
return h[0]
LinReg
type
Linear regression algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import LinReg
@indicator('Example')
def Main(self):
lr = LinReg.new(self.close, length=14, offset=0)
return lr[0]
Lowest
type
Algorithm that returns the minimum value over a given period. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Lowest
@indicator('My Indie 1', overlay_main_pane=True)
def Main(self):
l = Lowest.new(self.low, length=12)
return l[0]
type
Moving average algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie.algorithms import Ma
@indicator('Example', overlay_main_pane=True)
def Main(self):
ma = Ma.new(self.close, length=12, algorithm='SMA')
return ma[0]
Macd
type
Moving average convergence/divergence algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie.algorithms import Macd
@indicator('Example', overlay_main_pane=True)
def Main(self):
macd = Macd.new(self.close, fast_length=12, slow_length=26, sig_length=9, ma_source='EMA', ma_signal='EMA')
return macd[0]
type
Moving median algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Median
@indicator('Example', overlay_main_pane=True)
def Main(self):
m = Median.new(self.close, length=10)
return m[0]
Mfi
type
Money flow index algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie.algorithms import Mfi
@indicator('Example', overlay_main_pane=True)
def Main(self):
mfi = Mfi.new(self.hlc3, length=14)
return mfi[0]
Mfv
type
Money flow volume algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Mfv
@indicator('Example')
def Main(self):
mfv = Mfv.new()
return mfv[0]
NanToZero
type
Algorithm that replaces all math.nan values with zeros in a series. Read here about how to use it.
# indie:lang_version = 5
import math
from indie import indicator, MutSeriesF
from indie.algorithms import NanToZero
@indicator('Example')
def Main(self):
# Variable `s` is just an example of a series with `nan` values:
s = MutSeriesF.new(math.nan)
if self.close[0] > self.open[0]:
s[0] = 0 if math.isnan(s[1]) else s[1] + 1
# `NanToZero` replaces every `nan` value in `s` with zero
s2 = NanToZero.new(s)
return s2[0]
NetVolume
type
Net volume algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import NetVolume
@indicator('Example')
def Main(self):
nv = NetVolume.new(self.close)
return nv[0]
PercentRank
type
Percent rank algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import PercentRank
@indicator('Example')
def Main(self):
pr = PercentRank.new(self.close, length=12)
return pr[0]
Percentile
type
Percentile algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Percentile
@indicator('Example')
def Main(self):
pcl = Percentile.new(self.close, length=12, pct=95, interpolate=True)
return pcl[0]
PivotHighLow
type
PivotHighLow algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import PivotHighLow
@indicator('Example')
def Main(self):
ph, pl = PivotHighLow.new(self.close, left_bars=5, right_bars=5)
return ph[0], pl[0]
Rma
type
RMA algorithm is a moving average algorithm that is used to calculate RSI. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Rma
@indicator('My Indie 1', overlay_main_pane=True)
def Main(self):
rma = Rma.new(self.close, length=12)
return rma[0]
Roc
type
Rate of change algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Roc
@indicator('Example')
def Main(self):
roc = Roc.new(self.close, length=9)
return roc[0]
Rsi
type
Relative strength index algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Rsi
@indicator('Example')
def Main(self):
rsi = Rsi.new(self.close, length=12)
return rsi[0]
Sar
type
Parabolic stop and reverse algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie.algorithms import Sar
@indicator('Example', overlay_main_pane=True)
def Main(self):
sar = Sar.new(start=0.02, increment=0.02, maximum=0.2)
return sar[0]
SinceHighest
type
Algorithm that returns the number of bars after the maximum price for the given period. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import SinceHighest
@indicator('Example')
def Main(self):
sh = SinceHighest.new(self.high, length=10)
return sh[0]
SinceLowest
type
Algorithm that returns the number of bars after the minimum price for the given period. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import SinceLowest
@indicator('Example')
def Main(self):
sl = SinceLowest.new(self.high, length=10)
return sl[0]
SinceTrue
type
Read here about how to use it.
# indie:lang_version = 5
from indie import indicator, MutSeries
from indie.algorithms import SinceTrue
@indicator('Example')
def Main(self):
cond = MutSeries[bool].new(self.close[0] > self.open[0])
index = SinceTrue.new(cond)
return index
Sma
type
Simple moving average algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Sma
@indicator('Example')
def Main(self):
sma = Sma.new(self.close, length=12)
return sma[0]
StdDev
type
Standard deviation algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import StdDev
@indicator('Example')
def Main(self):
sd = StdDev.new(self.close, length=12)
return sd[0]
Stoch
type
Stochastic algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Stoch
@indicator('Example')
def Main(self):
s = Stoch.new(self.close, self.low, self.high, length=14)
return s[0]
Sum
type
Sliding sum algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Sum
@indicator('Example')
def Main(self):
s = Sum.new(self.close, length=10)
return s[0]
Supertrend
type
Supertrend algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator, color, plot
from indie.algorithms import Supertrend
@indicator('Example', overlay_main_pane=True)
def Main(self):
st, dir = Supertrend.new(factor=3.0, atr_period=10, ma_algorithm='SMA')
c = color.RED if dir[0] > 0 else color.GREEN
return plot.Line(st[0], color=c)
type
True range algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Tr
@indicator('Example')
def Main(self):
tr = Tr.new()
return tr[0]
Tsi
type
True strength index algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Tsi
@indicator('Example')
def Main(self):
tsi = Tsi.new(self.close, long_len=21, short_len=12)
return tsi[0]
type
Ultimate oscillator algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie.algorithms import Uo
@indicator('Example', overlay_main_pane=True)
def Main(self):
uo = Uo.new(fast_len=7, middle_len=14, slow_len=28)
return uo[0]
Vwap
type
Volume weighted average price algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Vwap
@indicator('Example', overlay_main_pane=True)
def Main(self):
main_line, upper, lower = Vwap.new(self.close, anchor='Day', std_dev_mult=1.0)
return main_line[0], upper[0], lower[0]
Vwma
type
Volume weighted moving average algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Vwma
@indicator('Example', overlay_main_pane=True)
def Main(self):
vwma = Vwma.new(self.close, length=12)
return vwma[0]
Wma
type
Weighted moving average algorithm. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import Wma
@indicator('Example', overlay_main_pane=True)
def Main(self):
wma = Wma.new(self.close, length=12)
return wma[0]
ZigZag
type
ZigZag algorithm that identifies pivot high and low points based on price movements. Read here about how to use it.
# indie:lang_version = 5
from indie import indicator
from indie.algorithms import ZigZag
@indicator('Example', overlay_main_pane=True)
def Main(self):
new_high, upd_high, new_low, upd_low = ZigZag.new(
left_bars=5,
right_bars=5,
dev_threshold=5.0,
allow_zig_zag_within_one_bar=True
)
return 1.0 if new_high or new_low else 0.0