Documentation
¶
Index ¶
- Constants
- Variables
- func ADR()
- func ATRK(inHigh []float64, inLow []float64, inClose []float64, inTimePeriod int, ...) []float64
- func BOLL(inClose []float64, inN, inK int) (basis []float64, upper []float64, lower []float64, err error)
- func DC(inLow, inHigh []float64, nPeriod int) (outLow, outHigh []float64)
- func DMI(inHigh, inLow, inClose []float64, inTimePeriod int) (PDI, MDI, ADX, ADXR []float64)
- func DualThrust(inOpen, inHigh, inLow, inClose []float64, n int, k1, k2 float64) (buyLine, sellLine []float64)
- func EMA(inReal []float64, inTimePeriod int) ([]float64, error)
- func EMV(inHigh, inLow, inVolume []float64, inTimePeriod int) []float64
- func HHV(inReal []float64, inTimePeriod int) []float64
- func KDJ(inLow, inHigh, inClose []float64, inN1, inN2, inN3 int) (k, d, j []float64, err error)
- func LLV(inReal []float64, inTimePeriod int) []float64
- func MAOCV(inOpen, inClose, inVolume []float64, inTimePeriod int) []float64
- func OSC(inOpen, inLow, inHigh, inClose []float64) ([]float64, error)
- func SKDJ(inLow, inHigh, inClose []float64, N, M int) (skdjRsv, skdjK, skdjD []float64)
- func SMA(inReal []float64, inTimePeriod int) ([]float64, error)
- func SOBV(inOpen, inClose, inVolume []float64) []float64
- func VPT(inClose, inVolume []float64) []float64
- func ZIGZAG(inOpen, inClose []float64, minTrendLen int, minShockScale float64) []float64
- func ZigZagLastForm(inOpen, inClose []float64, minTrendLen int, minShockScale float64) string
- func ZigZagPoints(inOpen, inClose []float64, minTrendLen int, minShockScale float64) []float64
- type IndExpr
- type IndSeries
- type IndStyle
- type Indicator
Constants ¶
const ( IndSeriesUnknown = "" IndSeriesPrice = "price" IndSeriesVolume = "volume" IndSeriesUnique = "unique" IndStyleUnknown = "" IndStyleLine = "line" IndStyleBar = "bar" )
Variables ¶
var ( AllIndicators []Indicator IndicatorError = registerIndicator("", "") // price indicator IndicatorMA = registerIndicator("MA", "C(T)[PL]") // MA is SMA in fact IndicatorEMA = registerIndicator("EMA", "C(T)[PL]") IndicatorMACD = registerIndicator("MACD", "C(TTT)[UL]{Hist:B}") // Hist成员是特殊情况,是Bar,其余都是L(Line) IndicatorKDJ = registerIndicator("KDJ", "LHC(TPP)[UL]") // mask可能不严谨 IndicatorSKDJ = registerIndicator("SKDJ", "LHC(TP)[UL]") IndicatorBOLL = registerIndicator("BOLL", "C(TP)[PL]") IndicatorDUALTHRUST = registerIndicator("DUALTHRUST", "OHLC(TPP)[PL]") IndicatorATR = registerIndicator("ATR", "HLC(T)[UL]") IndicatorATRK = registerIndicator("ATRK", "HLC(TP)[UL]") IndicatorDC = registerIndicator("DC", "LH(T)[PL]") // volume price indicator IndicatorAD = registerIndicator("AD", "HLCV()[UL]") // Chaikin A/D Line IndicatorADOSC = registerIndicator("ADOSC", "HLCV(TT)[UL]") IndicatorEMV = registerIndicator("EMV", "HLV(T)[UL]") IndicatorMFI = registerIndicator("MFI", "HLCV(T)[UL]") // 1in 1out IndicatorOBV = registerIndicator("OBV", "CV()[UL]") // OBV使用的是Close价。很多工具中的OBV有1个参数,这个参数其实就是对OBV做的MA需要的参数 IndicatorVPT = registerIndicator("VPT", "CV()[UL]") IndicatorVAR = registerIndicator("VAR", "C(T)[UL]") IndicatorSTOCKRSI = registerIndicator("StockRSI", "C(TTT)[UL]") // 最后一个参数是给MA的,出2条线 IndicatorRSI = registerIndicator("RSI", "C(TTT)[UL]") // 3个参数出3条线,一起用才行 IndicatorSAR = registerIndicator("SAR", "HL(PP)[UL]") IndicatorTRIX = registerIndicator("TRIX", "C(T)[UL]") // 2个参数,1个给TRIX,1个给MA,出2条线(TRIX, TRIX+MA) IndicatorWR = registerIndicator("WR", "HLC(T)[UL]") // 用2个参数画出2条线,一起用 IndicatorROC = registerIndicator("ROC", "C(T)[UL]") IndicatorDMI = registerIndicator("DMI", "HLC(T)[UL]") // DMI指标包含4条线:PDI、MDI、ADX和ADXR IndicatorZIGZAG = registerIndicator("ZIGZAG", "OC(PP)[PZ]") IndicatorK = registerIndicator("Id", "(P)[]") )
Functions ¶
func ADR ¶
func ADR()
https://www.zhihu.com/question/56068713/answer/903382369 Average Daily Range (ADR)
func DualThrust ¶
func DualThrust(inOpen, inHigh, inLow, inClose []float64, n int, k1, k2 float64) (buyLine, sellLine []float64)
N日High的最高价HH N日Close的最低价LC N日Close的最高价HC N日Low的最低价LL Range = Max(HH-LC,HC-LL) BuyLine = O + K1×Range SellLine = O + K2×Range
func SKDJ ¶
https://github.com/haibeicode/indicator/blob/fea53b9ec084568fce8937166acf488e90e74c13/indicator/base.py https://github.com/haibeicode/indicator/blob/58d9331a87c8046756a6b01a82a30df675915595/indicator/technology/countertrend.py
FIXME 需要权威的实现或者测试用例
func ZigZagLastForm ¶
从尾巴上识别zigzag形态 return M_TOP / W_BOTTOM / UNKNOWN
func ZigZagPoints ¶
FIXME: error implement 获取所有转折点,非转折点填0,-1表示下拐,1表示上扬 minTrendLen = 2, minShockScale = 0.03: 至少2根线,且累计震幅达到最小要求3%,才能算形成趋势,否则只能算趋势上的震荡 return dots: -1 down knee point, 0 in the trend of last dot, 1 up knee point
Types ¶
type IndExpr ¶
type IndExpr string
dataSource.Indicator(params...).NextIndicator(params...) EMA(10).MA(30) MFI(default,5).EMA(30) OBV(default).MA(30)
func (IndExpr) MaxTimePeriod ¶
if returns nil, means time period is infinite or not sure
type Indicator ¶
type Indicator struct {
// contains filtered or unexported fields
}