diff --git a/config.yml b/config.yml index e5df610..97db0fd 100644 --- a/config.yml +++ b/config.yml @@ -2,8 +2,8 @@ -assetName: "TIAUSDT" +assetName: "LINKUSDT" -duration: "1h" +duration: "15m" limit: 17000 \ No newline at end of file diff --git a/main.go b/main.go index 2e3dd23..a0c2476 100644 --- a/main.go +++ b/main.go @@ -10,56 +10,25 @@ func main() { start := time.Now() - // close, _ := dbquery.GetCloseData("SOLUSDT", "1h") - - // high, _ := dbquery.GetHighData("SOLUSDT", "1h") - - // low, _ := dbquery.GetLowData("SOLUSDT", "1h") - - // index := risk.ChoppySlice(close, high, low) - - // e := risk.ChoppyEma(index) - // fmt.Println(e) - // strategey.RunBacktestEma() - // strategey.RunBacktestEmaChoppy() - // strategey.RunBacktestMacd() - // strategey.RunBacktestDonchain() - // strategey.RunBacktestDonchainChoppy() - - // c, _ := strategey.GetCsvDataFrame("BTCUSDT", "4h", "2022-05", "2023-12") - - // fmt.Println(c) + strategey.RunBacktestEma() + strategey.RunBacktestEmaChoppy() + strategey.RunBacktestDonchain() + strategey.RunBacktestDonchainChoppy() strategey.RunBacktestST() - // strategey.RunBacktestSuperTrend() - - // var err error - - // // account := trader.NewAccount(1000) - // btcfg, err := config.Yaml() - // if err != nil { - // log.Fatalf("error: %v", err) - // } + strategey.RunBacktestSuperTrend() - // fmt.Println("--------------------------------------------") - - // // strategyName := getStrageyNameDonchain() - // assetName := btcfg.AssetName - // duration := btcfg.Dration + // assetName := "TIAUSDT" + // duration := "4h" // df, _ := strategey.GetCandleData(assetName, duration) - // account := trader.NewAccount(1000) - - // df.Signal = df.SuperTrendChoppyStrategy(17, 2.0, 13, account) - // hSeries := df.Candles.Col("High") - // lSeries := df.Candles.Col("Low") - // cSeries := df.Candles.Col("Close") + // h := df.Highs() + // l := df.Lows() + // c := df.Closes() - // h := hSeries.Float() - // l := lSeries.Float() - // c := cSeries.Float() + // a := risk.ChoppySlice(c, h, l) - // st, _ := indicators.SuperTrend(21, 3.0, h, l, c) + // fmt.Println(a) end := time.Now() diff --git a/pkg/charts/candle_chart.go b/pkg/charts/candle_chart.go index aeddc27..6de6413 100644 --- a/pkg/charts/candle_chart.go +++ b/pkg/charts/candle_chart.go @@ -330,35 +330,35 @@ func klineWithSuperTrend() *charts.Kline { st, _ := indicators.SuperTrend(21, 3.0, h, l, c) - stLineData := make([]opts.LineData, len(st.SuperTrend)) - for i, v := range st.SuperTrend { - stLineData[i] = opts.LineData{Value: v} - } + // stLineData := make([]opts.LineData, len(st.SuperTrend)) + // for i, v := range st.SuperTrend { + // stLineData[i] = opts.LineData{Value: v} + // } - stLine := charts.NewLine() - stLine.SetXAxis(x).AddSeries("st", stLineData) + // stLine := charts.NewLine() + // stLine.SetXAxis(x).AddSeries("st", stLineData) - kline.Overlap(stLine) + // kline.Overlap(stLine) - // stupLineData := make([]opts.LineData, len(st.UpperBand)) - // for i, v := range st.SuperTrend { - // stupLineData[i] = opts.LineData{Value: v} - // } + stupLineData := make([]opts.LineData, len(st.UpperBand)) + for i, v := range st.SuperTrend { + stupLineData[i] = opts.LineData{Value: v} + } - // stLineHigh := charts.NewLine() - // stLineHigh.SetXAxis(x).AddSeries("st", stupLineData) + stLineHigh := charts.NewLine() + stLineHigh.SetXAxis(x).AddSeries("st", stupLineData) - // kline.Overlap(stLineHigh) + kline.Overlap(stLineHigh) - // stlowLineData := make([]opts.LineData, len(st.LowerBand)) - // for i, v := range st.SuperTrend { - // stlowLineData[i] = opts.LineData{Value: v} - // } + stlowLineData := make([]opts.LineData, len(st.LowerBand)) + for i, v := range st.SuperTrend { + stlowLineData[i] = opts.LineData{Value: v} + } - // stLineLow := charts.NewLine() - // stLineLow.SetXAxis(x).AddSeries("st", stlowLineData) + stLineLow := charts.NewLine() + stLineLow.SetXAxis(x).AddSeries("st", stlowLineData) - // kline.Overlap(stLineLow) + kline.Overlap(stLineLow) kline.SetGlobalOptions( charts.WithTitleOpts(opts.Title{ diff --git a/pkg/indicator/indicators/supertrend.go b/pkg/indicator/indicators/supertrend.go index fcdb1f4..3ae1f0c 100755 --- a/pkg/indicator/indicators/supertrend.go +++ b/pkg/indicator/indicators/supertrend.go @@ -38,7 +38,8 @@ func SuperTrend(atrPeriod int, factor float64, high, low, close []float64) (Supe atr := make([]float64, len(high)) for i := range high { if i < atrPeriod { - atr[i] = math.NaN() + // Initialize atr[i] with the first TR value instead of NaN + atr[i] = tr1[0] } else { sum := 0.0 for j := i - atrPeriod + 1; j <= i; j++ { @@ -48,7 +49,6 @@ func SuperTrend(atrPeriod int, factor float64, high, low, close []float64) (Supe atr[i] = sum / float64(atrPeriod) } } - hl2 := make([]float64, len(high)) for i := range high { hl2[i] = (high[i] + low[i]) / 2 @@ -57,42 +57,34 @@ func SuperTrend(atrPeriod int, factor float64, high, low, close []float64) (Supe } isUpTrend := make([]bool, len(high)) // ここを変更しました - prevUpperBand := upperBand[0] - prevLowerBand := lowerBand[0] - for i := range high { + current := i + previous := i - 1 if i == 0 { - superTrend[i] = hl2[i] - isUpTrend[i] = true - } else { - if close[i] > prevUpperBand { - isUpTrend[i] = true - } else if close[i] < prevLowerBand { - isUpTrend[i] = false - } else { - isUpTrend[i] = isUpTrend[i-1] - } + previous = 0 + } + + if close[current] > upperBand[previous] { // If the current close is above the previous upper band, then it is an uptrend + isUpTrend[current] = true + } else if close[current] < lowerBand[previous] { // If the current close is below the previous lower band, then it is a downtrend + isUpTrend[current] = false + } else { // Otherwise, the trend is the same as the previous one + isUpTrend[current] = isUpTrend[previous] - if isUpTrend[i] { - superTrend[i] = lowerBand[i] - if close[i] <= prevUpperBand { - upperBand[i] = prevUpperBand - } else { - upperBand[i] = hl2[i] + (factor * atr[i]) - } - lowerBand[i] = hl2[i] - (factor * atr[i]) - } else { - superTrend[i] = upperBand[i] - upperBand[i] = hl2[i] + (factor * atr[i]) - if close[i] >= prevLowerBand { - lowerBand[i] = prevLowerBand - } else { - lowerBand[i] = hl2[i] - (factor * atr[i]) - } + if isUpTrend[current] && lowerBand[current] < lowerBand[previous] { // If it is an uptrend and the current lower band is below the previous lower band, then use the previous lower band + lowerBand[current] = lowerBand[previous] + } else if !isUpTrend[current] && upperBand[current] > upperBand[previous] { // If it is a downtrend and the current upper band is above the previous upper band, then use the previous upper band + upperBand[current] = upperBand[previous] } + } - prevUpperBand = upperBand[i] - prevLowerBand = lowerBand[i] + // If it is an uptrend, use the lower band as the super trend, otherwise use the upper band + if isUpTrend[current] { + superTrend[current] = lowerBand[current] + upperBand[current] = math.NaN() // Hide the upper band in an uptrend + } else { + superTrend[current] = upperBand[current] + lowerBand[current] = math.NaN() // Hide the lower band in a downtrend } } diff --git a/pkg/management/risk/market_index.go b/pkg/management/risk/market_index.go index 0bb416a..bd21ccc 100644 --- a/pkg/management/risk/market_index.go +++ b/pkg/management/risk/market_index.go @@ -30,7 +30,11 @@ func ChoppySlice(close []float64, high []float64, low []float64) []float64 { var choppySlice []float64 - for i := 30; i < len(close); i++ { + for i := 1; i < len(close); i++ { + + if i < 30 { + continue + } // iが30以上のときだけChoppyIndexの計算を行う diff --git a/pkg/strategey/donchain.go b/pkg/strategey/donchain.go index 1f500af..9d9469c 100644 --- a/pkg/strategey/donchain.go +++ b/pkg/strategey/donchain.go @@ -69,8 +69,8 @@ func (df *DataFrameCandle) OptimizeDonchainGoroutin() (performance float64, best var mu sync.Mutex var wg sync.WaitGroup - a := trader.NewAccount(1000) - marketDefault, _ := BuyAndHoldingStrategy(a) + // a := trader.NewAccount(1000) + // marketDefault, _ := BuyAndHoldingStrategy(a) for period := 10; period < 333; period++ { wg.Add(1) @@ -87,9 +87,9 @@ func (df *DataFrameCandle) OptimizeDonchainGoroutin() (performance float64, best return } - if analytics.NetProfit(signalEvents) < marketDefault { - return - } + // if analytics.NetProfit(signalEvents) < marketDefault { + // return + // } // if analytics.WinRate(signalEvents) < 0.45 { // return diff --git a/pkg/strategey/donchain_choppy.go b/pkg/strategey/donchain_choppy.go index 975e302..8dd620b 100644 --- a/pkg/strategey/donchain_choppy.go +++ b/pkg/strategey/donchain_choppy.go @@ -75,8 +75,8 @@ func (df *DataFrameCandle) OptimizeDonchainChoppyGoroutin() (performance float64 var mu sync.Mutex var wg sync.WaitGroup - a := trader.NewAccount(1000) - marketDefault, _ := BuyAndHoldingStrategy(a) + // a := trader.NewAccount(1000) + // marketDefault, _ := BuyAndHoldingStrategy(a) limit := 1000 slots := make(chan struct{}, limit) @@ -95,15 +95,15 @@ func (df *DataFrameCandle) OptimizeDonchainChoppyGoroutin() (performance float64 return } - if analytics.TotalTrades(signalEvents) < 3 { + if analytics.TotalTrades(signalEvents) < 5 { <-slots return } - if analytics.NetProfit(signalEvents) < marketDefault { - // <-slots - return - } + // if analytics.NetProfit(signalEvents) < marketDefault { + // // <-slots + // return + // } // if analytics.WinRate(signalEvents) < 0.45 { // <-slots @@ -130,7 +130,7 @@ func (df *DataFrameCandle) OptimizeDonchainChoppyGoroutin() (performance float64 wg.Wait() - fmt.Println("最高利益", performance, "最適なピリオド", bestPeriod, "最適なチョッピー", bestChoppy) + fmt.Println("最高SQN", performance, "最適なピリオド", bestPeriod, "最適なチョッピー", bestChoppy) return performance, bestPeriod, bestChoppy } diff --git a/pkg/strategey/ema.go b/pkg/strategey/ema.go index 17319fb..64e4457 100644 --- a/pkg/strategey/ema.go +++ b/pkg/strategey/ema.go @@ -69,8 +69,8 @@ func (df *DataFrameCandle) OptimizeEma() (performance float64, bestPeriod1 int, limit := 1000 slots := make(chan struct{}, limit) - a := trader.NewAccount(1000) - marketDefault, _ := BuyAndHoldingStrategy(a) + // a := trader.NewAccount(1000) + // marketDefault, _ := BuyAndHoldingStrategy(a) var mu sync.Mutex var wg sync.WaitGroup @@ -90,15 +90,15 @@ func (df *DataFrameCandle) OptimizeEma() (performance float64, bestPeriod1 int, return } - if analytics.TotalTrades(signalEvents) < 3 { + if analytics.TotalTrades(signalEvents) < 5 { <-slots return } - if analytics.NetProfit(signalEvents) < marketDefault { - <-slots - return - } + // if analytics.NetProfit(signalEvents) < marketDefault { + // <-slots + // return + // } // if analytics.WinRate(signalEvents) < 0.50 { // <-slots @@ -130,7 +130,7 @@ func (df *DataFrameCandle) OptimizeEma() (performance float64, bestPeriod1 int, wg.Wait() - fmt.Println("最高利益", performance, "最適な短期線", bestPeriod1, "最適な長期線", bestPeriod2) + fmt.Println("最高SQN", performance, "最適な短期線", bestPeriod1, "最適な長期線", bestPeriod2) return performance, bestPeriod1, bestPeriod2 } diff --git a/pkg/strategey/ema_choppy.go b/pkg/strategey/ema_choppy.go index 0bbf009..3ebf6b7 100644 --- a/pkg/strategey/ema_choppy.go +++ b/pkg/strategey/ema_choppy.go @@ -70,13 +70,13 @@ func (df *DataFrameCandle) OptimizeEmaChoppy() (performance float64, bestPeriod1 runtime.GOMAXPROCS(10) bestPeriod1 = 5 bestPeriod2 = 21 - bestChoppy = 50 + bestChoppy = 13 limit := 1000 slots := make(chan struct{}, limit) - a := trader.NewAccount(1000) - marketDefault, _ := BuyAndHoldingStrategy(a) + // a := trader.NewAccount(1000) + // marketDefault, _ := BuyAndHoldingStrategy(a) var mu sync.Mutex var wg sync.WaitGroup @@ -97,15 +97,15 @@ func (df *DataFrameCandle) OptimizeEmaChoppy() (performance float64, bestPeriod1 return } - if analytics.TotalTrades(signalEvents) < 20 { + if analytics.TotalTrades(signalEvents) < 5 { <-slots return } - if analytics.NetProfit(signalEvents) < marketDefault { - <-slots - return - } + // if analytics.NetProfit(signalEvents) < marketDefault { + // <-slots + // return + // } // if analytics.WinRate(signalEvents) < 0.50 { // <-slots @@ -139,7 +139,7 @@ func (df *DataFrameCandle) OptimizeEmaChoppy() (performance float64, bestPeriod1 wg.Wait() - fmt.Println("最高パフォーマンス", performance, "最適な短期線", bestPeriod1, "最適な長期線", bestPeriod2, "最適なチョッピー", bestChoppy) + fmt.Println("最高SQN", performance, "最適な短期線", bestPeriod1, "最適な長期線", bestPeriod2, "最適なチョッピー", bestChoppy) return performance, bestPeriod1, bestPeriod2, bestChoppy } diff --git a/pkg/strategey/rsi.go b/pkg/strategey/rsi.go index 4d4e145..176b8cd 100644 --- a/pkg/strategey/rsi.go +++ b/pkg/strategey/rsi.go @@ -69,219 +69,6 @@ func (df *DataFrameCandle) RsiStrategy(period int, buyThread float64, sellThread return signalEvents } - -func (df *DataFrameCandle) OptimizeRsiProfit() (performance float64, bestPeriod int, bestBuyThread, bestSellThread float64) { - account := trader.NewAccount(1000) - bestPeriod = 14 - bestBuyThread, bestSellThread = 20.0, 80.0 - - for period := 3; period < 25; period++ { - for buyThread := 30.0; buyThread > 5; buyThread -= 1 { - - for sellThread := 70.0; sellThread < 98; sellThread += 1 { - signalEvents := df.RsiStrategy(period, buyThread, sellThread, account) - if signalEvents == nil { - continue - } - - if analytics.TotalTrades(signalEvents) < 5 { - continue - } - - payOffRatio := analytics.NetProfit(signalEvents) - if performance == 0 || performance < payOffRatio { - performance = payOffRatio - bestPeriod = period - bestBuyThread = buyThread - bestSellThread = sellThread - } - } - } - - } - - fmt.Println("最高利益", performance, "最適なピリオド", bestPeriod, "最適な買いライン", bestBuyThread, "最適な売りライン", bestSellThread) - - return performance, bestPeriod, bestBuyThread, bestSellThread -} - -func (df *DataFrameCandle) OptimizeRsiWinRate() (performance float64, bestPeriod int, bestBuyThread, bestSellThread float64) { - - account := trader.NewAccount(1000) - bestPeriod = 14 - bestBuyThread, bestSellThread = 20.0, 80.0 - - for period := 4; period < 30; period++ { - for buyThread := 30.0; buyThread > 10; buyThread -= 1 { - - for sellThread := 70.0; sellThread < 96; sellThread += 1 { - signalEvents := df.RsiStrategy(period, buyThread, sellThread, account) - if signalEvents == nil { - continue - } - - if analytics.TotalTrades(signalEvents) < 20 { - continue - } - - winrate := analytics.WinRate(signalEvents) - if performance < winrate { - performance = winrate - bestPeriod = period - bestBuyThread = buyThread - bestSellThread = sellThread - } - } - } - - } - - fmt.Println("最高勝率", performance*100, "%", "最適なピリオド", bestPeriod, "最適な買いライン", bestBuyThread, "最適な売りライン", bestSellThread) - - return performance, bestPeriod, bestBuyThread, bestSellThread -} - -func (df *DataFrameCandle) OptimizeRsiLoss() (performance float64, bestPeriod int, bestBuyThread, bestSellThread float64) { - account := trader.NewAccount(1000) - bestPeriod = 14 - bestBuyThread, bestSellThread = 20.0, 80.0 - performance = math.MaxFloat64 - - for period := 4; period < 30; period++ { - for buyThread := 30.0; buyThread > 10; buyThread -= 1 { - - for sellThread := 70.0; sellThread < 96; sellThread += 1 { - signalEvents := df.RsiStrategy(period, buyThread, sellThread, account) - if signalEvents == nil { - continue - } - - if analytics.TotalTrades(signalEvents) < 20 { - continue - } - - loss := analytics.Loss(signalEvents) - if performance > loss { - performance = loss - bestPeriod = period - bestBuyThread = buyThread - bestSellThread = sellThread - } - } - } - - } - - fmt.Println("損失", performance, "最適なピリオド", bestPeriod, "最適な買いライン", bestBuyThread, "最適な売りライン", bestSellThread) - - return performance, bestPeriod, bestBuyThread, bestSellThread -} - -func (df *DataFrameCandle) OptimizeRsiProfitFactor() (performance float64, bestPeriod int, bestBuyThread, bestSellThread float64) { - account := trader.NewAccount(1000) - bestPeriod = 14 - bestBuyThread, bestSellThread = 20.0, 80.0 - - for period := 4; period < 30; period++ { - for buyThread := 30.0; buyThread > 10; buyThread -= 1 { - - for sellThread := 70.0; sellThread < 96; sellThread += 1 { - signalEvents := df.RsiStrategy(period, buyThread, sellThread, account) - if signalEvents == nil { - continue - } - - if analytics.TotalTrades(signalEvents) < 20 { - continue - } - - profitFactor := analytics.ProfitFactor(signalEvents) - if performance < profitFactor { - performance = profitFactor - bestPeriod = period - bestBuyThread = buyThread - bestSellThread = sellThread - } - } - } - - } - - fmt.Println("プロフィットファクター", performance, "最適なピリオド", bestPeriod, "最適な買いライン", bestBuyThread, "最適な売りライン", bestSellThread) - - return performance, bestPeriod, bestBuyThread, bestSellThread -} - -func (df *DataFrameCandle) OptimizeRsiPayOffRatio() (performance float64, bestPeriod int, bestBuyThread, bestSellThread float64) { - account := trader.NewAccount(1000) - bestPeriod = 14 - bestBuyThread, bestSellThread = 20.0, 80.0 - - for period := 3; period < 25; period++ { - for buyThread := 30.0; buyThread > 10; buyThread -= 1 { - - for sellThread := 75.0; sellThread < 96; sellThread += 1 { - signalEvents := df.RsiStrategy(period, buyThread, sellThread, account) - if signalEvents == nil { - continue - } - - if analytics.TotalTrades(signalEvents) < 20 { - continue - } - - payOffRatio := analytics.PayOffRatio(signalEvents) - if performance == 0 || performance < payOffRatio { - performance = payOffRatio - bestPeriod = period - bestBuyThread = buyThread - bestSellThread = sellThread - } - } - } - - } - - fmt.Println("ペイオフレシオ", performance, "最適なピリオド", bestPeriod, "最適な買いライン", bestBuyThread, "最適な売りライン", bestSellThread) - - return performance, bestPeriod, bestBuyThread, bestSellThread -} - -func (df *DataFrameCandle) OptimizeRsiSharpRatio() (performance float64, bestPeriod int, bestBuyThread, bestSellThread float64) { - account := trader.NewAccount(1000) - bestPeriod = 14 - bestBuyThread, bestSellThread = 20.0, 80.0 - - for period := 4; period < 30; period++ { - for buyThread := 30.0; buyThread > 10; buyThread -= 1 { - - for sellThread := 70.0; sellThread < 96; sellThread += 1 { - signalEvents := df.RsiStrategy(period, buyThread, sellThread, account) - if signalEvents == nil { - continue - } - - if analytics.TotalTrades(signalEvents) < 20 { - continue - } - - sharpeRatio := analytics.SharpeRatio(signalEvents, 0.06) - if performance < sharpeRatio { - performance = sharpeRatio - bestPeriod = period - bestBuyThread = buyThread - bestSellThread = sellThread - } - } - } - - } - - fmt.Println("シャープレシオ", performance, "最適なピリオド", bestPeriod, "最適な買いライン", bestBuyThread, "最適な売りライン", bestSellThread) - - return performance, bestPeriod, bestBuyThread, bestSellThread -} - func (df *DataFrameCandle) OptimizeRsi() (performance float64, bestPeriod int, bestBuyThread, bestSellThread float64) { runtime.GOMAXPROCS(10) @@ -291,15 +78,15 @@ func (df *DataFrameCandle) OptimizeRsi() (performance float64, bestPeriod int, b limit := 1000 slots := make(chan struct{}, limit) - // a := trader.NewAccount(1000) + a := trader.NewAccount(1000) + marketDefault, _ := BuyAndHoldingStrategy(a) - // marketDefault, _ := BuyAndHoldingStrategy(a) var mu sync.Mutex var wg sync.WaitGroup for period := 2; period < 30; period++ { - for buyThread := 45.0; buyThread > 10; buyThread -= 1 { - for sellThread := 55.0; sellThread < 96; sellThread += 1 { + for buyThread := 25.0; buyThread > 9; buyThread -= 1 { + for sellThread := 75.0; sellThread < 96; sellThread += 1 { wg.Add(1) slots <- struct{}{} go func(period int, buyThread, sellThread float64) { @@ -317,20 +104,20 @@ func (df *DataFrameCandle) OptimizeRsi() (performance float64, bestPeriod int, b return } - // if analytics.NetProfit(signalEvents) < marketDefault { - // return - // } - - if analytics.WinRate(signalEvents) < 0.50 { - <-slots + if analytics.NetProfit(signalEvents) < marketDefault { return } + // if analytics.WinRate(signalEvents) < 0.50 { + // <-slots + // return + // } + // if analytics.PayOffRatio(signalEvents) < 1 { // return // } - p := analytics.ProfitFactor(signalEvents) + p := analytics.SQN(signalEvents) mu.Lock() if performance == 0 || performance < p { performance = p diff --git a/pkg/strategey/supertorend_choppy.go b/pkg/strategey/supertorend_choppy.go index fd4272e..2e5ff97 100644 --- a/pkg/strategey/supertorend_choppy.go +++ b/pkg/strategey/supertorend_choppy.go @@ -47,7 +47,7 @@ func (df *DataFrameCandle) SuperTrendChoppyStrategy(atrPeriod int, factor float6 isBuyHolding := false - for i := 1; i < lenCandles; i++ { + for i := 1; i < len(choppyEma); i++ { if i < atrPeriod { // fmt.Printf("Skipping iteration %d due to insufficient data.\n", i) @@ -90,8 +90,8 @@ func (df *DataFrameCandle) OptimizeSuperTrend() (performance float64, bestAtrPer limit := 1000 slots := make(chan struct{}, limit) - a := trader.NewAccount(1000) - marketDefault, _ := BuyAndHoldingStrategy(a) + // a := trader.NewAccount(1000) + // marketDefault, _ := BuyAndHoldingStrategy(a) var mu sync.Mutex var wg sync.WaitGroup @@ -117,10 +117,10 @@ func (df *DataFrameCandle) OptimizeSuperTrend() (performance float64, bestAtrPer return } - if analytics.NetProfit(signalEvents) < marketDefault { - <-slots - return - } + // if analytics.NetProfit(signalEvents) < marketDefault { + // <-slots + // return + // } // if analytics.WinRate(signalEvents) < 0.50 { // <-slots diff --git a/pkg/strategey/supertrend.go b/pkg/strategey/supertrend.go index 808f64d..84e1db8 100644 --- a/pkg/strategey/supertrend.go +++ b/pkg/strategey/supertrend.go @@ -106,7 +106,7 @@ func (df *DataFrameCandle) OptimizeST() (performance float64, bestAtrPeriod int, return } - if analytics.TotalTrades(signalEvents) < 3 { + if analytics.TotalTrades(signalEvents) < 5 { <-slots return }