1. 영호 조건식 추가 진행중!!!!!
This commit is contained in:
@@ -76,7 +76,7 @@
|
||||
<Compile Include="IndicatorConditionSetup\IchimokuConditionSetup.cs" />
|
||||
<Compile Include="IndicatorConditionSetup\MovingAverageConditionSetup.cs" />
|
||||
<Compile Include="IndicatorData\IchimokData.cs" />
|
||||
<Compile Include="IndicatorData\IndicatorProcess.cs" />
|
||||
<Compile Include="IndicatorConditionSetup\IndicatorProcess.cs" />
|
||||
<Compile Include="IndicatorData\MovingAverageData.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -92,6 +92,7 @@
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\licenses.licx" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -144,23 +144,6 @@ namespace BitgetAPI
|
||||
*/
|
||||
}
|
||||
|
||||
// 기준선 설정 (볼린저)
|
||||
public enum Indicator_BolingerOverLine
|
||||
{
|
||||
하향선 = -1,
|
||||
기준선 = 0,
|
||||
상향선 = 1
|
||||
}
|
||||
|
||||
// 기준선 설정 (일목)
|
||||
public enum Indicator_IchmokuOverLine
|
||||
{
|
||||
선행스팬1 = 1,
|
||||
선행스팬2 = 2,
|
||||
선행스팬1OR2중고가 = 3,
|
||||
선행스팬1OR2중저가 = 4
|
||||
}
|
||||
|
||||
// 이동평균선 종류
|
||||
public enum MovingAverageType
|
||||
{
|
||||
|
||||
@@ -47,5 +47,7 @@ namespace BitgetAPI.Data
|
||||
}
|
||||
|
||||
public IchimokData IchimokData { get; set; }
|
||||
|
||||
public Dictionary<int,MovingAverageData> movingAverageDataList { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,13 +34,9 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
/// </summary>
|
||||
public int Displacement { get; set; } = 26;
|
||||
|
||||
// 기준선 설정z
|
||||
public CommonProperty.Indicator_IchmokuOverLine IndicatorIchmokuOverLine { get; set; }
|
||||
|
||||
// 캔들당 일목균형표 계산하기
|
||||
public void calIchimokuData(List<CandleData> candleDatas, CandleData candleData)
|
||||
{
|
||||
|
||||
// 현재 종가 인덱스
|
||||
var endIndex = candleDatas.Count() - 1;
|
||||
|
||||
|
||||
241
BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs
Normal file
241
BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs
Normal file
@@ -0,0 +1,241 @@
|
||||
using BitgetApi.Data;
|
||||
using BitgetAPI.IndicatorConditionSetup;
|
||||
using DevExpress.Utils.IoC;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BitgetAPI.IndicatorConditionSetup
|
||||
{
|
||||
public class IndicatorProcess
|
||||
{
|
||||
CommonProperty commonProperty = CommonProperty.Instance;
|
||||
|
||||
// 스레드 시작/종료 플래그
|
||||
public bool Is_th_SignalInfo;
|
||||
|
||||
public List<object> checkedMarkets;
|
||||
public List<object> intervalList;
|
||||
|
||||
// 신호검색 리스트 작성
|
||||
// 신호 Long 상승 (구매)
|
||||
public List<SignalInfoData> signals_LU = null;
|
||||
// 신호 Short 하락 (구매)
|
||||
public List<SignalInfoData> signals_SD = null;
|
||||
// 검색현황 Long 하락 (판매)
|
||||
public List<SignalInfoData> signals_LD = null;
|
||||
// 검색현황 Short 상승 (판매)
|
||||
public List<SignalInfoData> signals_SU = null;
|
||||
|
||||
public TimeSpan sesstionTime;
|
||||
|
||||
// 조건식 설정 상태
|
||||
public bool checked구름떼상향돌파 = false;
|
||||
public bool checked구름떼하향돌파 = false;
|
||||
public bool 영호조건식_상향돌파 = false;
|
||||
public bool 영호조건식_하향돌파 = false;
|
||||
|
||||
// 전봉이 구름떼 돌파후 시가가 구름떼 위에서 시작하는 것
|
||||
// 전봉이 구름떼 하락후 시가가 구름떼 밑에서 시작하는 것
|
||||
|
||||
public void calProcess()
|
||||
{
|
||||
IchimokuConditionSetup ichimokuConditionSetup = new IchimokuConditionSetup();
|
||||
MovingAverageConditionSetup movingAverageConditionSetup = new MovingAverageConditionSetup();
|
||||
|
||||
// 추후 공통화 및 소스정리 필요
|
||||
while (true)
|
||||
{
|
||||
if (!Is_th_SignalInfo) break;
|
||||
//Thread.Sleep(200);
|
||||
var nowTime = DateTime.Now;
|
||||
|
||||
// 특정 시간 이후 삭제
|
||||
foreach (var item in signals_LU.ToList())
|
||||
{
|
||||
// 시간 지나면 삭제
|
||||
if (item.SignalStart + sesstionTime < nowTime)
|
||||
{
|
||||
signals_LU.Remove(item);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
var findedMarket = commonProperty.candleDataLists.Find(i => i.ConGoodsData.MarketName == item.MarketName);
|
||||
var lastCandleData = findedMarket.candleDataList[item.MCandleTimeType].OrderBy(i => i.Argument).ToList().Last();
|
||||
|
||||
if (lastCandleData.IchimokData != null)
|
||||
{
|
||||
if (checked구름떼상향돌파)
|
||||
{
|
||||
item.Price = lastCandleData.Close;
|
||||
item.Rate = (lastCandleData.Close / lastCandleData.Open) * 100 - 100;
|
||||
item.IndicatorRate = (lastCandleData.Close / item.IndicatorPrice) * 100 - 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var item in signals_SD.ToList())
|
||||
{
|
||||
// 시간 지나면 삭제
|
||||
if (item.SignalStart + sesstionTime < nowTime)
|
||||
{
|
||||
signals_SD.Remove(item);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
var findedMarket = commonProperty.candleDataLists.Find(i => i.ConGoodsData.MarketName == item.MarketName);
|
||||
var lastCandleData = findedMarket.candleDataList[item.MCandleTimeType].OrderBy(i => i.Argument).ToList().Last();
|
||||
|
||||
if (lastCandleData.IchimokData != null)
|
||||
{
|
||||
if (checked구름떼하향돌파)
|
||||
{
|
||||
item.Price = lastCandleData.Close;
|
||||
item.Rate = (lastCandleData.Close / lastCandleData.Open) * 100 - 100;
|
||||
item.IndicatorRate = (lastCandleData.Close / item.IndicatorPrice) * 100 - 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var item in signals_LD.ToList())
|
||||
if (item.SignalStart + sesstionTime < nowTime) signals_SU.Remove(item);
|
||||
foreach (var item in signals_SU.ToList())
|
||||
if (item.SignalStart + sesstionTime < nowTime) signals_SD.Remove(item);
|
||||
|
||||
// 체크된 마켓 정보
|
||||
foreach (string market in checkedMarkets)
|
||||
{
|
||||
var findedMarket = commonProperty.candleDataLists.Find(i => i.ConGoodsData.MarketName == market);
|
||||
|
||||
foreach (CommonProperty.MCandleTimeType interval in Enum.GetValues(typeof(CommonProperty.MCandleTimeType)))
|
||||
{
|
||||
// Description
|
||||
var description = Utils.Convertor.GetEnumDescription((Enum)interval);
|
||||
if (!intervalList.Contains(description)) continue;
|
||||
|
||||
// 시간별로 정렬하기 (임시 리스트)
|
||||
var candleDatas = findedMarket.candleDataList[interval];
|
||||
var candleDatas_정렬 = candleDatas.OrderBy(i => i.Argument).ToList();
|
||||
|
||||
var candleData = candleDatas.Find(i => i.Argument == candleDatas_정렬.Last().Argument);
|
||||
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_정렬, candleData);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_정렬, candleData);
|
||||
|
||||
candleDatas_정렬.RemoveAt(candleDatas_정렬.Count - 1);
|
||||
var candleData_전봉 = candleDatas.Find(i => i.Argument == candleDatas_정렬.Last().Argument);
|
||||
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_정렬, candleData_전봉);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_정렬, candleData_전봉);
|
||||
|
||||
|
||||
if (checked구름떼상향돌파 && candleData_전봉.Open < candleData_전봉.IchimokData.상한선 && candleData.Open > candleData.IchimokData.상한선 && candleData.Low > candleData.IchimokData.상한선
|
||||
&& candleData.Close > candleData.IchimokData.상한선)
|
||||
{
|
||||
|
||||
var price = candleData.Close;
|
||||
var rate = (candleData.Close / candleData.Open) * 100 - 100;
|
||||
var indicatorPrice = candleData.Open;
|
||||
var indicatorRate = (candleData.Close / indicatorPrice) * 100 - 100;
|
||||
|
||||
var signalData = signals_LU.Find(i => i.MarketName.Equals(market));
|
||||
|
||||
// 없으면 생성
|
||||
if (signalData == null)
|
||||
{
|
||||
SignalInfoData signalInfoData = new SignalInfoData();
|
||||
signalInfoData.SignalStart = nowTime;
|
||||
signalInfoData.MarketName = market;
|
||||
signalInfoData.Description = string.Format("{0} 구름떼 상승", description);
|
||||
signalInfoData.Rate = rate;
|
||||
signalInfoData.Price = price;
|
||||
signalInfoData.IndicatorPrice = indicatorPrice;
|
||||
signalInfoData.IndicatorRate = indicatorRate;
|
||||
signalInfoData.MCandleTimeType = interval;
|
||||
|
||||
signals_LU.Add(signalInfoData);
|
||||
}
|
||||
|
||||
}
|
||||
else if (checked구름떼상향돌파 && candleData_전봉.Open > candleData_전봉.IchimokData.하한선 && candleData.Open < candleData.IchimokData.하한선 && candleData.High < candleData.IchimokData.하한선
|
||||
&& candleData.Close < candleData.IchimokData.하한선)
|
||||
{
|
||||
var price = candleData.Close;
|
||||
var rate = (candleData.Close / candleData.Open) * 100 - 100;
|
||||
var indicatorPrice = candleData.Open;
|
||||
var indicatorRate = (candleData.Close / indicatorPrice) * 100 - 100;
|
||||
|
||||
var signalData = signals_SD.Find(i => i.MarketName.Equals(market));
|
||||
|
||||
// 없으면 생성
|
||||
if (signalData == null)
|
||||
{
|
||||
SignalInfoData signalInfoData = new SignalInfoData();
|
||||
signalInfoData.SignalStart = nowTime;
|
||||
signalInfoData.MarketName = market;
|
||||
signalInfoData.Description = string.Format("{0} 구름떼 하락", description);
|
||||
signalInfoData.Rate = rate;
|
||||
signalInfoData.Price = price;
|
||||
signalInfoData.IndicatorPrice = indicatorPrice;
|
||||
signalInfoData.IndicatorRate = indicatorRate;
|
||||
signalInfoData.MCandleTimeType = interval;
|
||||
|
||||
signals_SD.Add(signalInfoData);
|
||||
}
|
||||
}
|
||||
|
||||
if (영호조건식_상향돌파 || 영호조건식_하향돌파)
|
||||
{
|
||||
|
||||
candleDatas_정렬.RemoveAt(candleDatas_정렬.Count - 1);
|
||||
var candleData_전전봉 = candleDatas.Find(i => i.Argument == candleDatas_정렬.Last().Argument);
|
||||
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_정렬, candleData_전전봉);
|
||||
|
||||
// 24,72 높은값
|
||||
var 높은값_74_21_전전봉 = Math.Max(candleData_전전봉.movingAverageDataList[72].Value, candleData_전전봉.movingAverageDataList[21].Value);
|
||||
// 24,72 낮은값
|
||||
var 낮은값_74_21_전전봉 = Math.Min(candleData_전전봉.movingAverageDataList[72].Value, candleData_전전봉.movingAverageDataList[21].Value);
|
||||
|
||||
// 24,72 높은값
|
||||
var 높은값_74_21_전봉 = Math.Max(candleData_전봉.movingAverageDataList[72].Value, candleData_전봉.movingAverageDataList[21].Value);
|
||||
// 24,72 낮은값
|
||||
var 낮은값_74_21_전봉 = Math.Min(candleData_전봉.movingAverageDataList[72].Value, candleData_전봉.movingAverageDataList[21].Value);
|
||||
|
||||
if (영호조건식_상향돌파 &&
|
||||
candleData_전봉.movingAverageDataList[72].Value < candleData_전봉.IchimokData.상한선)
|
||||
{
|
||||
|
||||
}
|
||||
else if (영호조건식_하향돌파)
|
||||
{
|
||||
if (낮은값_74_21_전봉 < candleData_전봉.IchimokData.하한선 &&
|
||||
candleData_전봉.movingAverageDataList[4].Value < 낮은값_74_21_전봉)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void calIchimokuProcess_Add()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void calIchimokuProcess_Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
using BitgetAPI.Data;
|
||||
using BitgetAPI.Data.IndicatorData;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -14,9 +16,41 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
// 이동 평균선 종류
|
||||
public CommonProperty.MovingAverageType MovingAverageType { get; set; }
|
||||
// 기간
|
||||
public int CandleLegnth { get; set; }
|
||||
public int CandleLegnth24 { get; set; } = 24;
|
||||
// 기간
|
||||
public int CandleLegnth4 { get; set; } = 4;
|
||||
// 기간
|
||||
public int CandleLegnth72 { get; set; } = 72;
|
||||
// 가격
|
||||
public CommonProperty.CandlePriceType MACandlePriceType { get; set; }
|
||||
public CommonProperty.CandlePriceType MACandlePriceType { get; set; }
|
||||
|
||||
// 추후 업데이트 된것을 계산 안하는거 고려 !!!!
|
||||
public void Cal_YHK_Downpublic(List<CandleData> candleDatas, CandleData candleData)
|
||||
{
|
||||
// 현재 종가 인덱스
|
||||
var endIndex = candleDatas.Count() - 1;
|
||||
|
||||
if (candleData == null) return;
|
||||
|
||||
// Moving 없으면 생성
|
||||
if (candleData.movingAverageDataList == null) candleData.movingAverageDataList = new Dictionary<int, MovingAverageData>();
|
||||
|
||||
candleData.movingAverageDataList.Add(CandleLegnth4, new MovingAverageData());
|
||||
candleData.movingAverageDataList.Add(CandleLegnth24, new MovingAverageData());
|
||||
candleData.movingAverageDataList.Add(CandleLegnth72, new MovingAverageData());
|
||||
|
||||
foreach(var item in candleData.movingAverageDataList)
|
||||
{
|
||||
// 전봉까지 만듬
|
||||
var datas = candleDatas.FindAll(i =>
|
||||
candleDatas.IndexOf(i) > endIndex - item.Key &&
|
||||
candleDatas.IndexOf(i) <= endIndex);
|
||||
|
||||
candleData.movingAverageDataList[item.Key] = new MovingAverageData();
|
||||
candleData.movingAverageDataList[item.Key].Value = datas.Sum(i => i.Close);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using BitgetAPI.IndicatorConditionSetup;
|
||||
using DevExpress.Utils.IoC;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BitgetAPI.Data
|
||||
{
|
||||
public class IndicatorProcess
|
||||
{
|
||||
CommonProperty commonProperty = CommonProperty.Instance;
|
||||
|
||||
// 전봉이 구름떼 돌파후 시가가 구름떼 위에서 시작하는 것
|
||||
// 전봉이 구름떼 하락후 시가가 구름떼 밑에서 시작하는 것
|
||||
|
||||
public void calIchimokuProcess()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ namespace BitgetAPI.Data.IndicatorData
|
||||
[Serializable]
|
||||
public class MovingAverageData
|
||||
{
|
||||
public int period;
|
||||
public double Value { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
96
BitgetApi/MainForm.Designer.cs
generated
96
BitgetApi/MainForm.Designer.cs
generated
@@ -77,6 +77,9 @@
|
||||
this.groupControl_FP_LongDown = new DevExpress.XtraEditors.GroupControl();
|
||||
this.groupControl_FP_ShortUp = new DevExpress.XtraEditors.GroupControl();
|
||||
this.groupControl_SearcherCondition = new DevExpress.XtraEditors.GroupControl();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.checkEdit_yhk_Long = new DevExpress.XtraEditors.CheckEdit();
|
||||
this.checkEdit_yhk_Short = new DevExpress.XtraEditors.CheckEdit();
|
||||
this.simpleButton_SignalStart = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.simpleButton_MarketOrderRefresh = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
@@ -90,9 +93,6 @@
|
||||
this.checkedComboBoxEdit_TimeInterval = new DevExpress.XtraEditors.CheckedComboBoxEdit();
|
||||
this.checkedComboBoxEdit_MarketInfoList = new DevExpress.XtraEditors.CheckedComboBoxEdit();
|
||||
this.treeListColumn1 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.checkEdit_yhk_Long = new DevExpress.XtraEditors.CheckEdit();
|
||||
this.checkEdit_yhk_Short = new DevExpress.XtraEditors.CheckEdit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).BeginInit();
|
||||
this.groupControl_Setting.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.progressBarControl_data.Properties)).BeginInit();
|
||||
@@ -135,15 +135,15 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.groupControl_FP_ShortUp)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.groupControl_SearcherCondition)).BeginInit();
|
||||
this.groupControl_SearcherCondition.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_yhk_Long.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_yhk_Short.Properties)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_ichmoku_Long.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_Ichmoku_Short.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.timeSpanEdit_SesstionTime.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_TimeInterval.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_MarketInfoList.Properties)).BeginInit();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_yhk_Long.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_yhk_Short.Properties)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupControl_Setting
|
||||
@@ -409,7 +409,7 @@
|
||||
this.splitContainerControl_SearchSignal.Panel2.Controls.Add(this.splitContainerControl_FavoritePurchase);
|
||||
this.splitContainerControl_SearchSignal.Panel2.Text = "Panel2";
|
||||
this.splitContainerControl_SearchSignal.Size = new System.Drawing.Size(1006, 264);
|
||||
this.splitContainerControl_SearchSignal.SplitterPosition = 586;
|
||||
this.splitContainerControl_SearchSignal.SplitterPosition = 836;
|
||||
this.splitContainerControl_SearchSignal.TabIndex = 1;
|
||||
//
|
||||
// splitContainerControl_UpdateSignal
|
||||
@@ -428,7 +428,7 @@
|
||||
//
|
||||
this.splitContainerControl_UpdateSignal.Panel2.Controls.Add(this.groupControl_LongDownSignal);
|
||||
this.splitContainerControl_UpdateSignal.Panel2.Text = "Panel2";
|
||||
this.splitContainerControl_UpdateSignal.Size = new System.Drawing.Size(586, 264);
|
||||
this.splitContainerControl_UpdateSignal.Size = new System.Drawing.Size(836, 264);
|
||||
this.splitContainerControl_UpdateSignal.SplitterPosition = 129;
|
||||
this.splitContainerControl_UpdateSignal.TabIndex = 2;
|
||||
//
|
||||
@@ -438,7 +438,7 @@
|
||||
this.groupControl_LongUpSignal.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupControl_LongUpSignal.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupControl_LongUpSignal.Name = "groupControl_LongUpSignal";
|
||||
this.groupControl_LongUpSignal.Size = new System.Drawing.Size(586, 129);
|
||||
this.groupControl_LongUpSignal.Size = new System.Drawing.Size(836, 129);
|
||||
this.groupControl_LongUpSignal.TabIndex = 0;
|
||||
this.groupControl_LongUpSignal.Text = "검색 현황 (Long 상숭)";
|
||||
//
|
||||
@@ -455,7 +455,7 @@
|
||||
this.treeList_LongUp.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeList_LongUp.Location = new System.Drawing.Point(2, 23);
|
||||
this.treeList_LongUp.Name = "treeList_LongUp";
|
||||
this.treeList_LongUp.Size = new System.Drawing.Size(582, 104);
|
||||
this.treeList_LongUp.Size = new System.Drawing.Size(832, 104);
|
||||
this.treeList_LongUp.TabIndex = 0;
|
||||
//
|
||||
// treeListColumn_SignalStart
|
||||
@@ -537,7 +537,7 @@
|
||||
this.groupControl_LongDownSignal.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupControl_LongDownSignal.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupControl_LongDownSignal.Name = "groupControl_LongDownSignal";
|
||||
this.groupControl_LongDownSignal.Size = new System.Drawing.Size(586, 125);
|
||||
this.groupControl_LongDownSignal.Size = new System.Drawing.Size(836, 125);
|
||||
this.groupControl_LongDownSignal.TabIndex = 0;
|
||||
this.groupControl_LongDownSignal.Text = "검색 현황 (Short 하락)";
|
||||
//
|
||||
@@ -554,7 +554,7 @@
|
||||
this.treeList_ShortDown.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeList_ShortDown.Location = new System.Drawing.Point(2, 23);
|
||||
this.treeList_ShortDown.Name = "treeList_ShortDown";
|
||||
this.treeList_ShortDown.Size = new System.Drawing.Size(582, 100);
|
||||
this.treeList_ShortDown.Size = new System.Drawing.Size(832, 100);
|
||||
this.treeList_ShortDown.TabIndex = 1;
|
||||
//
|
||||
// treeListColumn_SD_SignalStart
|
||||
@@ -646,7 +646,7 @@
|
||||
//
|
||||
this.splitContainerControl_FavoritePurchase.Panel2.Controls.Add(this.groupControl_FP_ShortUp);
|
||||
this.splitContainerControl_FavoritePurchase.Panel2.Text = "Panel2";
|
||||
this.splitContainerControl_FavoritePurchase.Size = new System.Drawing.Size(410, 264);
|
||||
this.splitContainerControl_FavoritePurchase.Size = new System.Drawing.Size(160, 264);
|
||||
this.splitContainerControl_FavoritePurchase.SplitterPosition = 130;
|
||||
this.splitContainerControl_FavoritePurchase.TabIndex = 3;
|
||||
//
|
||||
@@ -655,7 +655,7 @@
|
||||
this.groupControl_FP_LongDown.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupControl_FP_LongDown.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupControl_FP_LongDown.Name = "groupControl_FP_LongDown";
|
||||
this.groupControl_FP_LongDown.Size = new System.Drawing.Size(410, 130);
|
||||
this.groupControl_FP_LongDown.Size = new System.Drawing.Size(160, 130);
|
||||
this.groupControl_FP_LongDown.TabIndex = 0;
|
||||
this.groupControl_FP_LongDown.Text = "관심 종목 (Long 상승)";
|
||||
//
|
||||
@@ -664,7 +664,7 @@
|
||||
this.groupControl_FP_ShortUp.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.groupControl_FP_ShortUp.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupControl_FP_ShortUp.Name = "groupControl_FP_ShortUp";
|
||||
this.groupControl_FP_ShortUp.Size = new System.Drawing.Size(410, 124);
|
||||
this.groupControl_FP_ShortUp.Size = new System.Drawing.Size(160, 124);
|
||||
this.groupControl_FP_ShortUp.TabIndex = 0;
|
||||
this.groupControl_FP_ShortUp.Text = "관심 종목 (Long 하락)";
|
||||
//
|
||||
@@ -688,6 +688,36 @@
|
||||
this.groupControl_SearcherCondition.TabIndex = 0;
|
||||
this.groupControl_SearcherCondition.Text = "조건 설정";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.checkEdit_yhk_Long);
|
||||
this.groupBox2.Controls.Add(this.checkEdit_yhk_Short);
|
||||
this.groupBox2.Location = new System.Drawing.Point(908, 36);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(83, 68);
|
||||
this.groupBox2.TabIndex = 9;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "24,72,4";
|
||||
//
|
||||
// checkEdit_yhk_Long
|
||||
//
|
||||
this.checkEdit_yhk_Long.Location = new System.Drawing.Point(6, 21);
|
||||
this.checkEdit_yhk_Long.Name = "checkEdit_yhk_Long";
|
||||
this.checkEdit_yhk_Long.Properties.Caption = "Long";
|
||||
this.checkEdit_yhk_Long.Size = new System.Drawing.Size(87, 20);
|
||||
this.checkEdit_yhk_Long.TabIndex = 2;
|
||||
//
|
||||
// checkEdit_yhk_Short
|
||||
//
|
||||
this.checkEdit_yhk_Short.EditValue = true;
|
||||
this.checkEdit_yhk_Short.Enabled = false;
|
||||
this.checkEdit_yhk_Short.Location = new System.Drawing.Point(6, 40);
|
||||
this.checkEdit_yhk_Short.Name = "checkEdit_yhk_Short";
|
||||
this.checkEdit_yhk_Short.Properties.Caption = "Short";
|
||||
this.checkEdit_yhk_Short.Size = new System.Drawing.Size(87, 20);
|
||||
this.checkEdit_yhk_Short.TabIndex = 2;
|
||||
//
|
||||
// simpleButton_SignalStart
|
||||
//
|
||||
this.simpleButton_SignalStart.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("simpleButton_SignalStart.ImageOptions.SvgImage")));
|
||||
@@ -815,36 +845,6 @@
|
||||
this.treeListColumn1.Visible = true;
|
||||
this.treeListColumn1.VisibleIndex = 0;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.checkEdit_yhk_Long);
|
||||
this.groupBox2.Controls.Add(this.checkEdit_yhk_Short);
|
||||
this.groupBox2.Location = new System.Drawing.Point(908, 36);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(83, 68);
|
||||
this.groupBox2.TabIndex = 9;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "24,72,4";
|
||||
//
|
||||
// checkEdit_yhk_Long
|
||||
//
|
||||
this.checkEdit_yhk_Long.Location = new System.Drawing.Point(6, 21);
|
||||
this.checkEdit_yhk_Long.Name = "checkEdit_yhk_Long";
|
||||
this.checkEdit_yhk_Long.Properties.Caption = "Long";
|
||||
this.checkEdit_yhk_Long.Size = new System.Drawing.Size(87, 20);
|
||||
this.checkEdit_yhk_Long.TabIndex = 2;
|
||||
//
|
||||
// checkEdit_yhk_Short
|
||||
//
|
||||
this.checkEdit_yhk_Short.EditValue = true;
|
||||
this.checkEdit_yhk_Short.Enabled = false;
|
||||
this.checkEdit_yhk_Short.Location = new System.Drawing.Point(6, 40);
|
||||
this.checkEdit_yhk_Short.Name = "checkEdit_yhk_Short";
|
||||
this.checkEdit_yhk_Short.Properties.Caption = "Short";
|
||||
this.checkEdit_yhk_Short.Size = new System.Drawing.Size(87, 20);
|
||||
this.checkEdit_yhk_Short.TabIndex = 2;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
@@ -901,15 +901,15 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.groupControl_SearcherCondition)).EndInit();
|
||||
this.groupControl_SearcherCondition.ResumeLayout(false);
|
||||
this.groupControl_SearcherCondition.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_yhk_Long.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_yhk_Short.Properties)).EndInit();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_ichmoku_Long.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_Ichmoku_Short.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.timeSpanEdit_SesstionTime.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_TimeInterval.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_MarketInfoList.Properties)).EndInit();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_yhk_Long.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_yhk_Short.Properties)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@ namespace BitgetAPI
|
||||
|
||||
|
||||
// 스레드 종료 플래그
|
||||
bool Is_th_SignalInfo = false;
|
||||
bool Is_th_webSocketThread = false;
|
||||
bool Is_th_th_MarketInfoList_WebService = false;
|
||||
bool Is_th_treeListUpdate = false;
|
||||
|
||||
@@ -57,6 +55,8 @@ namespace BitgetAPI
|
||||
// 검색현황 Short 상승 (판매)
|
||||
List<SignalInfoData> signals_SU = null;
|
||||
|
||||
IndicatorProcess indicatorProcess = null;
|
||||
|
||||
// 종목별 캔들 데이터 : 캔들 개수
|
||||
const int candleCount = 200;
|
||||
#endregion
|
||||
@@ -166,8 +166,6 @@ namespace BitgetAPI
|
||||
// 신호검색 Thread 함수
|
||||
private void Signalnfo()
|
||||
{
|
||||
IchimokuConditionSetup ichimokuConditionSetup = new IchimokuConditionSetup();
|
||||
|
||||
/*
|
||||
* 전환선 : (과거 n일간의 최고가 + 과거 n일간의 최저가) / 2
|
||||
|
||||
@@ -179,152 +177,26 @@ namespace BitgetAPI
|
||||
선행스팬2 : (과거 k일간의 최고가 + 과거 k일간의 최저가) /2한 값을 ℓ일 후에 기입
|
||||
*/
|
||||
|
||||
|
||||
var checkedMarkets = checkedComboBoxEdit_MarketInfoList.Properties.Items.GetCheckedValues();
|
||||
var intervalList = checkedComboBoxEdit_TimeInterval.Properties.Items.GetCheckedValues();
|
||||
|
||||
Is_th_SignalInfo = true;
|
||||
indicatorProcess = new IndicatorProcess();
|
||||
indicatorProcess.Is_th_SignalInfo = true;
|
||||
indicatorProcess.checkedMarkets = checkedMarkets;
|
||||
indicatorProcess.intervalList = intervalList;
|
||||
indicatorProcess.signals_LU = signals_LU;
|
||||
indicatorProcess.signals_SD = signals_SD;
|
||||
indicatorProcess.signals_LD = signals_LD;
|
||||
indicatorProcess.signals_SU = signals_SU;
|
||||
indicatorProcess.sesstionTime = timeSpanEdit_SesstionTime.TimeSpan;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (!Is_th_SignalInfo) break;
|
||||
//Thread.Sleep(200);
|
||||
var nowTime = DateTime.Now;
|
||||
if(checkEdit_ichmoku_Long.Checked) indicatorProcess.checked구름떼상향돌파 = true;
|
||||
if(checkEdit_Ichmoku_Short.Checked) indicatorProcess.checked구름떼하향돌파= true;
|
||||
if(checkEdit_yhk_Long.Checked) indicatorProcess.영호조건식_상향돌파 = true;
|
||||
if(checkEdit_yhk_Short.Checked) indicatorProcess.영호조건식_하향돌파= true;
|
||||
|
||||
// 특정 시간 이후 삭제
|
||||
foreach (var item in signals_LU.ToList())
|
||||
{
|
||||
// 시간 지나면 삭제
|
||||
if (item.SignalStart + timeSpanEdit_SesstionTime.TimeSpan < nowTime)
|
||||
{
|
||||
signals_LU.Remove(item);
|
||||
continue;
|
||||
|
||||
}
|
||||
var findedMarket = commonProperty.candleDataLists.Find(i => i.ConGoodsData.MarketName == item.MarketName);
|
||||
var lastCandleData = findedMarket.candleDataList[item.MCandleTimeType].OrderBy(i => i.Argument).ToList().Last();
|
||||
|
||||
if(lastCandleData.IchimokData != null)
|
||||
{
|
||||
item.Price = lastCandleData.Close;
|
||||
item.Rate = (lastCandleData.Close / lastCandleData.Open) * 100 - 100;
|
||||
item.IndicatorRate = (lastCandleData.Close / item.IndicatorPrice) * 100 - 100;
|
||||
}
|
||||
|
||||
}
|
||||
foreach (var item in signals_SD.ToList())
|
||||
{
|
||||
// 시간 지나면 삭제
|
||||
if (item.SignalStart + timeSpanEdit_SesstionTime.TimeSpan < nowTime)
|
||||
{
|
||||
signals_SD.Remove(item);
|
||||
continue;
|
||||
|
||||
}
|
||||
var findedMarket = commonProperty.candleDataLists.Find(i => i.ConGoodsData.MarketName == item.MarketName);
|
||||
var lastCandleData = findedMarket.candleDataList[item.MCandleTimeType].OrderBy(i => i.Argument).ToList().Last();
|
||||
|
||||
if (lastCandleData.IchimokData != null)
|
||||
{
|
||||
item.Price = lastCandleData.Close;
|
||||
item.Rate = (lastCandleData.Close / lastCandleData.Open) * 100 - 100;
|
||||
item.IndicatorRate = (lastCandleData.Close / item.IndicatorPrice) * 100 - 100;
|
||||
}
|
||||
}
|
||||
foreach (var item in signals_LD.ToList())
|
||||
if (item.SignalStart + timeSpanEdit_SesstionTime.TimeSpan < nowTime) signals_SU.Remove(item);
|
||||
foreach (var item in signals_SU.ToList())
|
||||
if (item.SignalStart + timeSpanEdit_SesstionTime.TimeSpan < nowTime) signals_SD.Remove(item);
|
||||
|
||||
|
||||
|
||||
// 체크된 마켓 정보
|
||||
foreach (string market in checkedMarkets)
|
||||
{
|
||||
var findedMarket = commonProperty.candleDataLists.Find(i => i.ConGoodsData.MarketName == market);
|
||||
|
||||
foreach (CommonProperty.MCandleTimeType interval in Enum.GetValues(typeof(CommonProperty.MCandleTimeType)))
|
||||
{
|
||||
// Description
|
||||
var description = Utils.Convertor.GetEnumDescription((Enum)interval);
|
||||
if (!intervalList.Contains(description)) continue;
|
||||
|
||||
// 시간별로 정렬하기 (임시 리스트)
|
||||
var candleDatas = findedMarket.candleDataList[interval];
|
||||
var candleDatas_정렬 = candleDatas.OrderBy(i => i.Argument).ToList();
|
||||
|
||||
var candleData = candleDatas.Find(i => i.Argument == candleDatas_정렬.Last().Argument);
|
||||
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_정렬, candleData);
|
||||
|
||||
candleDatas_정렬.RemoveAt(candleDatas_정렬.Count - 1);
|
||||
var candleData_전봉 = candleDatas.Find(i => i.Argument == candleDatas_정렬.Last().Argument);
|
||||
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_정렬, candleData_전봉);
|
||||
|
||||
if (candleData_전봉.Open < candleData_전봉.IchimokData.상한선 && candleData.Open > candleData.IchimokData.상한선 && candleData.Low > candleData.IchimokData.상한선
|
||||
&& candleData.Close > candleData.IchimokData.상한선)
|
||||
{
|
||||
var price = candleData.Close;
|
||||
var rate = (candleData.Close / candleData.Open) * 100 - 100;
|
||||
var indicatorPrice = candleData.Open;
|
||||
var indicatorRate = (candleData.Close / indicatorPrice) * 100 - 100;
|
||||
|
||||
var signalData = signals_LU.Find(i => i.MarketName.Equals(market));
|
||||
|
||||
// 없으면 생성
|
||||
if (signalData == null)
|
||||
{
|
||||
SignalInfoData signalInfoData = new SignalInfoData();
|
||||
signalInfoData.SignalStart = nowTime;
|
||||
signalInfoData.MarketName = market;
|
||||
signalInfoData.Description = string.Format("{0} 상승", description);
|
||||
signalInfoData.Rate = rate;
|
||||
signalInfoData.Price = price;
|
||||
signalInfoData.IndicatorPrice = indicatorPrice;
|
||||
signalInfoData.IndicatorRate = indicatorRate;
|
||||
signalInfoData.MCandleTimeType = interval;
|
||||
|
||||
signals_LU.Add(signalInfoData);
|
||||
}
|
||||
}
|
||||
else if (candleData_전봉.Open > candleData_전봉.IchimokData.하한선 && candleData.Open < candleData.IchimokData.하한선 && candleData.High < candleData.IchimokData.하한선
|
||||
&& candleData.Close < candleData.IchimokData.하한선)
|
||||
{
|
||||
var price = candleData.Close;
|
||||
var rate = (candleData.Close / candleData.Open) * 100 - 100;
|
||||
var indicatorPrice = candleData.Open;
|
||||
var indicatorRate = (candleData.Close / indicatorPrice) * 100 - 100;
|
||||
|
||||
var signalData = signals_SD.Find(i => i.MarketName.Equals(market));
|
||||
// 존재하면 업데이트
|
||||
if (signalData != null)
|
||||
{
|
||||
signalData.Price = price;
|
||||
signalData.Rate = rate;
|
||||
signalData.IndicatorPrice = indicatorPrice;
|
||||
signalData.IndicatorRate = indicatorRate;
|
||||
}
|
||||
// 없으면 생성
|
||||
else
|
||||
{
|
||||
SignalInfoData signalInfoData = new SignalInfoData();
|
||||
signalInfoData.SignalStart = nowTime;
|
||||
signalInfoData.MarketName = market;
|
||||
signalInfoData.Description = string.Format("{0} 하락", description);
|
||||
signalInfoData.Rate = rate;
|
||||
signalInfoData.Price = price;
|
||||
signalInfoData.IndicatorPrice = indicatorPrice;
|
||||
signalInfoData.IndicatorRate = indicatorRate;
|
||||
signalInfoData.MCandleTimeType = interval;
|
||||
|
||||
signals_SD.Add(signalInfoData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
indicatorProcess.calProcess();
|
||||
}
|
||||
|
||||
|
||||
@@ -510,7 +382,7 @@ namespace BitgetAPI
|
||||
{
|
||||
if (th_SignalInfo != null)
|
||||
{
|
||||
Is_th_SignalInfo = false;
|
||||
indicatorProcess.Is_th_SignalInfo = false;
|
||||
th_SignalInfo.Join();
|
||||
th_SignalInfo = null;
|
||||
}
|
||||
@@ -563,7 +435,7 @@ namespace BitgetAPI
|
||||
{
|
||||
if(th_SignalInfo != null)
|
||||
{
|
||||
Is_th_SignalInfo = false;
|
||||
indicatorProcess.Is_th_SignalInfo = false;
|
||||
if (th_SignalInfo.ThreadState == ThreadState.Running)
|
||||
th_SignalInfo.Join();
|
||||
th_SignalInfo = null;
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace BitgetAPI.WebService
|
||||
public class WebConnection
|
||||
{
|
||||
public Thread th_PingTimer {get; set;} = null;
|
||||
|
||||
// 웹소켓 스레드 시작/종료 플래그
|
||||
public bool Is_th_webSocketThread { get; set; } = false;
|
||||
public ClientWebSocket webSocket { get; set; } = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user