From 66fad27433f060677987ae386631c8eaae61d5d9 Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Fri, 21 Jun 2024 11:39:32 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IndicatorProcess.cs | 83 +++++++++++-------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs index 7ccb542..2e259c0 100644 --- a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs +++ b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs @@ -76,7 +76,7 @@ namespace BitgetAPI.IndicatorConditionSetup continue; } - + var findedMarket = commonProperty.candleDataLists.Find(i => i.ConGoodsData.MarketName == item.MarketName); var lastCandleData = findedMarket.candleDataList[item.MCandleTimeType].OrderBy(i => i.Argument).ToList().Last(); @@ -99,7 +99,7 @@ namespace BitgetAPI.IndicatorConditionSetup continue; } - + var findedMarket = commonProperty.candleDataLists.Find(i => i.ConGoodsData.MarketName == item.MarketName); var lastCandleData = findedMarket.candleDataList[item.MCandleTimeType].OrderBy(i => i.Argument).ToList().Last(); @@ -158,7 +158,7 @@ namespace BitgetAPI.IndicatorConditionSetup var description = string.Format("{0} 구름떼 상승", strInterval); var signalData = signals_LU.Find(i => i.MarketName.Equals(market) && i.Description.Equals(description)); - + // 없으면 생성 if (signalData == null) { @@ -201,7 +201,7 @@ namespace BitgetAPI.IndicatorConditionSetup signalInfoData.MCandleTimeType = interval; signals_SD.Add(signalInfoData); - } + } } if (영호조건식_상향돌파 || 영호조건식_하향돌파) @@ -237,22 +237,35 @@ namespace BitgetAPI.IndicatorConditionSetup var 전전봉Bol12 = candleData_전전봉.movingAverageDataList[12].BolangerValue; var 전전봉Bol24 = candleData_전전봉.movingAverageDataList[24].BolangerValue; + var Bol12 = candleData.movingAverageDataList[12].BolangerValue; + var Bol24 = candleData.movingAverageDataList[24].BolangerValue; ////볼랜저 12 24중 12가 크고 전전봉 전봉 12 차이보다 전전봉 전봉 24가 작아야함(하향) //var data12 = 전봉Bol12 - 전전봉Bol12 > 0 // ? 전봉Bol12 - 전전봉Bol12 : // (전봉Bol12 - 전전봉Bol12) * -1; - + //var data24 = 전봉Bol24 - 전전봉Bol24 > 0 // ? 전봉Bol24 - 전전봉Bol24 : // (전봉Bol24 - 전전봉Bol24) * -1; + //var buyFlag = 전봉Bol12 - 전봉Bol24 > Bol12 - Bol24 && 전전봉Bol12 - 전전봉Bol24 > 전봉Bol12 - 전봉Bol24; + + + //var sellFlag = 전봉Bol12 - 전봉Bol24 < Bol12 - Bol24 || 현재봉4 > 낮은값_74_24; + var buyFlag = candleData_전봉.movingAverageDataList[12].BolangerValue > candleData_전봉.movingAverageDataList[24].BolangerValue && 전전봉Bol12 - 전전봉Bol24 > 전봉Bol12 - 전봉Bol24; //파는 시점 볼랜저 전전봉 12 - 24 값이 전봉 12 - 24보다 클경우 팜 var sellFlag = 전전봉Bol12 - 전전봉Bol24 < 전봉Bol12 - 전봉Bol24 || 현재봉4 > 낮은값_74_24; + //파는 시점 볼랜저 전전봉 12 - 24 값이 전봉 12 - 24보다 클경우 팜 + //var buyFlag = candleData_전봉.movingAverageDataList[12].BolangerValue > candleData_전봉.movingAverageDataList[24].BolangerValue && 전전봉Bol12 - 전전봉Bol24 > 전봉Bol12 - 전봉Bol24; + + ////파는 시점 볼랜저 전전봉 12 - 24 값이 전봉 12 - 24보다 클경우 팜 + //var sellFlag = 전전봉Bol12 - 전전봉Bol24 < 전봉Bol12 - 전봉Bol24 || 현재봉4 > 낮은값_74_24; + if (영호조건식_상향돌파 && @@ -287,21 +300,8 @@ namespace BitgetAPI.IndicatorConditionSetup signals_LU.Add(signalInfoData); } } - else if (영호조건식_하향돌파 && - // 전전봉의 4가 74, 21 보다 높고 - (candleData_전전봉.movingAverageDataList[4].Value > 낮은값_74_24_전전봉 - && candleData_전전봉.movingAverageDataList[4].Value < 높은값_74_24_전전봉) && - // 전봉의 4가 74,21 보다 작고나서 - (candleData_전봉.movingAverageDataList[4].Value < 낮은값_74_24_전봉 && - 낮은값_74_24_전봉 < candleData.IchimokData.상한선) && - // 현재 시가도 4가 74,21 보다 작고, 고가도 - candleData.movingAverageDataList[4].Value < 낮은값_74_24 && - candleData.IchimokData.상한선 > 낮은값_74_24 && - //볼랜저 12 24중 12가 크고 전전봉 전봉 12 차이보다 전전봉 전봉 24가 작아야함(하향) - buyFlag - ) + else if (영호조건식_하향돌파) { - var price = candleData.Close; var rate = (candleData.Close / candleData.Open) * 100 - 100; var indicatorPrice = candleData.Open; @@ -328,25 +328,35 @@ namespace BitgetAPI.IndicatorConditionSetup try { //사는 시점 - if (!BuyList.ContainsKey(market+ interval)) + if (!BuyList.ContainsKey(market + interval)) { - var buyDic = new Dictionary - { - { "MarketName", market }, - { "BuyDate", nowTime }, - { "Price", price }, - { "MCandleTimeType", (int)interval }, - { "Candle", candleData } - }; + if ((candleData_전봉.movingAverageDataList[4].Value > 낮은값_74_24_전봉 + && candleData_전봉.movingAverageDataList[4].Value < 높은값_74_24_전봉) && + // 현재의 4가 74,21 보다 작고나서 + (candleData.movingAverageDataList[4].Value < 낮은값_74_24 && + 낮은값_74_24 < candleData.IchimokData.상한선) && + //볼랜저 12 24중 12가 크고 전전봉 전봉 12 차이보다 전전봉 전봉 24가 작아야함(하향) + buyFlag) + { + var buyDic = new Dictionary + { + { "MarketName", market }, + { "BuyDate", nowTime }, + { "Price", price }, + { "MCandleTimeType", (int)interval }, + { "Candle", candleData } + }; - BuyList.Add(market + interval, buyDic); + BuyList.Add(market + interval, buyDic); + } } //파는 시점 else { + var buyItem = BuyList[market + interval]; if (interval < MCandleTimeType.H1) { - if (nowTime < candleData_전봉.Argument.AddMinutes((int)interval)) + if (nowTime < ((DateTime)buyItem["BuyDate"]).AddMinutes((int)interval)) { continue; } @@ -354,14 +364,14 @@ namespace BitgetAPI.IndicatorConditionSetup //임시로 처리 else { - if (nowTime < candleData_전봉.Argument.AddHours((int)interval)) + if (nowTime < ((DateTime)buyItem["BuyDate"]).AddHours((int)interval)) { continue; } } if (sellFlag) { - var buyItem = BuyList[market + interval]; + double.TryParse(buyItem["Price"].ToString(), out var buyPrice); var resultRate = ((price - buyPrice) / buyPrice) * 100; @@ -383,8 +393,8 @@ namespace BitgetAPI.IndicatorConditionSetup } } } - catch (Exception e) - { + catch (Exception e) + { } } @@ -395,9 +405,9 @@ namespace BitgetAPI.IndicatorConditionSetup } } - public void calIchimokuProcess_Add() + public void calIchimokuProcess_Add() { - + } @@ -407,3 +417,4 @@ namespace BitgetAPI.IndicatorConditionSetup } } } +