diff --git a/pkg/bbgo/exit.go b/pkg/bbgo/exit.go index aedc936d6..802ccb55f 100644 --- a/pkg/bbgo/exit.go +++ b/pkg/bbgo/exit.go @@ -8,8 +8,17 @@ import ( "github.com/pkg/errors" "github.com/c9s/bbgo/pkg/dynamic" + "github.com/c9s/bbgo/pkg/util" ) +var enableMarketTradeStop = true + +func init() { + if v, defined := util.GetEnvVarBool("ENABLE_MARKET_TRADE_STOP"); defined { + enableMarketTradeStop = v + } +} + type ExitMethodSet []ExitMethod func (s *ExitMethodSet) SetAndSubscribe(session *ExchangeSession, parent interface{}) { diff --git a/pkg/bbgo/exit_protective_stop_loss.go b/pkg/bbgo/exit_protective_stop_loss.go index 8a741dd6d..d2e61815a 100644 --- a/pkg/bbgo/exit_protective_stop_loss.go +++ b/pkg/bbgo/exit_protective_stop_loss.go @@ -9,8 +9,6 @@ import ( "github.com/c9s/bbgo/pkg/types" ) -const enableMarketTradeStop = true - // ProtectiveStopLoss provides a way to protect your profit but also keep a room for the price volatility // Set ActivationRatio to 1% means if the price is away from your average cost by 1%, we will activate the protective stop loss // and the StopLossRatio is the minimal profit ratio you want to keep for your position.