From a8438f8f720d5c1c931f9b93b8de327dd76dc5dc Mon Sep 17 00:00:00 2001 From: Andy Cheng Date: Thu, 25 Aug 2022 10:17:42 +0800 Subject: [PATCH] exits/hhllstop: add basic parameters --- pkg/bbgo/hh_ll_stop.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 pkg/bbgo/hh_ll_stop.go diff --git a/pkg/bbgo/hh_ll_stop.go b/pkg/bbgo/hh_ll_stop.go new file mode 100644 index 000000000..dade7e000 --- /dev/null +++ b/pkg/bbgo/hh_ll_stop.go @@ -0,0 +1,32 @@ +package bbgo + +import ( + "github.com/c9s/bbgo/pkg/fixedpoint" + "github.com/c9s/bbgo/pkg/types" +) + +type HigherHighLowerLowStopLoss struct { + Symbol string `json:"symbol"` + + Side types.SideType `json:"side"` + + types.IntervalWindow + + HighLowWindow int `json:"highLowWindow"` + + MaxHighLow int `json:"maxHighLow"` + + MinHighLow int `json:"minHighLow"` + + // ActivationRatio is the trigger condition + // When the price goes higher (lower for side buy) than this ratio, the stop will be activated. + ActivationRatio fixedpoint.Value `json:"activationRatio"` + + // DeactivationRatio is the kill condition + // When the price goes higher (lower for short position) than this ratio, the stop will be deactivated. + // You can use this to combine several exits + DeactivationRatio fixedpoint.Value `json:"deactivationRatio"` + + session *ExchangeSession + orderExecutor *GeneralOrderExecutor +}