Compare commits

...

10 Commits

Author SHA1 Message Date
kyh
9fce4b8636 short수정 2025-09-15 12:51:30 +09:00
kyh
738783473c 수정 2025-08-26 12:49:38 +09:00
kyh
f6b5cdda37 sell price 수정 2025-08-22 15:15:20 +09:00
kyh
424f4fad73 오류 수정 2025-08-18 10:30:27 +09:00
kyh
bb9777f2b1 retouch 코드 수정 2025-08-13 12:49:22 +09:00
kyh
d9ad08d6ad high 조건 추가 2025-08-11 09:56:02 +09:00
kyh
d030c3004c Short 관련 수정 2025-08-08 10:57:12 +09:00
kyh
73c30648d7 재수정 2025-08-06 15:06:38 +09:00
kyh
e02cb70d30 실식가 rate 처리 반영
Short 개선 반영
2025-08-06 10:51:08 +09:00
kyh
29cdaa5156 Sideway Percent로직 추가 2025-07-31 13:36:43 +09:00
3 changed files with 168 additions and 151 deletions

View File

@@ -115,11 +115,11 @@ namespace BitgetAPI.IndicatorConditionSetup
public Dictionary<string, Dictionary<int, bool>> SellShortStep = new Dictionary<string, Dictionary<int, bool>>();
public Dictionary<string, Dictionary<int, bool>> SellLongStep = new Dictionary<string, Dictionary<int, bool>>();
public Dictionary<string, int> BuyShortStep = new Dictionary<string, int>();
public Dictionary<string, int> BuyLongStep = new Dictionary<string, int>();
//public Dictionary<string, int> BuyShortStep = new Dictionary<string, int>();
//public Dictionary<string, int> BuyLongStep = new Dictionary<string, int>();
public Dictionary<string, double> BuyShortStepStampData = new Dictionary<string, double>();
public Dictionary<string, double> BuyLongStepStampData = new Dictionary<string, double>();
//public Dictionary<string, double> BuyShortStepStampData = new Dictionary<string, double>();
//public Dictionary<string, double> BuyLongStepStampData = new Dictionary<string, double>();
public Dictionary<string, bool> FirstFlag = new Dictionary<string, bool>();
@@ -153,7 +153,7 @@ namespace BitgetAPI.IndicatorConditionSetup
//var sellData = FutureOrder("XRPUSDT", FutureMarginMode.isolated, 10, 0, FutureSide.SellShort, OrderType.market, 10, orderDic["orderId"]);
var totalImperseMACDData = new Dictionary<string, Dictionary<DateTime, ImpulseMacdData>>();
var 전저고점Flag = true;
// 추후 공통화 및 소스정리 필요
while (true)
{
@@ -230,89 +230,89 @@ namespace BitgetAPI.IndicatorConditionSetup
// Description
var strInterval = Utils.Convertor.GetEnumDescription((Enum)interval);
if (!intervalList.Contains(strInterval)) continue;
//if (nowTime.Minute == 0 && nowTime.Hour == 24 && 전저고점Flag)
//{
// 전저고점.Clear();
// 전저고점Flag = false;
//}
if (nowTime.Minute == 0 && nowTime.Hour == 24 && 전저고점Flag)
{
전저고점.Clear();
전저고점Flag = false;
}
if (!전저고점.ContainsKey(market + strInterval))
if (!FirstFlag.ContainsKey(market + strInterval + "Long"))
{
FirstFlag.Add(market + strInterval + "Long", false);
FirstFlag.Add(market + strInterval + "Short", false);
var dic = new Dictionary<string, double>
{
{ "전고가", 0 },
{ "전저가", 0 },
{ "전전고가", 0 },
{ "전전저가", 0 },
{ "전전전저가", 0 },
{ "전전전고가", 0 },
{ "전전전전저가", 0 },
{ "전전전전고가", 0 },
{ "tempHighVal", 0 },
{ "tempLowVal", 0 },
{ "tempHigh2Val", 0 },
{ "tempLow2Val", 0 },
{ "tempHigh3Val", 0 },
{ "tempLow3Val", 0 },
{ "tempHigh4Val", 0 },
{ "tempLow4Val", 0 },
{ "switchLowVal", 0 },
{ "switchHighVal", 0 }
};
//var dic = new Dictionary<string, double>
//{
// { "전고가", 0 },
// { "전저가", 0 },
// { "전전고가", 0 },
// { "전전저가", 0 },
// { "전전전저가", 0 },
// { "전전전고가", 0 },
// { "전전전전저가", 0 },
// { "전전전전고가", 0 },
// { "tempHighVal", 0 },
// { "tempLowVal", 0 },
// { "tempHigh2Val", 0 },
// { "tempLow2Val", 0 },
// { "tempHigh3Val", 0 },
// { "tempLow3Val", 0 },
// { "tempHigh4Val", 0 },
// { "tempLow4Val", 0 },
// { "switchLowVal", 0 },
// { "switchHighVal", 0 }
//};
전저고점.Add(market + strInterval, dic);
//전저고점.Add(market + strInterval, dic);
var candleDatas_Temp = findedMarket.candleDataList[interval];
var candleDatas_정렬_Temp = candleDatas_Temp.OrderBy(i => i.Argument).ToList();
var candleDatas_Temp_List = new List<CandleData>();
//var candleDatas_Temp = findedMarket.candleDataList[interval];
//var candleDatas_정렬_Temp = candleDatas_Temp.OrderBy(i => i.Argument).ToList();
//var candleDatas_Temp_List = new List<CandleData>();
totalImperseMACDData[market + strInterval] = new Dictionary<DateTime, ImpulseMacdData>();
//totalImperseMACDData[market + strInterval] = new Dictionary<DateTime, ImpulseMacdData>();
for (var i = 0; i < 199; i++)
candleDatas_Temp_List.Add(candleDatas_정렬_Temp[i]);
//for (var i = 0; i < 199; i++)
// candleDatas_Temp_List.Add(candleDatas_정렬_Temp[i]);
for (var i = 199; i < candleDatas_정렬_Temp.Count; i++)
{
//for (var i = 199; i < candleDatas_정렬_Temp.Count; i++)
//{
var candleData_Main = candleDatas_정렬_Temp[i];
// var candleData_Main = candleDatas_정렬_Temp[i];
if (candleData_Main == null) continue;
// if (candleData_Main == null) continue;
candleDatas_Temp_List.Add(candleData_Main);
// candleDatas_Temp_List.Add(candleData_Main);
ichimokuConditionSetup.calIchimokuData(candleDatas_Temp_List, candleData_Main);
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_Temp_List, candleData_Main);
// ichimokuConditionSetup.calIchimokuData(candleDatas_Temp_List, candleData_Main);
// movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_Temp_List, candleData_Main);
if (i > 210)
{
var 현재봉4_Temp = candleDatas_Temp_List[i].movingAverageDataList[4].Value;
var 전봉4_Temp = candleDatas_Temp_List[i - 1].movingAverageDataList[4].Value;
var 전전봉4_Temp = candleDatas_Temp_List[i - 2].movingAverageDataList[4].Value;
var 전전전봉4_Temp = candleDatas_Temp_List[i - 3].movingAverageDataList[4].Value;
// if (i > 210)
// {
// var 현재봉4_Temp = candleDatas_Temp_List[i].movingAverageDataList[4].Value;
// var 전봉4_Temp = candleDatas_Temp_List[i - 1].movingAverageDataList[4].Value;
// var 전전봉4_Temp = candleDatas_Temp_List[i - 2].movingAverageDataList[4].Value;
// var 전전전봉4_Temp = candleDatas_Temp_List[i - 3].movingAverageDataList[4].Value;
var returnVal = Calculate전고점(market, strInterval, interval, 전봉4_Temp, 전전봉4_Temp, 전전전봉4_Temp, candleDatas_Temp_List[candleDatas_Temp_List.Count - 1]);
}
}
// var returnVal = Calculate전고점(market, strInterval, interval, 전봉4_Temp, 전전봉4_Temp, 전전전봉4_Temp, candleDatas_Temp_List[candleDatas_Temp_List.Count - 1]);
// }
//}
}
else {
if(nowTime.Minute > 0 && nowTime.Hour == 24)
전저고점Flag = true;
}
//else {
// if(nowTime.Minute > 0 && nowTime.Hour == 24)
// 전저고점Flag = true;
//}
if (!BuyShortStep.ContainsKey(market))
{
BuyShortStep[market] = 0;
BuyLongStep[market] = 0;
}
if (!(전저고점.ContainsKey(market + "30m")))
continue;
//if (!BuyShortStep.ContainsKey(market))
//{
// BuyShortStep[market] = 0;
// BuyLongStep[market] = 0;
//}
//if (!(전저고점.ContainsKey(market + "30m")))
// continue;
#region 5분봉 처리
#region 30분봉 처리
var candleDatas_30 = findedMarket.candleDataList[MCandleTimeType.M30];
var candleDatas_30_정렬 = candleDatas_30.OrderBy(i => i.Argument).ToList();
@@ -353,7 +353,9 @@ namespace BitgetAPI.IndicatorConditionSetup
ichimokuConditionSetup.calIchimokuData(candleDatas_30_정렬, candleData_30_전전전전봉);
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_30_정렬, candleData_30_전전전전봉);
#endregion
var 저고점 = 전저고점[market + strInterval];
//var 저고점 = 전저고점[market + strInterval];
if (영호조건식_상향돌파 || 영호조건식_하향돌파)
{
if (영호조건식_상향돌파)
@@ -373,21 +375,21 @@ namespace BitgetAPI.IndicatorConditionSetup
//사는 시점
if (!UpBuyList.ContainsKey(market))
{
if(!FirstFlag[market + strInterval + "Long"])
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) &&
FirstFlag[market + strInterval + "Long"]
if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongBuy, true)
&& FirstFlag[market + strInterval + "Long"]
//&& 저고점["전저가"] > 저고점["전전저가"]
)
{
BuyLongStep[market] = 0;
//BuyLongStep[market] = 0;
// 없으면 생성
if (signalData == null)
{
@@ -409,7 +411,7 @@ namespace BitgetAPI.IndicatorConditionSetup
{ "MarketName", market },
{ "BuyDate", nowTime },
{ "Price", price },
{ "Flag", 저고점["전저가"] > 저고점["전전저가"] },
//{ "Flag", 저고점["전저가"] > 저고점["전전저가"] },
{ "MCandleTimeType", (int)interval },
{ "CandleTime", candleData_30.Argument },
{ "Candle", candleData_30 }
@@ -429,7 +431,7 @@ namespace BitgetAPI.IndicatorConditionSetup
if (LongCount < 5)
{
double size = YHKIM_OrderAmount / price * YHKIM_Leverage;
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.BuyLong, OrderType.limit, YHKIM_Leverage);
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.BuyLong, OrderType.market, YHKIM_Leverage);
if (orderData != null)
{
var orderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(orderData["data"]));
@@ -456,7 +458,7 @@ namespace BitgetAPI.IndicatorConditionSetup
{
var buyItem = UpBuyList[market];
var flag = (bool)buyItem["Flag"];
if (interval < MCandleTimeType.H1)
{
var buyTime = ((DateTime)buyItem["BuyDate"]).AddMinutes(30);
@@ -474,22 +476,22 @@ namespace BitgetAPI.IndicatorConditionSetup
var sellFlag = false;
if (!flag)
{
if (저고점["전저가"] > 저고점["전전저가"])
buyItem["Flag"] = true;
}
else
{
if (저고점["전저가"] < 저고점["전전저가"] || 저고점["전저가"] > candleData_30_전봉.Close)
sellFlag = true;
}
//if (!flag)
//{
// if (저고점["전저가"] > 저고점["전전저가"])
// buyItem["Flag"] = true;
//}
//else
//{
// if (저고점["전저가"] < 저고점["전전저가"] || 저고점["전저가"] > candleData_30_전봉.Close)
// 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;
BuyLongStep[market] = 0;
//BuyLongStep[market] = 0;
var result = new Dictionary<string, object>()
{
{ "MarketName", market },
@@ -576,20 +578,18 @@ 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) &&
FirstFlag[market + strInterval + "Short"]
//&& 저고점["전고가"] < 저고점["전전고가"])
)
if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortBuy, true)
&& FirstFlag[market + strInterval + "Short"])
{
BuyShortStep[market] = 0;
//BuyShortStep[market] = 0;
// 없으면 생성
if (signalData == null)
{
@@ -609,8 +609,7 @@ namespace BitgetAPI.IndicatorConditionSetup
{
{ "MarketName", market },
{ "BuyDate", nowTime },
{ "Price", price },
{ "Flag", 저고점["전고가"] < 저고점["전전고가"] },
{ "Price", price },
{ "MCandleTimeType", (int)interval },
{ "CandleTime", candleData_30.Argument },
{ "Candle", candleData_30 }
@@ -630,7 +629,7 @@ namespace BitgetAPI.IndicatorConditionSetup
if (ShortCount < 5)
{
double size = YHKIM_OrderAmount / price * YHKIM_Leverage;
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, price, FutureSide.BuyShort, OrderType.limit, YHKIM_Leverage);
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.BuyShort, OrderType.market, YHKIM_Leverage);
if (orderData != null)
{
var orderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(orderData["data"]));
@@ -657,7 +656,7 @@ namespace BitgetAPI.IndicatorConditionSetup
else
{
var buyItem = DownBuyList[market];
var flag = (bool)buyItem["Flag"];
if (interval < MCandleTimeType.H1)
{
var buyTime = ((DateTime)buyItem["BuyDate"]).AddMinutes(30);
@@ -678,20 +677,20 @@ namespace BitgetAPI.IndicatorConditionSetup
var sellFlag = false;
if (!flag)
{
if (저고점["전고가"] < 저고점["전전고가"])
buyItem["Flag"] = true;
}
else
{
if (저고점["전고가"] > 저고점["전전고가"] || 저고점["전고가"] < candleData_30_전봉.Close)
sellFlag = true;
}
//if (!flag)
//{
// if (저고점["전고가"] < 저고점["전전고가"])
// buyItem["Flag"] = true;
//}
//else
//{
// if (저고점["전고가"] > 저고점["전전고가"] || 저고점["전고가"] < candleData_30_전봉.Close)
// 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;
//BuyShortStep[market] = 0;
double.TryParse(buyItem["Price"].ToString(), out var buyPrice);
var resultRate = ((price - buyPrice) / buyPrice) * 100;

View File

@@ -37,7 +37,7 @@ namespace BitgetApi.IndicatorConditionSetup
private bool firstCloudFlag = true;
public bool Calculate(List<CandleData> candles, SMABandType type, string market, bool flag = false)
public bool Calculate(List<CandleData> candles, SMABandType type, bool flag = false)
{
var close = candles.Select(t => t.Close).ToList();
@@ -60,21 +60,36 @@ namespace BitgetApi.IndicatorConditionSetup
if (close.Count < 100 || high.Count < 100 || low.Count < 100 || open.Count < 100)
return false;
var longAverage = 0.0;
var shortAverage = 0.0;
var avgLongList = new List<double>();
var avgShortList = new List<double>();
for (var j = 0; j < 120; j++)
{
longAverage += (candles[j].High - candles[j].Low) / candles[j].Close * 100;
shortAverage += (candles[j].High - candles[j].Low) / candles[j].Close * 100;
for (var cntData = high.Count - 120; cntData < high.Count; cntData++)
{
var lowestData = Lowest(low, cntData, 12, 1);
var highData = high[cntData];
avgLongList.Add((highData - lowestData)/lowestData * 100);
}
rangeThresholdLongPercent = longAverage / 120 * 2;
rangeThresholdShortPercent = shortAverage / 120 * 1.7;
for (var cntData = high.Count - 12; cntData < high.Count; cntData++)
{
var highestData = Highest(high, cntData, 4, 1);
var lowData = low[cntData];
avgShortList.Add((highestData - lowData) / highestData * 100);
}
rangeThresholdLongPercent = avgLongList.Average();
rangeThresholdShortPercent = avgShortList.Average() * 2.5;
double sma72 = CalculateSMA(close, i);
double prevSma72 = CalculateSMA(close, i - 1);
double sma24 = CalculateSMA(close, i, 24);
double prevSma24 = CalculateSMA(close, i - 1, 24);
// SMA4 관련
double sma4 = CalculateSMA(close, i, 4);
double prevSma4 = CalculateSMA(close, i - 1, 4);
@@ -83,20 +98,20 @@ namespace BitgetApi.IndicatorConditionSetup
// 밴드 계산
double sma4High = Highest(close, i, 12, 4);
double sma4Middle = CalculateSMA(close, i, 12);
double sma4Middle = Middle(close, i, 12, 4);
double sma4Low = Lowest(close, i, 12, 4);
double prevSma4High = Highest(close, i - 1, 12, 4);
double prevSma4Middle = CalculateSMA(close, i - 1, 12);
double prevSma4Middle = Middle(close, i - 1, 12, 4);
double prevSma4Low = Lowest(close, i - 1, 12, 4);
double prev2Sma4High = Highest(close, i - 2, 12, 4);
double prev2Sma4Low = Lowest(close, i - 2, 12, 4);
double prev2Sma4Middle = CalculateSMA(close, i - 2, 12);
double prev2Sma4Middle = Middle(close, i - 2, 12, 4);
double prev3Sma4High = Highest(close, i - 3, 12, 4);
double prev3Sma4Low = Lowest(close, i - 3, 12, 4);
double prev3Sma4Middle = CalculateSMA(close, i - 3, 12);
double prev3Sma4Middle = Middle(close, i - 3, 12, 4);
var ichmok = GetIchimokuCloud(candles, i - 25);
@@ -105,40 +120,36 @@ namespace BitgetApi.IndicatorConditionSetup
var cloudTopNow = Math.Max(ichmok.SenkouSpanA, ichmok.SenkouSpanB);
var cloudBottomNow = Math.Min(ichmok.SenkouSpanA, ichmok.SenkouSpanB);
var cloudTopAfter = Math.Max(ichmokCurrent.SenkouSpanA, ichmokCurrent.SenkouSpanB);
var cloudBottomAfter = Math.Min(ichmokCurrent.SenkouSpanA, ichmokCurrent.SenkouSpanB);
bool isSma4BelowCloud = low[i] < cloudBottomNow;
bool isSma4AboveCloud = high[i] > cloudTopNow;
bool isSma4AboveCloud = high[i] > cloudTopNow;
bool greenCandle = open[i] < close[i];
bool redCandle = open[i] > close[i];
var isLongRecentTouch = true;
var isShortRecentTouch = true;
var isLongRecentTouch = false;
for (var cnt = 0; cnt < 10; cnt++)
{
if (Lowest(close, i - cnt, 12, 4) == CalculateSMA(close, i - cnt, 12) && Lowest(close, i - cnt-1, 12, 4) <= CalculateSMA(close, i - cnt-1, 12))
{
if (Lowest(close, i - cnt, 12, 4) == CalculateSMA(close, i - cnt, 4) && Lowest(close, i - cnt - 1, 12, 4) <= CalculateSMA(close, i - cnt - 1, 4))
{
isLongRecentTouch = false;
isLongRecentTouch = true;
break;
}
}
for (var cnt = 0; cnt < 5; cnt++)
{
if (Highest(close, i - cnt, 12, 4) == CalculateSMA(close, i - cnt, 12) && Highest(close, i - cnt - 1, 12, 4) >= CalculateSMA(close, i - cnt - 1, 12))
{
isShortRecentTouch = false;
break;
}
}
//high 데이터 비교(기본 12개)
var highestTempData = Highest(high, i, 12, 1);
// 진입/청산 조건
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 rawNewLong = highestTempData == high[i] && 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);
bool rawShortSell = sma4 > cloudBottomNow;
bool rawNewShort = (sma72 < cloudTopNow && prevSma4Middle > prevSma24 && sma4Middle > cloudBottomNow && sma4 < sma72 && sma4High > sma72 && sma24 > sma4Middle && sma4 == sma4Low && IsSideways(high, low, i, false, rangeThresholdShortPercent) && prevSma4 > sma4 && sma4 < cloudBottomNow) || (sma4 < sma72 && sma4High > sma72 && sma24 < sma4Middle && sma4 == sma4Low && IsSideways(high, low, i, false, rangeThresholdShortPercent) && redCandle && sma4 < cloudBottomNow && sma4Middle < cloudTopNow);
bool rawShortSell = (sma4High <= sma4 && sma4High < sma72) || 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);
@@ -200,13 +211,20 @@ namespace BitgetApi.IndicatorConditionSetup
private double Highest(List<double> source, int index, int period, int num)
{
return GetAvgList(source, index, period, 4).Max();
return GetAvgList(source, index, period, num).Max();
}
private double Middle(List<double> source, int index, int period, int num)
{
return GetAvgList(source, index, period, num).Average();
}
private double Lowest(List<double> source, int index, int period, int num)
{
return GetAvgList(source, index, period, 4).Min();
return GetAvgList(source, index, period, num).Min();
}
private bool IsSideways(List<double> high, List<double> low, int index, bool type, double rangeThresholdPercent)

View File

@@ -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));
@@ -1157,7 +1157,7 @@ namespace BitgetAPI.WebService
{
var max = candleDataList.Max(t => t.Argument);
lastCandleData = candleDataList.Find(t => t.Argument == max);
lastCandleData.Open = 0;
var flag = false;
if (((int)mCandleTimeType) < 60)
{
@@ -1245,7 +1245,8 @@ namespace BitgetAPI.WebService
{
candleData.WebSocketUpdate = true;
lastCandleData.Close = candleData.Open;
if(lastCandleData.High < lastCandleData.Close)
if (lastCandleData.High < lastCandleData.Close)
{
lastCandleData.High = lastCandleData.Close;
}
@@ -1260,8 +1261,7 @@ namespace BitgetAPI.WebService
if((int)mCandleTimeType > 60)
{
dt = dt.AddMinutes(dt.Minute * -1);
}
}
// 새 데이터 등록
candleDataList.Add(candleData);