mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
fix: fine tune drift config. fix atr updating issue
This commit is contained in:
parent
b52208d7b6
commit
9c73aa4adb
|
@ -14,10 +14,10 @@ exchangeStrategies:
|
|||
symbol: ETHUSDT
|
||||
# kline interval for indicators
|
||||
interval: 15m
|
||||
window: 3
|
||||
window: 2
|
||||
stoploss: 2%
|
||||
source: hl2
|
||||
predictOffset: 5
|
||||
predictOffset: 8
|
||||
#exits:
|
||||
#- roiStopLoss:
|
||||
# percentage: 0.8%
|
||||
|
|
|
@ -219,7 +219,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
for _, kline := range *klines {
|
||||
source := getSource(&kline).Float64()
|
||||
s.drift.Update(source)
|
||||
s.atr.Update(kline.High.Float64(), kline.Low.Float64(), kline.Close.Float64())
|
||||
s.atr.PushK(kline)
|
||||
}
|
||||
|
||||
if s.Environment.IsBackTesting() {
|
||||
|
@ -288,6 +288,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
|||
sourcef := source.Float64()
|
||||
priceLine.Update(sourcef)
|
||||
s.drift.Update(sourcef)
|
||||
s.atr.PushK(kline)
|
||||
drift = s.drift.Array(2)
|
||||
driftPred = s.drift.Predict(s.PredictOffset)
|
||||
atr = s.atr.Last()
|
||||
|
|
Loading…
Reference in New Issue
Block a user