pivotshort: rename strategy & fix pivot indicator

This commit is contained in:
austin362667 2022-05-10 17:11:24 +08:00 committed by Austin Liu
parent 1a441425b5
commit 8ab696deaa
5 changed files with 8 additions and 8 deletions

View File

@ -7,7 +7,7 @@ sessions:
exchangeStrategies:
- on: binance
pivot:
pivotshort:
symbol: BTCBUSD
interval: 1h
quantity: 0.95

View File

@ -13,7 +13,7 @@ import (
_ "github.com/c9s/bbgo/pkg/strategy/funding"
_ "github.com/c9s/bbgo/pkg/strategy/grid"
_ "github.com/c9s/bbgo/pkg/strategy/kline"
_ "github.com/c9s/bbgo/pkg/strategy/pivot"
_ "github.com/c9s/bbgo/pkg/strategy/pivotshort"
_ "github.com/c9s/bbgo/pkg/strategy/pricealert"
_ "github.com/c9s/bbgo/pkg/strategy/pricedrop"
_ "github.com/c9s/bbgo/pkg/strategy/rebalance"

View File

@ -1,4 +1,4 @@
package pivot
package pivotshort
import (
"fmt"
@ -99,11 +99,11 @@ func calculatePivot(klines []types.KLine, window int, valLow KLineValueMapper, v
}
pl := 0.
if lows.Min() == lows.Index(int(window/2.)) {
if lows.Min() == lows.Index(int(window/2.)-1) {
pl = lows.Min()
}
ph := 0.
if highs.Max() == highs.Index(int(window/2.)) {
if highs.Max() == highs.Index(int(window/2.)-1) {
ph = highs.Max()
}

View File

@ -1,6 +1,6 @@
// Code generated by "callbackgen -type Pivot"; DO NOT EDIT.
package pivot
package pivotshort
import ()

View File

@ -1,4 +1,4 @@
package pivot
package pivotshort
import (
"context"
@ -9,7 +9,7 @@ import (
"github.com/sirupsen/logrus"
)
const ID = "pivot"
const ID = "pivotshort"
var fifteen = fixedpoint.NewFromInt(15)
var three = fixedpoint.NewFromInt(3)