mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-23 07:15:15 +00:00
29 lines
537 B
Go
29 lines
537 B
Go
|
package bollmaker
|
||
|
|
||
|
import "github.com/c9s/bbgo/pkg/indicator"
|
||
|
|
||
|
type PriceTrend string
|
||
|
|
||
|
const (
|
||
|
NeutralTrend PriceTrend = "neutral"
|
||
|
UpTrend PriceTrend = "upTrend"
|
||
|
DownTrend PriceTrend = "downTrend"
|
||
|
UnknownTrend PriceTrend = "unknown"
|
||
|
)
|
||
|
|
||
|
func detectPriceTrend(inc *indicator.BOLL, price float64) PriceTrend {
|
||
|
if inBetween(price, inc.LastDownBand(), inc.LastUpBand()) {
|
||
|
return NeutralTrend
|
||
|
}
|
||
|
|
||
|
if price < inc.LastDownBand() {
|
||
|
return DownTrend
|
||
|
}
|
||
|
|
||
|
if price > inc.LastUpBand() {
|
||
|
return UpTrend
|
||
|
}
|
||
|
|
||
|
return UnknownTrend
|
||
|
}
|