tav

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ADX

func ADX(high, low, close []float64, period int) []float64

ADX 平均方向指数,对应 sta_inds.go 中的 ADX

func ADXBy

func ADXBy(high, low, close []float64, period, smoothing, method int) []float64

ADXBy 可自定义方法的平均方向指数 method=0 经典ADX计算方法 method=1 TradingView "ADX and DI for v4"方法 smoothing=0 表示使用period作为平滑周期 返回 adx值数组

func ALMA

func ALMA(data []float64, period int, sigma, distOff float64) []float64

ALMA Arnaud Legoux Moving Average

period: window size. sigma: Smoothing value. distOff: min 0 (smoother), max 1 (more responsive).

func ATR

func ATR(high, low, close []float64, period int) []float64

ATR 平均真实波动范围,对应 sta_inds.go 中的 ATR

func Aroon

func Aroon(high, low []float64, period int) ([]float64, []float64, []float64)

Aroon 阿隆指标,对应 sta_inds.go 中的 Aroon

func AvgDev

func AvgDev(data []float64, period int) []float64

AvgDev 平均偏差,对应 sta_inds.go 中的 AvgDev

func BBANDS

func BBANDS(data []float64, period int, stdUp, stdDn float64) ([]float64, []float64, []float64)

BBANDS 布林带指标,对应 sta_inds.go 中的 BBANDS

func CCI

func CCI(data []float64, period int) []float64

CCI 商品通道指数,对应 sta_inds.go 中的 CCI

func CHOP

func CHOP(high, low, close []float64, period int) []float64

CHOP 乔普指数,对应 sta_inds.go 中的 CHOP

func CMF

func CMF(high, low, close, volume []float64, period int) []float64

CMF Chaikin Money Flow period: 20

func CMO

func CMO(data []float64, period int) []float64

CMO 计算Chande Momentum Oscillator (ta-lib版本)

func CMOBy

func CMOBy(data []float64, period int, maType int) []float64

