From 00e19d9c61bbadfd49670793907e0d8efcfcfff8 Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Tue, 9 May 2023 12:37:03 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=EC=A1=B0=EA=B1=B4=EB=8B=A8=EC=88=9C?= =?UTF-8?q?=EB=B9=84=EA=B5=90=20=EC=A1=B0=EA=B1=B4=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Million Hunter/Million Hunter.csproj | 1 + Million/CommonProperty.cs | 11 +++- .../CompareConditionSetup.cs | 57 +++++++++++++++++++ Million/Manager/CalculateManager.cs | 6 +- Million/Manager/DataManager.cs | 16 +++++- Million/Million Core.csproj | 1 + 6 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 Million/IndicatorConditionSetup/CompareConditionSetup.cs diff --git a/Million Hunter/Million Hunter.csproj b/Million Hunter/Million Hunter.csproj index f01148b..5f15cb8 100644 --- a/Million Hunter/Million Hunter.csproj +++ b/Million Hunter/Million Hunter.csproj @@ -143,6 +143,7 @@ HunterMainForm.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/Million/CommonProperty.cs b/Million/CommonProperty.cs index ea5c132..17df0bc 100644 --- a/Million/CommonProperty.cs +++ b/Million/CommonProperty.cs @@ -121,7 +121,8 @@ namespace Million 단순비교 = 0, 돌파비교 = 1, 최초돌파 = 2, - 크로스 = 3 + 크로스 = 3, + 조건간단순비교 = 4 } // 시가/고가/종가/저가 @@ -367,5 +368,13 @@ namespace Million /// public static Dictionary> subIndicatorStateManagement = new Dictionary>(); #endregion + + #region Compare 조건문 Flag + public enum CompareType + { + Origin_Up_Compare_Down = 0, + Origin_Down_Compare_Up = 1 + } + #endregion } } diff --git a/Million/IndicatorConditionSetup/CompareConditionSetup.cs b/Million/IndicatorConditionSetup/CompareConditionSetup.cs new file mode 100644 index 0000000..41b3ffd --- /dev/null +++ b/Million/IndicatorConditionSetup/CompareConditionSetup.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static Million.CommonProperty; + +namespace Million.IndicatorConditionSetup +{ + /// + /// Compare 조건식 + /// + public class CompareConditionSetup : IndicatorCoditionSetup + { + /// + /// 기본 데이터 + /// + public string Origin { get; set; } + + /// + /// 조건 데이터 + /// + public string Compare { get; set; } + + /// + /// Compare 할 값 + /// + public CompareType CompareType { get; set; } + + /// + /// Clone + /// + /// + public object Clone() + { + var clone = new BolingerConditionSetup + { + CandlePriceTypeFirstOver = CandlePriceTypeFirstOver, + OverStatusEnumListFirstOver = OverStatusEnumListFirstOver, + FirstOverSubRegExpression = FirstOverSubRegExpression, + CrossSubRegExpression = CrossSubRegExpression, + CrossCandlePriceType = CrossCandlePriceType, + CrossType = CrossType, + ByBuySellType = ByBuySellType, + IndicatorType = IndicatorType, + SubIndicatorSetupType = SubIndicatorSetupType, + CandlePriceType = CandlePriceType, + IndicatorOver = IndicatorOver, + OverStatusEnumList = OverStatusEnumList, + MCandleTimeType = MCandleTimeType, + Description = Description, + IndexString = IndexString + }; + return clone; + } + } +} diff --git a/Million/Manager/CalculateManager.cs b/Million/Manager/CalculateManager.cs index 04541ca..4ddddbd 100644 --- a/Million/Manager/CalculateManager.cs +++ b/Million/Manager/CalculateManager.cs @@ -367,6 +367,10 @@ namespace Million.Manager for (var i = 0; i < 3; i++) CrossCondition(setUp, parentCandleDataList, childrenCandleDataList, subIndicator, i); } + else if(setUp.SubIndicatorSetupType == SubIndicatorSetupType.조건간단순비교) + { + + } } /// @@ -491,7 +495,7 @@ namespace Million.Manager if (string.IsNullOrWhiteSpace(setUp.CrossSubRegExpression)) { foreach (var item in childrenCandleDataList) - item.CalculateFlag[key] = false; + item.CalculateFlag[setUp.IndexString] = false; return; } var subSetup = subIndicatorList.FirstOrDefault(t => t.IndexString == setUp.CrossSubRegExpression); diff --git a/Million/Manager/DataManager.cs b/Million/Manager/DataManager.cs index ff5a64a..744c017 100644 --- a/Million/Manager/DataManager.cs +++ b/Million/Manager/DataManager.cs @@ -126,14 +126,24 @@ namespace Million.Manager { // 최초와 cross의 조건먼저 계산이 필요함(선처리) var parentIndicator = totalIndicator.Where(t => t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.최초돌파 || - t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스).ToList(); + t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스 || t.SubIndicatorSetupType == SubIndicatorSetupType.조건간단순비교).ToList(); var subIndStringiList = new List(); foreach (var item in parentIndicator) { - var subRegExpression = item.FirstOverSubRegExpression; - if (item.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스) + var subRegExpression = ""; + if (item.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.조건간단순비교) + { + subRegExpression = ((CompareConditionSetup)item).Origin + "," + ((CompareConditionSetup)item).Compare; + } + else if (item.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스) + { subRegExpression = item.CrossSubRegExpression; + } + else + { + subRegExpression = item.FirstOverSubRegExpression; + } subIndStringiList.AddRange(subRegExpression.Split(',').ToList()); } subIndStringiList = subIndStringiList.Distinct().ToList(); diff --git a/Million/Million Core.csproj b/Million/Million Core.csproj index 65cd4fc..e7d6321 100644 --- a/Million/Million Core.csproj +++ b/Million/Million Core.csproj @@ -179,6 +179,7 @@ + From 22fbf2e5b58777846cf4bc5807cc995d1d0914d7 Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Tue, 9 May 2023 13:22:20 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=EC=A1=B0=EA=B1=B4=EB=8B=A8=EC=88=9C?= =?UTF-8?q?=EB=B9=84=EA=B5=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Million/CommonProperty.cs | 9 +- Million/Manager/CalculateManager.cs | 3 +- Million/Manager/DataManager.cs | 4 +- Million/Million Core.csproj | 9 ++ .../CommonIndicatorSetupUserForm.cs | 18 +++ .../CompareSetupUserForm.Designer.cs | 133 ++++++++++++++++++ .../CompareSetupUserForm.cs | 61 ++++++++ .../CompareSetupUserForm.resx | 120 ++++++++++++++++ 8 files changed, 351 insertions(+), 6 deletions(-) create mode 100644 Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.Designer.cs create mode 100644 Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.cs create mode 100644 Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.resx diff --git a/Million/CommonProperty.cs b/Million/CommonProperty.cs index 17df0bc..0eacf25 100644 --- a/Million/CommonProperty.cs +++ b/Million/CommonProperty.cs @@ -122,7 +122,7 @@ namespace Million 돌파비교 = 1, 최초돌파 = 2, 크로스 = 3, - 조건간단순비교 = 4 + 조건단순비교 = 4 } // 시가/고가/종가/저가 @@ -160,7 +160,8 @@ namespace Million 이동평균선 = 3, ParabolicSAR = 4, 거래량비율 = 5, - 가격비율 = 6 + 가격비율 = 6, + 조건단순비교 =7 } // 이동평균선 종류 @@ -373,7 +374,9 @@ namespace Million public enum CompareType { Origin_Up_Compare_Down = 0, - Origin_Down_Compare_Up = 1 + Origin_UpOrSame_Compare_Down = 1, + Origin_Down_Compare_Up = 2, + Origin_DownOrSame_Compare_Up = 3 } #endregion } diff --git a/Million/Manager/CalculateManager.cs b/Million/Manager/CalculateManager.cs index 4ddddbd..844e857 100644 --- a/Million/Manager/CalculateManager.cs +++ b/Million/Manager/CalculateManager.cs @@ -367,7 +367,8 @@ namespace Million.Manager for (var i = 0; i < 3; i++) CrossCondition(setUp, parentCandleDataList, childrenCandleDataList, subIndicator, i); } - else if(setUp.SubIndicatorSetupType == SubIndicatorSetupType.조건간단순비교) + //조건 단순비교 + else if(setUp.SubIndicatorSetupType == SubIndicatorSetupType.조건단순비교) { } diff --git a/Million/Manager/DataManager.cs b/Million/Manager/DataManager.cs index 744c017..ee1eaf1 100644 --- a/Million/Manager/DataManager.cs +++ b/Million/Manager/DataManager.cs @@ -126,13 +126,13 @@ namespace Million.Manager { // 최초와 cross의 조건먼저 계산이 필요함(선처리) var parentIndicator = totalIndicator.Where(t => t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.최초돌파 || - t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스 || t.SubIndicatorSetupType == SubIndicatorSetupType.조건간단순비교).ToList(); + t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스 || t.SubIndicatorSetupType == SubIndicatorSetupType.조건단순비교).ToList(); var subIndStringiList = new List(); foreach (var item in parentIndicator) { var subRegExpression = ""; - if (item.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.조건간단순비교) + if (item.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.조건단순비교) { subRegExpression = ((CompareConditionSetup)item).Origin + "," + ((CompareConditionSetup)item).Compare; } diff --git a/Million/Million Core.csproj b/Million/Million Core.csproj index e7d6321..4944ff5 100644 --- a/Million/Million Core.csproj +++ b/Million/Million Core.csproj @@ -262,6 +262,12 @@ MovingAverageSetupUserForm.cs + + UserControl + + + CompareSetupUserForm.cs + UserControl @@ -320,6 +326,9 @@ MovingAverageSetupUserForm.cs + + CompareSetupUserForm.cs + ParabolicSarSetupUserForm.cs diff --git a/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs b/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs index a7b61f4..85c2f77 100644 --- a/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs +++ b/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs @@ -96,6 +96,9 @@ namespace Million.HunterSubForm.IndicatorSetupForm case CommonProperty.IndicatorType.ParabolicSAR: _indicatorSetupData = new ParabolicSarIndicatorConditionSetup(); break; + case CommonProperty.IndicatorType.조건단순비교: + _indicatorSetupData = new CompareConditionSetup(); + break; } // Over Status (중복선택 가능, Over, OverCancle 설정) @@ -198,6 +201,13 @@ namespace Million.HunterSubForm.IndicatorSetupForm _curruentIndicatorSpecSetupform = new ParabolicSarSetupUserForm(_indicatorSetupData, _isCreate) { Dock = DockStyle.Fill }; break; + + case CommonProperty.IndicatorType.조건단순비교: + _curruentIndicatorSpecSetupform = new CompareSetupUserForm(_indicatorSetupData, _isCreate) + { Dock = DockStyle.Fill }; + comboBoxEdit_CandleDateTime.Enabled = false; + xtraTabControl_SubIndicatorSetup.Enabled = false; + break; } // 그룹박스에 Sepc Indicator Setup 폼 추가 @@ -308,6 +318,11 @@ namespace Million.HunterSubForm.IndicatorSetupForm _indicatorSetupData.Description += $",크로스[{_indicatorSetupData.CrossType},정규식({_indicatorSetupData.CrossSubRegExpression})]"; break; + + case CommonProperty.SubIndicatorSetupType.조건단순비교: + _indicatorSetupData.Description += + $",조건단순비교"; + break; } } @@ -329,6 +344,9 @@ namespace Million.HunterSubForm.IndicatorSetupForm case CommonProperty.IndicatorType.ParabolicSAR: ((ParabolicSarSetupUserForm)_curruentIndicatorSpecSetupform).SaveIndicatorSetup(_indicatorSetupData); return ((ParabolicSarIndicatorConditionSetup)_indicatorSetupData).Clone(); + case CommonProperty.IndicatorType.조건단순비교: + ((CompareSetupUserForm)_curruentIndicatorSpecSetupform).SaveIndicatorSetup(_indicatorSetupData); + return ((CompareConditionSetup)_indicatorSetupData).Clone(); } return _indicatorSetupData; } diff --git a/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.Designer.cs b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.Designer.cs new file mode 100644 index 0000000..d404dda --- /dev/null +++ b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.Designer.cs @@ -0,0 +1,133 @@ + +namespace Million.HunterSubForm.IndicatorSetupForm +{ + partial class CompareSetupUserForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.te_Origin = new DevExpress.XtraEditors.TextEdit(); + this.labelControl_IndicatorName = new DevExpress.XtraEditors.LabelControl(); + this.labelControl3 = new DevExpress.XtraEditors.LabelControl(); + this.te_Compare = new DevExpress.XtraEditors.TextEdit(); + this.labelControl1 = new DevExpress.XtraEditors.LabelControl(); + this.cb_Type = new DevExpress.XtraEditors.ComboBoxEdit(); + this.labelControl2 = new DevExpress.XtraEditors.LabelControl(); + ((System.ComponentModel.ISupportInitialize)(this.te_Origin.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.te_Compare.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.cb_Type.Properties)).BeginInit(); + this.SuspendLayout(); + // + // te_Origin + // + this.te_Origin.Location = new System.Drawing.Point(83, 20); + this.te_Origin.Name = "te_Origin"; + this.te_Origin.Properties.Mask.EditMask = "d"; + this.te_Origin.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; + this.te_Origin.Size = new System.Drawing.Size(91, 20); + this.te_Origin.TabIndex = 3; + // + // labelControl_IndicatorName + // + this.labelControl_IndicatorName.Location = new System.Drawing.Point(3, 3); + this.labelControl_IndicatorName.Name = "labelControl_IndicatorName"; + this.labelControl_IndicatorName.Size = new System.Drawing.Size(20, 14); + this.labelControl_IndicatorName.TabIndex = 9; + this.labelControl_IndicatorName.Text = "지표"; + // + // labelControl3 + // + this.labelControl3.Location = new System.Drawing.Point(28, 23); + this.labelControl3.Name = "labelControl3"; + this.labelControl3.Size = new System.Drawing.Size(49, 14); + this.labelControl3.TabIndex = 2; + this.labelControl3.Text = "Origin(A)"; + // + // te_Compare + // + this.te_Compare.Location = new System.Drawing.Point(83, 46); + this.te_Compare.Name = "te_Compare"; + this.te_Compare.Properties.Mask.EditMask = "d"; + this.te_Compare.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; + this.te_Compare.Size = new System.Drawing.Size(91, 20); + this.te_Compare.TabIndex = 11; + // + // labelControl1 + // + this.labelControl1.Location = new System.Drawing.Point(12, 49); + this.labelControl1.Name = "labelControl1"; + this.labelControl1.Size = new System.Drawing.Size(65, 14); + this.labelControl1.TabIndex = 10; + this.labelControl1.Text = "Compare(B)"; + // + // cb_Type + // + this.cb_Type.Location = new System.Drawing.Point(83, 72); + this.cb_Type.Name = "cb_Type"; + this.cb_Type.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.cb_Type.Size = new System.Drawing.Size(91, 20); + this.cb_Type.TabIndex = 19; + // + // labelControl2 + // + this.labelControl2.Location = new System.Drawing.Point(49, 75); + this.labelControl2.Name = "labelControl2"; + this.labelControl2.Size = new System.Drawing.Size(28, 14); + this.labelControl2.TabIndex = 20; + this.labelControl2.Text = "Type"; + // + // CompareSetupUserForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.labelControl2); + this.Controls.Add(this.cb_Type); + this.Controls.Add(this.te_Compare); + this.Controls.Add(this.labelControl1); + this.Controls.Add(this.labelControl_IndicatorName); + this.Controls.Add(this.te_Origin); + this.Controls.Add(this.labelControl3); + this.Name = "CompareSetupUserForm"; + this.Size = new System.Drawing.Size(196, 111); + ((System.ComponentModel.ISupportInitialize)(this.te_Origin.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.te_Compare.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.cb_Type.Properties)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private DevExpress.XtraEditors.TextEdit te_Origin; + private DevExpress.XtraEditors.LabelControl labelControl_IndicatorName; + private DevExpress.XtraEditors.LabelControl labelControl3; + private DevExpress.XtraEditors.TextEdit te_Compare; + private DevExpress.XtraEditors.LabelControl labelControl1; + private DevExpress.XtraEditors.ComboBoxEdit cb_Type; + private DevExpress.XtraEditors.LabelControl labelControl2; + } +} diff --git a/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.cs b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.cs new file mode 100644 index 0000000..62368fd --- /dev/null +++ b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.cs @@ -0,0 +1,61 @@ +using DevExpress.XtraEditors; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Million; +using Million.IndicatorConditionSetup; + +namespace Million.HunterSubForm.IndicatorSetupForm +{ + public partial class CompareSetupUserForm : DevExpress.XtraEditors.XtraUserControl + { + private CompareConditionSetup _compareConditionSetup; + private bool _isCreate = false; + + public CompareSetupUserForm(object compareConditionSetup, bool IsCreate) + { + InitializeComponent(); + + _compareConditionSetup = (CompareConditionSetup)compareConditionSetup; + _isCreate = IsCreate; + + InitForm(); + } + + private void InitForm() + { + labelControl_IndicatorName.Text = @"조건단순비교"; + cb_Type.Properties.Items.AddRange(Enum.GetNames(enumType: typeof(CommonProperty.CompareType))); + } + + // Indicator 정보 저장 + public void SaveIndicatorSetup(object indicatorSetupData) + { + // 예외처리 필요 + var compareConditionSetup = (CompareConditionSetup) indicatorSetupData; + + //지표 설정 + compareConditionSetup.IndicatorType = CommonProperty.IndicatorType.조건단순비교; + compareConditionSetup.Origin = te_Origin.Text; + compareConditionSetup.Compare = te_Compare.Text; + + Enum.TryParse(cb_Type.SelectedItem.ToString(), + out CommonProperty.CompareType type); + compareConditionSetup.CompareType = type; + + var description = + $"[{compareConditionSetup.Origin}," + + $"{compareConditionSetup.Compare}," + + $"{compareConditionSetup.CompareType}]"; + + compareConditionSetup.Description = description + compareConditionSetup.Description; + } + + } +} diff --git a/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.resx b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file From 8f1bcd521b4e195524f997aef82821ff421497dc Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Tue, 9 May 2023 13:51:56 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EB=8B=A8=EC=88=9C=20?= =?UTF-8?q?=EB=B9=84=EA=B5=90=20=EC=9E=84=EC=8B=9C=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Million/Manager/CalculateManager.cs | 83 ++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/Million/Manager/CalculateManager.cs b/Million/Manager/CalculateManager.cs index 844e857..44e4b9a 100644 --- a/Million/Manager/CalculateManager.cs +++ b/Million/Manager/CalculateManager.cs @@ -370,10 +370,91 @@ namespace Million.Manager //조건 단순비교 else if(setUp.SubIndicatorSetupType == SubIndicatorSetupType.조건단순비교) { - + CompareSimpleComparison(setUp, totalIndicator, parentCandleDataList, childrenCandleDataList); } } + /// + /// 조건 단순 비교 + /// + /// + /// + /// + /// + private static void CompareSimpleComparison(IndicatorCoditionSetup setUp, List totalIndicator, List parentCandleDataList, List childrenCandleDataList) + { + //TODO 추후 Value 가 필요할 수 도 있으나 현재는 필요없어서 안씀 + + var cSetup = (CompareConditionSetup)setUp; + + var originSetup = totalIndicator.FirstOrDefault(t => t.IndexString == cSetup.Origin); + var originKey = GetKeyData(originSetup); + var originVal = 0.0; + + var compareSetup = totalIndicator.FirstOrDefault(t => t.IndexString == cSetup.Compare); + var compareKey = GetKeyData(compareSetup); + var compareVal = 0.0; + + foreach (var parent in parentCandleDataList) + { + if (!(parent.IndicatorDic.ContainsKey(originKey) && parent.IndicatorDic.ContainsKey(compareKey))) + continue; + + var originValueList = new List(); + var compareValueList = new List(); + + originValueList.Add(parent.IndicatorDic[originKey].value); + compareValueList.Add(parent.IndicatorDic[compareKey].value); + + if (originSetup.CandlePriceType == CandlePriceType.종가) + { + originValueList.Add(parent.IndicatorDic[originKey].highValue); + originValueList.Add(parent.IndicatorDic[originKey].lowValue); + } + if (compareSetup.CandlePriceType == CandlePriceType.종가) + { + compareValueList.Add(parent.IndicatorDic[compareKey].highValue); + compareValueList.Add(parent.IndicatorDic[compareKey].lowValue); + } + + var cnt = originValueList.Count >= compareValueList.Count ? originValueList.Count : compareValueList.Count; + + for (var i = 0; i < cnt; i++) + { + if (parent.CalculateFlag[cSetup.IndexString]) break; + + if (originValueList.Count < i) + { + originVal = originValueList[originValueList.Count - 1]; + } + else + { + originVal = originValueList[i]; + } + + if (compareValueList.Count < i) + { + compareVal = compareValueList[compareValueList.Count - 1]; + } + else + { + compareVal = compareValueList[i]; + } + + if ((cSetup.CompareType == CompareType.Origin_Up_Compare_Down && originVal > compareVal) || + (cSetup.CompareType == CompareType.Origin_UpOrSame_Compare_Down && originVal >= compareVal) || + (cSetup.CompareType == CompareType.Origin_Down_Compare_Up && originVal < compareVal) || + (cSetup.CompareType == CompareType.Origin_DownOrSame_Compare_Up && originVal <= compareVal)) + { + parent.CalculateFlag[cSetup.IndexString] = true; + var childList = GetChildrenDatas(parent, cSetup.MCandleTimeType, childrenCandleDataList); + + foreach (var item in childList) item.CalculateFlag[cSetup.IndexString] = true; + } + } + } + } + /// /// Rate 판매 -> 구매는 될수가 없음 기준이 없으므로(추후 어떤식으로 할지는 모르겠음) /// From c132d34e2b5bab37fe4517e35d87867dd21969c2 Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Tue, 9 May 2023 16:05:01 +0900 Subject: [PATCH 4/5] =?UTF-8?q?Compare=20=EA=B8=B0=EB=B3=B8=20=EB=B9=84?= =?UTF-8?q?=EA=B5=90=20=EB=A1=9C=EC=A7=81=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Million/CommonProperty.cs | 3 +-- .../CompareConditionSetup.cs | 17 +++++++++--- .../IndicatorCoditionSetup.cs | 11 +++++--- Million/Manager/CalculateManager.cs | 26 ++++++++++++++----- Million/Manager/DataManager.cs | 4 +-- Million/Manager/IndicatorSetupManager.cs | 4 ++- .../CommonIndicatorSetupUserForm.cs | 9 ++----- 7 files changed, 49 insertions(+), 25 deletions(-) diff --git a/Million/CommonProperty.cs b/Million/CommonProperty.cs index 0eacf25..b05acbe 100644 --- a/Million/CommonProperty.cs +++ b/Million/CommonProperty.cs @@ -121,8 +121,7 @@ namespace Million 단순비교 = 0, 돌파비교 = 1, 최초돌파 = 2, - 크로스 = 3, - 조건단순비교 = 4 + 크로스 = 3 } // 시가/고가/종가/저가 diff --git a/Million/IndicatorConditionSetup/CompareConditionSetup.cs b/Million/IndicatorConditionSetup/CompareConditionSetup.cs index 41b3ffd..a7e5001 100644 --- a/Million/IndicatorConditionSetup/CompareConditionSetup.cs +++ b/Million/IndicatorConditionSetup/CompareConditionSetup.cs @@ -33,7 +33,7 @@ namespace Million.IndicatorConditionSetup /// public object Clone() { - var clone = new BolingerConditionSetup + var clone = new CompareConditionSetup { CandlePriceTypeFirstOver = CandlePriceTypeFirstOver, OverStatusEnumListFirstOver = OverStatusEnumListFirstOver, @@ -49,9 +49,20 @@ namespace Million.IndicatorConditionSetup OverStatusEnumList = OverStatusEnumList, MCandleTimeType = MCandleTimeType, Description = Description, - IndexString = IndexString + IndexString = IndexString, + Origin = Origin, + Compare = Compare, + CompareType = CompareType }; return clone; - } + } + + public override string GetKeyName(bool IndexStr = false) + { + var key = "Compare" + Origin + Compare; + if (IndexStr) + return IndexString + key; + return key; + } } } diff --git a/Million/IndicatorConditionSetup/IndicatorCoditionSetup.cs b/Million/IndicatorConditionSetup/IndicatorCoditionSetup.cs index 9bdd9aa..8d7d1be 100644 --- a/Million/IndicatorConditionSetup/IndicatorCoditionSetup.cs +++ b/Million/IndicatorConditionSetup/IndicatorCoditionSetup.cs @@ -72,9 +72,6 @@ namespace Million.IndicatorConditionSetup { return false; } - - - if (obj.GetType() == typeof(BolingerConditionSetup)) { var thisBol = (BolingerConditionSetup)this; @@ -103,6 +100,14 @@ namespace Million.IndicatorConditionSetup thisMov.MACandlePriceType == objMov.MACandlePriceType && thisMov.MovingAverageType == objMov.MovingAverageType; } + else if (obj.GetType() == typeof(CompareConditionSetup)) { + var objCompare = (CompareConditionSetup)obj; + var thisCompare = (CompareConditionSetup)this; + return objCompare.Origin == thisCompare.Origin && + objCompare.Compare == thisCompare.Compare && + objCompare.CompareType == thisCompare.CompareType; + } + return base.Equals(obj); } diff --git a/Million/Manager/CalculateManager.cs b/Million/Manager/CalculateManager.cs index 44e4b9a..3223b45 100644 --- a/Million/Manager/CalculateManager.cs +++ b/Million/Manager/CalculateManager.cs @@ -345,6 +345,11 @@ namespace Million.Manager RateValue(setUp, parentCandleDataList, childrenCandleDataList, buyData); } } + //조건 단순비교 + else if (setUp.IndicatorType == IndicatorType.조건단순비교) + { + CompareSimpleComparison(setUp, totalIndicator, parentCandleDataList, childrenCandleDataList); + } //돌파 else if (setUp.SubIndicatorSetupType == SubIndicatorSetupType.돌파비교) { @@ -367,11 +372,7 @@ namespace Million.Manager for (var i = 0; i < 3; i++) CrossCondition(setUp, parentCandleDataList, childrenCandleDataList, subIndicator, i); } - //조건 단순비교 - else if(setUp.SubIndicatorSetupType == SubIndicatorSetupType.조건단순비교) - { - CompareSimpleComparison(setUp, totalIndicator, parentCandleDataList, childrenCandleDataList); - } + } /// @@ -387,6 +388,8 @@ namespace Million.Manager var cSetup = (CompareConditionSetup)setUp; + var key = GetKeyData(cSetup); + var originSetup = totalIndicator.FirstOrDefault(t => t.IndexString == cSetup.Origin); var originKey = GetKeyData(originSetup); var originVal = 0.0; @@ -423,7 +426,7 @@ namespace Million.Manager { if (parent.CalculateFlag[cSetup.IndexString]) break; - if (originValueList.Count < i) + if (originValueList.Count < i) { originVal = originValueList[originValueList.Count - 1]; } @@ -447,9 +450,18 @@ namespace Million.Manager (cSetup.CompareType == CompareType.Origin_DownOrSame_Compare_Up && originVal <= compareVal)) { parent.CalculateFlag[cSetup.IndexString] = true; + + parent.IndicatorDic[key] = new IndicatorData(); + parent.IndicatorDic[key].value = parent.EndValue; + var childList = GetChildrenDatas(parent, cSetup.MCandleTimeType, childrenCandleDataList); - foreach (var item in childList) item.CalculateFlag[cSetup.IndexString] = true; + foreach (var item in childList) + { + item.CalculateFlag[cSetup.IndexString] = true; + item.IndicatorDic[key] = new IndicatorData(); + item.IndicatorDic[key].value = item.EndValue; + } } } } diff --git a/Million/Manager/DataManager.cs b/Million/Manager/DataManager.cs index ee1eaf1..54b7e12 100644 --- a/Million/Manager/DataManager.cs +++ b/Million/Manager/DataManager.cs @@ -126,13 +126,13 @@ namespace Million.Manager { // 최초와 cross의 조건먼저 계산이 필요함(선처리) var parentIndicator = totalIndicator.Where(t => t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.최초돌파 || - t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스 || t.SubIndicatorSetupType == SubIndicatorSetupType.조건단순비교).ToList(); + t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스 || t.IndicatorType == IndicatorType.조건단순비교).ToList(); var subIndStringiList = new List(); foreach (var item in parentIndicator) { var subRegExpression = ""; - if (item.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.조건단순비교) + if (item.IndicatorType == CommonProperty.IndicatorType.조건단순비교) { subRegExpression = ((CompareConditionSetup)item).Origin + "," + ((CompareConditionSetup)item).Compare; } diff --git a/Million/Manager/IndicatorSetupManager.cs b/Million/Manager/IndicatorSetupManager.cs index d8f0bf8..075219f 100644 --- a/Million/Manager/IndicatorSetupManager.cs +++ b/Million/Manager/IndicatorSetupManager.cs @@ -35,10 +35,12 @@ namespace Million.Manager else if (setup.GetType() == typeof(PriceRateCondtionSetup)) { indicatorList.Add((PriceRateCondtionSetup)setup); + }else if(setup.GetType() == typeof(CompareConditionSetup)) + { + indicatorList.Add((CompareConditionSetup)setup); } } - return indicatorList; } diff --git a/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs b/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs index 85c2f77..56d8bdf 100644 --- a/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs +++ b/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs @@ -317,12 +317,7 @@ namespace Million.HunterSubForm.IndicatorSetupForm case CommonProperty.SubIndicatorSetupType.크로스: _indicatorSetupData.Description += $",크로스[{_indicatorSetupData.CrossType},정규식({_indicatorSetupData.CrossSubRegExpression})]"; - break; - - case CommonProperty.SubIndicatorSetupType.조건단순비교: - _indicatorSetupData.Description += - $",조건단순비교"; - break; + break; } } @@ -347,7 +342,7 @@ namespace Million.HunterSubForm.IndicatorSetupForm case CommonProperty.IndicatorType.조건단순비교: ((CompareSetupUserForm)_curruentIndicatorSpecSetupform).SaveIndicatorSetup(_indicatorSetupData); return ((CompareConditionSetup)_indicatorSetupData).Clone(); - } + } return _indicatorSetupData; } } From f7491b426a62a64e7de6237401741014afc87fd8 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1A3P75F\\lee" Date: Tue, 9 May 2023 16:13:14 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=EC=9D=B4=EC=B0=AC=EA=B7=A0=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=B2=84=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HunterSubForm/TestBoardForm.Designer.cs | 47 ++++++++++++++----- Million Hunter/HunterSubForm/TestBoardForm.cs | 4 ++ Million Hunter/Million Hunter.csproj | 1 - 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/Million Hunter/HunterSubForm/TestBoardForm.Designer.cs b/Million Hunter/HunterSubForm/TestBoardForm.Designer.cs index 255ce97..fa6ad84 100644 --- a/Million Hunter/HunterSubForm/TestBoardForm.Designer.cs +++ b/Million Hunter/HunterSubForm/TestBoardForm.Designer.cs @@ -32,8 +32,10 @@ namespace Million_Hunter.HunterSubForm this.simpleButton_FullInsertCandle = new DevExpress.XtraEditors.SimpleButton(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.simpleButton_Calc = new DevExpress.XtraEditors.SimpleButton(); this.checkedListBox_Indicator = new System.Windows.Forms.CheckedListBox(); + this.simpleButton_Calc = new DevExpress.XtraEditors.SimpleButton(); + this.simpleButton_찬 = new DevExpress.XtraEditors.SimpleButton(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); @@ -69,17 +71,6 @@ namespace Million_Hunter.HunterSubForm this.groupBox2.TabStop = false; this.groupBox2.Text = "지표"; // - // simpleButton_Calc - // - this.simpleButton_Calc.Appearance.ForeColor = System.Drawing.Color.Teal; - this.simpleButton_Calc.Appearance.Options.UseForeColor = true; - this.simpleButton_Calc.Location = new System.Drawing.Point(720, 225); - this.simpleButton_Calc.Name = "simpleButton_Calc"; - this.simpleButton_Calc.Size = new System.Drawing.Size(121, 32); - this.simpleButton_Calc.TabIndex = 1; - this.simpleButton_Calc.Text = "계산하기"; - this.simpleButton_Calc.Click += new System.EventHandler(this.simpleButton_Calc_Click); - // // checkedListBox_Indicator // this.checkedListBox_Indicator.Dock = System.Windows.Forms.DockStyle.Fill; @@ -91,11 +82,41 @@ namespace Million_Hunter.HunterSubForm this.checkedListBox_Indicator.Size = new System.Drawing.Size(823, 108); this.checkedListBox_Indicator.TabIndex = 0; // + // simpleButton_Calc + // + this.simpleButton_Calc.Appearance.ForeColor = System.Drawing.Color.Teal; + this.simpleButton_Calc.Appearance.Options.UseForeColor = true; + this.simpleButton_Calc.Location = new System.Drawing.Point(720, 225); + this.simpleButton_Calc.Name = "simpleButton_Calc"; + this.simpleButton_Calc.Size = new System.Drawing.Size(121, 32); + this.simpleButton_Calc.TabIndex = 1; + this.simpleButton_Calc.Text = "계산하기"; + this.simpleButton_Calc.Click += new System.EventHandler(this.simpleButton_Calc_Click); + // + // simpleButton_찬 + // + this.simpleButton_찬.Location = new System.Drawing.Point(18, 225); + this.simpleButton_찬.Name = "simpleButton_찬"; + this.simpleButton_찬.Size = new System.Drawing.Size(104, 32); + this.simpleButton_찬.TabIndex = 4; + this.simpleButton_찬.Text = "찬테스트"; + this.simpleButton_찬.Click += new System.EventHandler(this.simpleButton_찬_Click); + // + // progressBar1 + // + this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.progressBar1.Location = new System.Drawing.Point(0, 275); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(852, 23); + this.progressBar1.TabIndex = 5; + // // TestBoardForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(853, 297); + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.simpleButton_찬); this.Controls.Add(this.simpleButton_Calc); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); @@ -114,5 +135,7 @@ namespace Million_Hunter.HunterSubForm private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.CheckedListBox checkedListBox_Indicator; private DevExpress.XtraEditors.SimpleButton simpleButton_Calc; + private DevExpress.XtraEditors.SimpleButton simpleButton_찬; + private System.Windows.Forms.ProgressBar progressBar1; } } \ No newline at end of file diff --git a/Million Hunter/HunterSubForm/TestBoardForm.cs b/Million Hunter/HunterSubForm/TestBoardForm.cs index e4ce9b8..8505569 100644 --- a/Million Hunter/HunterSubForm/TestBoardForm.cs +++ b/Million Hunter/HunterSubForm/TestBoardForm.cs @@ -168,5 +168,9 @@ namespace Million_Hunter.HunterSubForm } } + private void simpleButton_찬_Click(object sender, EventArgs e) + { + + } } } \ No newline at end of file diff --git a/Million Hunter/Million Hunter.csproj b/Million Hunter/Million Hunter.csproj index ba766f1..b7b5765 100644 --- a/Million Hunter/Million Hunter.csproj +++ b/Million Hunter/Million Hunter.csproj @@ -153,7 +153,6 @@ TestBoardForm.cs - ResXFileCodeGenerator Resources.Designer.cs