diff --git a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs index c2859ea..94a78ef 100644 --- a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs +++ b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs @@ -375,14 +375,14 @@ namespace BitgetAPI.IndicatorConditionSetup { if(!FirstFlag[market + strInterval + "Long"]) { - if(sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongSell, market, true)) + if(sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongSell, true)) { FirstFlag[market + strInterval + "Long"] = true; } } - if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongBuy, market, true) && - !sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongSell, market, true) && + if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongBuy, true) && + !sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongSell, true) && FirstFlag[market + strInterval + "Long"] //&& 저고점["전저가"] > 저고점["전전저가"] ) @@ -485,7 +485,7 @@ namespace BitgetAPI.IndicatorConditionSetup sellFlag = true; } - if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongSell, market, true) || sellFlag) + if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongSell, true) || sellFlag) { double.TryParse(buyItem["Price"].ToString(), out var buyPrice); var resultRate = ((price - buyPrice) / buyPrice) * 100; @@ -576,15 +576,15 @@ namespace BitgetAPI.IndicatorConditionSetup { if (!FirstFlag[market + strInterval + "Short"]) { - if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortSell, market, true)) + if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortSell, true)) { FirstFlag[market + strInterval + "Short"] = true; } } - if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortBuy, market, true) && - !sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortSell, market, true) && + if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortBuy, true) && + !sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortSell, true) && FirstFlag[market + strInterval + "Short"] //&& 저고점["전고가"] < 저고점["전전고가"]) ) @@ -689,7 +689,7 @@ namespace BitgetAPI.IndicatorConditionSetup sellFlag = true; } - if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortSell, market, true) || sellFlag) + if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortSell, true) || sellFlag) { BuyShortStep[market] = 0; double.TryParse(buyItem["Price"].ToString(), out var buyPrice); diff --git a/BitgetApi/IndicatorConditionSetup/SMABandConditionSetup.cs b/BitgetApi/IndicatorConditionSetup/SMABandConditionSetup.cs index 44d3548..a98c267 100644 --- a/BitgetApi/IndicatorConditionSetup/SMABandConditionSetup.cs +++ b/BitgetApi/IndicatorConditionSetup/SMABandConditionSetup.cs @@ -37,7 +37,7 @@ namespace BitgetApi.IndicatorConditionSetup private bool firstCloudFlag = true; - public bool Calculate(List candles, SMABandType type, string market, bool flag = false) + public bool Calculate(List candles, SMABandType type, bool flag = false) { var close = candles.Select(t => t.Close).ToList(); @@ -133,8 +133,8 @@ namespace BitgetApi.IndicatorConditionSetup bool rawNewLong = isLongRecentTouch && greenCandle && IsSideways(high, low, i, true, rangeThresholdLongPercent) && prevSma4 <= sma4 && sma4High == sma4 && prevSma4High >= prevSma4 && (prev2Sma4Middle - prevSma4Middle) > (prevSma4Middle - sma4Middle) && sma4Middle > sma72 && sma4 > cloudTopNow; bool rawLongSell = (sma4Middle < sma72 && prevSma4Middle > prevSma72) || (sma4 == sma4Low); - bool rawNewShort = sma4High < cloudBottomNow && sma4 == sma4Low && IsSideways(high, low, i, false, rangeThresholdShortPercent) && redCandle; - bool rawShortSell = sma4 > cloudBottomNow; + bool rawNewShort = sma72 > sma4 && sma4High > cloudTopNow && sma4 == sma4Low && IsSideways(high, low, i, true, rangeThresholdShortPercent) && redCandle && sma4 < cloudTopNow; + bool rawShortSell = sma4High < close[i] || sma4 > sma72; //bool rawNewLong = greenCandle && sma4Low < sma72 && IsSideways(high, low, i, true) && sma4 > cloudTopNow && prevSma4 <= prevSma4High && sma4 == sma4High && prevSma4 < sma4 && sma4Middle > sma72 && sma4 > cloudTopNow && ichmok.SenkouSpanA >= ichmok.SenkouSpanB && ichmokCurrent.SenkouSpanA >= ichmokCurrent.SenkouSpanB; //sma4 == sma4High && prevSma4 < sma4High && sma4Middle > sma72 && sma4 > cloudTopNow && ichmokCurrent.SenkouSpanA > ichmokCurrent.SenkouSpanB && ichmok.SenkouSpanA >= ichmok.SenkouSpanB; // sma4 > cloudBottomNow && IsSideways(high, low, i, true) && isSma4AboveCloud && (sma4 == sma4High && prevSma4 <= prevSma4High && prev2Sma4 <= prev2Sma4High) && (sma4 >= prevSma4 && prevSma4 >= prev2Sma4 && prev2Sma4 >= prev3Sma4); diff --git a/BitgetApi/WebService/WebConnection.cs b/BitgetApi/WebService/WebConnection.cs index 074a82a..25be944 100644 --- a/BitgetApi/WebService/WebConnection.cs +++ b/BitgetApi/WebService/WebConnection.cs @@ -1056,7 +1056,7 @@ namespace BitgetAPI.WebService candleDataList.Add(candleData); // 기존 데이터 삭제 - if (candleDataList.Count > 500) + if (candleDataList.Count > 1000) { // 가장 오래된 데이터 삭제 candleDataList.Remove(j => j.Argument == candleDataList.Min(i => i.Argument));