Пример #1
0
// CheckFunc func to check.
func (Check01) CheckFunc(b ...*twse.Data) bool {
	if !prepareData(b...)[0] {
		return false
	}
	var ma3 = b[0].MA(3)
	if days, ok := utils.CountCountineFloat64(utils.DeltaFloat64(ma3)); !ok || days == 0 {
		return false
	}
	var ma6 = b[0].MA(6)
	if days, ok := utils.CountCountineFloat64(utils.DeltaFloat64(ma6)); !ok || days == 0 {
		return false
	}
	var ma18 = b[0].MA(18)
	if days, ok := utils.CountCountineFloat64(utils.DeltaFloat64(ma18)); !ok || days == 0 {
		return false
	}
	//log.Println(ma3[len(ma3)-1], ma6[len(ma6)-1], ma18[len(ma18)-1])
	if ma3[len(ma3)-1] > ma6[len(ma6)-1] && ma6[len(ma6)-1] > ma18[len(ma18)-1] {
		return true
	}
	return false
}
Пример #2
0
// CheckFunc func to check.
func (Check04) CheckFunc(b ...*twse.Data) bool {
	if !prepareData(b...)[0] {
		return false
	}
	var ma3 = b[0].MA(3)
	if days, up := utils.CountCountineFloat64(utils.DeltaFloat64(ma3)); up && days == 1 {
		var (
			ma6      = b[0].MA(6)
			ma18     = b[0].MA(18)
			ma3Last  = len(ma3) - 1
			ma6Last  = len(ma6) - 1
			ma18Last = len(ma18) - 1
		)
		return (ma3[ma3Last] > ma18[ma18Last] && ma6[ma6Last] > ma18[ma18Last]) && ma3[ma3Last] < ma6[ma6Last]
	}
	return false
}
Пример #3
0
// CheckFunc func to check.
func (Check05) CheckFunc(b ...*twse.Data) bool {
	if !prepareData(b...)[0] {
		return false
	}
	var (
		vols        = b[0].GetVolumeList()
		volsFloat64 = make([]float64, 3)
	)
	for i, v := range vols[len(vols)-3:] {
		volsFloat64[i] = float64(v)
	}
	if days, up := utils.CountCountineFloat64(utils.DeltaFloat64(volsFloat64)); up && days >= 1 && b[0].IsRed() {
		var (
			ma18      = b[0].MA(18)
			priceList = b[0].GetPriceList()
		)

		if priceList[len(priceList)-1] > ma18[len(ma18)-1] {
			return true
		}
	}
	return false
}