diff --git a/pkg/strategy/ccinr/strategy.go b/pkg/strategy/ccinr/strategy.go index 371e9f1..69e3b60 100644 --- a/pkg/strategy/ccinr/strategy.go +++ b/pkg/strategy/ccinr/strategy.go @@ -149,11 +149,14 @@ func (s *Strategy) generateOrders(ctx context.Context, kline types.KLine) ([]typ log.Infof(fmt.Sprintf("place order keline info: symbol %s, high %v, low %v, open %v, close %v", symbol, kline.High.Float64(), kline.Low.Float64(), kline.Open.Float64(), kline.Close.Float64())) placePrice := fixedpoint.Value(0) - midPrice := (kline.High.Add(kline.Low)).Div(fixedpoint.Value(2.0)) + //midPrice := (kline.High.Add(kline.Low)).Div(fixedpoint.Value(2.0)) + //midP := (kline.High + kline.Low) / 2 if s.TradeType[symbol] == "long" { - placePrice = midPrice + placePrice = kline.Low + //placePrice = midP } else if s.TradeType[symbol] == "short" { - placePrice = midPrice + placePrice = kline.High + //placePrice = midP } else { return orders, nil } @@ -360,12 +363,12 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor qbtrade.OrderExecutor, if !s.Traded[symbol] { // 如若在下一根k线未成交 则取消订单 - if s.TradeType[symbol] != "" && s.TradeRetry[symbol] > 1 { + if s.TradeType[symbol] != "" && s.TradeRetry[symbol] > 10 { qbtrade.Notify(fmt.Sprintf("交易信号未成交,取消订单: %s", symbol)) s.cancelOrders(ctx, symbol) } - if s.TradeType[symbol] != "" && s.TradeRetry[symbol] <= 1 { + if s.TradeType[symbol] != "" && s.TradeRetry[symbol] <= 10 { s.TradeRetry[symbol] = s.TradeRetry[symbol] + 1 } }