mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +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
|
symbol: ETHUSDT
|
||||||
# kline interval for indicators
|
# kline interval for indicators
|
||||||
interval: 15m
|
interval: 15m
|
||||||
window: 3
|
window: 2
|
||||||
stoploss: 2%
|
stoploss: 2%
|
||||||
source: hl2
|
source: hl2
|
||||||
predictOffset: 5
|
predictOffset: 8
|
||||||
#exits:
|
#exits:
|
||||||
#- roiStopLoss:
|
#- roiStopLoss:
|
||||||
# percentage: 0.8%
|
# percentage: 0.8%
|
||||||
|
|
|
@ -219,7 +219,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
for _, kline := range *klines {
|
for _, kline := range *klines {
|
||||||
source := getSource(&kline).Float64()
|
source := getSource(&kline).Float64()
|
||||||
s.drift.Update(source)
|
s.drift.Update(source)
|
||||||
s.atr.Update(kline.High.Float64(), kline.Low.Float64(), kline.Close.Float64())
|
s.atr.PushK(kline)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Environment.IsBackTesting() {
|
if s.Environment.IsBackTesting() {
|
||||||
|
@ -288,6 +288,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
sourcef := source.Float64()
|
sourcef := source.Float64()
|
||||||
priceLine.Update(sourcef)
|
priceLine.Update(sourcef)
|
||||||
s.drift.Update(sourcef)
|
s.drift.Update(sourcef)
|
||||||
|
s.atr.PushK(kline)
|
||||||
drift = s.drift.Array(2)
|
drift = s.drift.Array(2)
|
||||||
driftPred = s.drift.Predict(s.PredictOffset)
|
driftPred = s.drift.Predict(s.PredictOffset)
|
||||||
atr = s.atr.Last()
|
atr = s.atr.Last()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user