CMOBy 计算Chande Momentum Oscillator maType: 0: ta-lib (Wilder's smoothing) 1: tradingView (simple moving sum)

func CRSI

func CRSI(data []float64, period, upDn, rocVal int) []float64

CRSI Connors RSI,对应 sta_inds.go 中的 CRSI

func CRSIBy

func CRSIBy(data []float64, period, upDn, rocVal, vtype int) []float64

CRSIBy 可自定义计算方法的Connors RSI

func CTI

func CTI(data []float64, period int) []float64

CTI Correlation Trend Indicator 并行版本 CTI是一个由John Ehler在2020年创建的振荡器 它根据价格范围内的价格接近正斜率或负斜率直线的程度来分配值 值范围从-1到1,建议周期:20 当前是性能优化版本,快20%;等同于LinRegAdv(data, period, false, false, false, true, false, false)

func Cross

func Cross(data1 []float64, data2 []float64) []int

Cross 计算两个序列在每个时间点的交叉状态。 返回值:正数表示上穿,负数表示下穿,0表示无交叉或未知。 返回值的绝对值减1 (abs(ret) - 1) 代表了最近一次交叉点到当前元素的距离。

func DV2

func DV2(h, l, c []float64, period, maLen int) []float64

DV2 Developed by David Varadi of http://cssanalytics.wordpress.com/

This is the batch-calculation (parallel) version of the DV2 indicator.

func EMA

func EMA(data []float64, period int) []float64

EMA 指数移动平均线,对应 sta_inds.go 中的 EMA

func EMABy

func EMABy(data []float64, period int, initType int) []float64

EMABy 指数移动平均线,可指定初始化方式

func ER

func ER(data []float64, period int) []float64

ER Efficiency Ratio / Trend to Noise Ratio 并行计算版本 suggest period: 8

func HL2

func HL2(a, b []float64) []float64

func HLC3

func HLC3(a, b, c []float64) []float64

func HMA

func HMA(data []float64, period int) []float64

HMA an implementation of Hull Moving Average. This is a high-performance version for batch calculation.

func HeikinAshi

func HeikinAshi(open, high, low, close []float64) ([]float64, []float64, []float64, []float64)

HeikinAshi 并行版本,返回 [open, high, low, close] 数组 参数:开盘价、最高价、最低价、收盘价数组

func Highest

func Highest(data []float64, period int) []float64

Highest finds the highest value over a preceding period for each point. No changes needed as it relies on the correct slidingWindow implementation.

func HighestBar

func HighestBar(data []float64, period int) []float64

HighestBar finds the offset of the highest bar in a preceding period.

func KAMA

func KAMA(data []float64, period int) []float64

KAMA Kaufman Adaptive Moving Average 并行计算版本 period: 10 fixed: (fast: 2, slow: 30)

func KAMABy

func KAMABy(data []float64, period int, fast, slow int) []float64

KAMABy Kaufman Adaptive Moving Average 并行计算版本 period: 10, fast: 2, slow: 30

func KDJ

func KDJ(high, low, close []float64, period, sm1, sm2 int) ([]float64, []float64, []float64)

KDJ 随机指标KDJ,对应 sta_inds.go 中的 KDJ

func KDJBy

func KDJBy(high, low, close []float64, period int, sm1 int, sm2 int, maBy string) (k, d, rsv []float64)

func LinReg

func LinReg(data []float64, period int) []float64

LinRegAdv 计算线性回归的各种指标,并行版本

func LinRegAdv

func LinRegAdv(data []float64, period int, angle, intercept, degrees, r, slope, tsf bool) []float64

LinRegAdv 计算线性回归的各种指标,并行版本

func Lowest

func Lowest(data []float64, period int) []float64

Lowest finds the lowest value over a preceding period for each point. No changes needed as it relies on the correct slidingWindow implementation.

func LowestBar

func LowestBar(data []float64, period int) []float64

LowestBar finds the offset of the lowest bar in a preceding period.

func MACD

func MACD(data []float64, fast, slow, smooth int) ([]float64, []float64)

MACD 移动平均线收敛发散指标,对应 sta_inds.go 中的 MACD

func MACDBy

func MACDBy(data []float64, fast, slow, smooth, initType int) ([]float64, []float64)

MACDBy 可自定义初始化方式的MACD

func MFI

func MFI(high, low, close, volume []float64, period int) []float64

MFI 资金流量指数 - 并行计算版本

func PercentRank

func PercentRank(data []float64, period int) []float64

func PluMinDI

func PluMinDI(high, low, close []float64, period int) ([]float64, []float64)

func PluMinDM

func PluMinDM(high, low, cls []float64, period int) ([]float64, []float64)

func RMA

func RMA(data []float64, period int) []float64

RMA 相对移动平均线,对应 sta_inds.go 中的 RMA

func RMABy

func RMABy(data []float64, period int, initType int, initVal float64) []float64

RMABy 相对移动平均线,可指定初始化方式和初始值

func RMI

func RMI(data []float64, period int, montLen int) []float64

RMI Relative Momentum Index 相对动量指标的并行计算版本

func ROC

func ROC(data []float64, period int) []float64

ROC 变化率指标,对应 sta_inds.go 中的 ROC

func RSI

func RSI(data []float64, period int) []float64

RSI 相对强度指数,对应 sta_inds.go 中的 RSI

func RSIBy

func RSIBy(data []float64, period int, subVal float64) []float64

RSIBy 带偏移量的RSI计算。 同样重构为分块处理逻辑,确保与带状态版本行为一致,并提升代码清晰度。

func SMA

func SMA(data []float64, period int) []float64

SMA 简单移动平均,对应 sta_inds.go 中的 SMA

func STC

func STC(data []float64, period, fast, slow int, alpha float64) []float64

STC 计算Schaff趋势周期指标 (并行计算版本)

func StdDev

func StdDev(data []float64, period int) []float64

StdDev 标准差,对应 sta_inds.go 中的 StdDev

func StdDevBy

func StdDevBy(data []float64, period int, ddof int) ([]float64, []float64)

StdDevBy 带自由度的标准差

func Stiffness

func Stiffness(data []float64, maLen, stiffLen, stiffMa int) []float64

Stiffness 并行计算版本

func Stoch

func Stoch(high, low, close []float64, period int) []float64

Stoch 计算随机指标(K值)。 优化了NaN处理和分支逻辑,使其更清晰且不易出错。

func StochRSI

func StochRSI(obj []float64, rsiLen int, stochLen int, maK int, maD int) ([]float64, []float64)

StochRSI StochasticRSI,对应 sta_inds.go 中的 StochRSI rsiLen: RSI周期, stochLen: Stoch周期, maK: K线SMA周期, maD: D线SMA周期 返回 [fastK, fastD]

func Sum

func Sum(data []float64, period int) []float64

Sum 计算滑动窗口的累加和,遇到nan时跳过

func TD

func TD(data []float64) []float64

TD Tom DeMark Sequence 狄马克序列,对应sta_inds.go中的TD

func TR

func TR(high, low, close []float64) []float64

TR 真实波动范围,对应 sta_inds.go 中的 TR

func UTBot

func UTBot(c, atr []float64, rate float64) []float64

UTBot UT Bot Alerts 并行计算版本

func UpDown

func UpDown(data []float64, vtype int) []float64

UpDown 上下变动指标,对应 sta_inds.go 中的 UpDown 修正版:正确处理NaN值,并在遇到NaN时重置累计状态。

func VWMA

func VWMA(price []float64, volume []float64, period int) []float64

VWMA 成交量加权移动平均线 这个版本会在遇到 NaN 时重置计算状态。

func WMA

func WMA(data []float64, period int) []float64

WMA an implementation of Weighted Moving Average. This version handles NaN values by resetting the calculation state. It remains high-performance for continuous non-NaN data segments.

func WillR

func WillR(high, low, close []float64, period int) []float64

Williams %R 并行计算版本 suggest period: 14

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL