This commit is contained in:
kyh
2024-04-22 18:49:19 +09:00
parent 332f0a5c7b
commit d9f8efec2d
6 changed files with 262 additions and 288 deletions

View File

@@ -93,9 +93,6 @@
splitContainerControl2 = new DevExpress.XtraEditors.SplitContainerControl();
bt_AllSell = new System.Windows.Forms.Button();
groupBox4 = new System.Windows.Forms.GroupBox();
cb_sell = new DevExpress.XtraEditors.ComboBoxEdit();
cb_buy = new DevExpress.XtraEditors.ComboBoxEdit();
tb_IndicatorNum = new System.Windows.Forms.TextBox();
ck_SlopeSell = new System.Windows.Forms.CheckBox();
tb_TopVolCnt = new System.Windows.Forms.TextBox();
cb_TopVol = new System.Windows.Forms.CheckBox();
@@ -107,6 +104,9 @@
label5 = new System.Windows.Forms.Label();
tb_SellNowCoinFullName = new System.Windows.Forms.TextBox();
bt_SellNow = new System.Windows.Forms.Button();
cb_SellExcpetionCandleStateType = new DevExpress.XtraEditors.ComboBoxEdit();
tb_SellExceptionCandleStateValue = new System.Windows.Forms.TextBox();
ck_SellExceptionCandleState = new System.Windows.Forms.CheckBox();
groupBox1.SuspendLayout();
groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)tl_BuyList).BeginInit();
@@ -126,10 +126,9 @@
splitContainerControl2.Panel2.SuspendLayout();
splitContainerControl2.SuspendLayout();
groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)cb_sell.Properties).BeginInit();
((System.ComponentModel.ISupportInitialize)cb_buy.Properties).BeginInit();
((System.ComponentModel.ISupportInitialize)cb_BuyBigthanHighType.Properties).BeginInit();
((System.ComponentModel.ISupportInitialize)cb_BigMoneyVolType.Properties).BeginInit();
((System.ComponentModel.ISupportInitialize)cb_SellExcpetionCandleStateType.Properties).BeginInit();
SuspendLayout();
//
// groupBox1
@@ -540,11 +539,11 @@
lb_log.FormattingEnabled = true;
lb_log.HorizontalScrollbar = true;
lb_log.ItemHeight = 15;
lb_log.Location = new System.Drawing.Point(12, 757);
lb_log.Location = new System.Drawing.Point(12, 742);
lb_log.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
lb_log.Name = "lb_log";
lb_log.ScrollAlwaysVisible = true;
lb_log.Size = new System.Drawing.Size(362, 169);
lb_log.Size = new System.Drawing.Size(362, 184);
lb_log.TabIndex = 16;
//
// bt_alive
@@ -782,9 +781,9 @@
//
// groupBox4
//
groupBox4.Controls.Add(cb_sell);
groupBox4.Controls.Add(cb_buy);
groupBox4.Controls.Add(tb_IndicatorNum);
groupBox4.Controls.Add(cb_SellExcpetionCandleStateType);
groupBox4.Controls.Add(tb_SellExceptionCandleStateValue);
groupBox4.Controls.Add(ck_SellExceptionCandleState);
groupBox4.Controls.Add(ck_SlopeSell);
groupBox4.Controls.Add(tb_TopVolCnt);
groupBox4.Controls.Add(cb_TopVol);
@@ -797,45 +796,21 @@
groupBox4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
groupBox4.Name = "groupBox4";
groupBox4.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
groupBox4.Size = new System.Drawing.Size(362, 190);
groupBox4.Size = new System.Drawing.Size(362, 178);
groupBox4.TabIndex = 10;
groupBox4.TabStop = false;
groupBox4.Text = "필터";
groupBox4.Enter += groupBox4_Enter;
//
// cb_sell
//
cb_sell.Location = new System.Drawing.Point(230, 153);
cb_sell.Name = "cb_sell";
cb_sell.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) });
cb_sell.Size = new System.Drawing.Size(45, 20);
cb_sell.TabIndex = 28;
//
// cb_buy
//
cb_buy.Location = new System.Drawing.Point(163, 153);
cb_buy.Name = "cb_buy";
cb_buy.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) });
cb_buy.Size = new System.Drawing.Size(45, 20);
cb_buy.TabIndex = 27;
//
// tb_IndicatorNum
//
tb_IndicatorNum.Location = new System.Drawing.Point(95, 150);
tb_IndicatorNum.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tb_IndicatorNum.Name = "tb_IndicatorNum";
tb_IndicatorNum.Size = new System.Drawing.Size(44, 23);
tb_IndicatorNum.TabIndex = 26;
//
// ck_SlopeSell
//
ck_SlopeSell.AutoSize = true;
ck_SlopeSell.Location = new System.Drawing.Point(9, 127);
ck_SlopeSell.Location = new System.Drawing.Point(10, 118);
ck_SlopeSell.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
ck_SlopeSell.Name = "ck_SlopeSell";
ck_SlopeSell.Size = new System.Drawing.Size(259, 19);
ck_SlopeSell.Size = new System.Drawing.Size(158, 19);
ck_SlopeSell.TabIndex = 25;
ck_SlopeSell.Text = "기울기 판매 조건식 buy sell";
ck_SlopeSell.Text = "크로스 이전봉 확인 필터";
ck_SlopeSell.UseVisualStyleBackColor = true;
//
// tb_TopVolCnt
@@ -934,6 +909,34 @@
bt_SellNow.UseVisualStyleBackColor = true;
bt_SellNow.Click += bt_SellNow_Click;
//
// cb_SellExcpetionCandleStateType
//
cb_SellExcpetionCandleStateType.Location = new System.Drawing.Point(129, 144);
cb_SellExcpetionCandleStateType.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
cb_SellExcpetionCandleStateType.Name = "cb_SellExcpetionCandleStateType";
cb_SellExcpetionCandleStateType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) });
cb_SellExcpetionCandleStateType.Size = new System.Drawing.Size(61, 20);
cb_SellExcpetionCandleStateType.TabIndex = 35;
//
// tb_SellExceptionCandleStateValue
//
tb_SellExceptionCandleStateValue.Location = new System.Drawing.Point(196, 143);
tb_SellExceptionCandleStateValue.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tb_SellExceptionCandleStateValue.Name = "tb_SellExceptionCandleStateValue";
tb_SellExceptionCandleStateValue.Size = new System.Drawing.Size(30, 23);
tb_SellExceptionCandleStateValue.TabIndex = 34;
//
// ck_SellExceptionCandleState
//
ck_SellExceptionCandleState.AutoSize = true;
ck_SellExceptionCandleState.Location = new System.Drawing.Point(9, 145);
ck_SellExceptionCandleState.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
ck_SellExceptionCandleState.Name = "ck_SellExceptionCandleState";
ck_SellExceptionCandleState.Size = new System.Drawing.Size(122, 19);
ck_SellExceptionCandleState.TabIndex = 33;
ck_SellExceptionCandleState.Text = "몇 음봉 손절 조건";
ck_SellExceptionCandleState.UseVisualStyleBackColor = true;
//
// MainForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -982,10 +985,9 @@
splitContainerControl2.ResumeLayout(false);
groupBox4.ResumeLayout(false);
groupBox4.PerformLayout();
((System.ComponentModel.ISupportInitialize)cb_sell.Properties).EndInit();
((System.ComponentModel.ISupportInitialize)cb_buy.Properties).EndInit();
((System.ComponentModel.ISupportInitialize)cb_BuyBigthanHighType.Properties).EndInit();
((System.ComponentModel.ISupportInitialize)cb_BigMoneyVolType.Properties).EndInit();
((System.ComponentModel.ISupportInitialize)cb_SellExcpetionCandleStateType.Properties).EndInit();
ResumeLayout(false);
PerformLayout();
}
@@ -1062,14 +1064,14 @@
private System.Windows.Forms.CheckBox ck_BuyBigthanHighVal;
private System.Windows.Forms.CheckBox cb_TopVol;
private System.Windows.Forms.TextBox tb_TopVolCnt;
private System.Windows.Forms.TextBox tb_IndicatorNum;
private System.Windows.Forms.CheckBox ck_SlopeSell;
private DevExpress.XtraEditors.ComboBoxEdit cb_buy;
private DevExpress.XtraEditors.ComboBoxEdit cb_sell;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox tb_SellNowCoinFullName;
private System.Windows.Forms.Button bt_SellNow;
private DevExpress.XtraTreeList.Columns.TreeListColumn UUIDData;
private DevExpress.XtraEditors.ComboBoxEdit cb_SellExcpetionCandleStateType;
private System.Windows.Forms.TextBox tb_SellExceptionCandleStateValue;
private System.Windows.Forms.CheckBox ck_SellExceptionCandleState;
}
}

View File

@@ -71,11 +71,11 @@ namespace Million_Buyer
private bool BigMoneyVolFlag = false;
private MCandleTimeType BigMoneyVolType;
private Dictionary<string, bool> slopeDic = new Dictionary<string, bool>();
private bool slopeFlag = false;
private string indicatorNum = "";
private string slopeBuy = "";
private string slopeSell = "";
private bool sellExceptionCandleStateFlag = false;
private int sellExceptionCandleStateValue = 0;
private MCandleTimeType sellExceptionCandleStateType = MCandleTimeType.H1;
private Dictionary<string, bool> sellNowDic = new Dictionary<string, bool>();
private List<string> endUuids = new List<string>();
public MainForm()
@@ -98,10 +98,7 @@ namespace Million_Buyer
strList[0] = "-";
strList[1] = "+";
cb_buy.Properties.Items.Clear();
cb_buy.Properties.Items.AddRange(strList);
cb_sell.Properties.Items.Clear();
cb_sell.Properties.Items.AddRange(strList);
_saveResultData = new SavedResultData
{
@@ -193,11 +190,10 @@ namespace Million_Buyer
int.TryParse(tb_BigMoneyVolCnt.Text, out BigMoneyVolCnt);
int.TryParse(tb_TopVolCnt.Text, out TopVolCnt);
slopeFlag = ck_SlopeSell.Checked;
indicatorNum = tb_IndicatorNum.Text;
slopeBuy = cb_buy.Text.ToString();
slopeSell = cb_sell.Text.ToString();
this.sellExceptionCandleStateFlag = ck_SellExceptionCandleState.Checked;
int.TryParse(tb_SellExceptionCandleStateValue.Text, out this.sellExceptionCandleStateValue);
this.sellExceptionCandleStateType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_SellExcpetionCandleStateType.Text.ToString());
slopeFlag = ck_SlopeSell.Checked;
TopVolFlag = cb_TopVol.Checked;
@@ -777,38 +773,32 @@ namespace Million_Buyer
if (slopeFlag)
{
var indi = totalIndicatorList.FirstOrDefault(t => t.IndexString == indicatorNum);
slopeDic[item] = false;
if (indi != null)
foreach(var indi in totalIndicatorList)
{
var timeType = indi.MCandleTimeType;
var timeTypeDataList = dataList[timeType];
var key = CalculateManager.GetKeyData(indi);
if (timeTypeDataList.Count > 0)
if(indi.SubIndicatorSetupType == SubIndicatorSetupType.크로스)
{
var itemDataList = timeTypeDataList.FirstOrDefault(t => t.ConGoodsData.CoinFullName == item);
if (itemDataList != null)
var mainIndex = indi.IndexString;
if (recentlyData.CalculateFlag[mainIndex])
{
if (itemDataList.CandleDataLists_Im.Count > 2)
var timeType = indi.MCandleTimeType;
var timeTypeDataList = dataList[timeType];
var subIndex = indi.CrossSubRegExpression;
var subSetup = totalIndicatorList.FirstOrDefault(t => t.IndexString == subIndex);
var itemDataList = timeTypeDataList.FirstOrDefault(t => t.ConGoodsData.CoinFullName == item);
if (itemDataList != null)
{
var before = itemDataList.CandleDataLists_Im[itemDataList.CandleDataLists_Im.Count - 2];
var beforeVal = before.IndicatorDic[key].value;
var recently = itemDataList.CandleDataLists_Im[itemDataList.CandleDataLists_Im.Count - 1];
var recentlyVal = recently.IndicatorDic[key].value;
if (slopeBuy == "+")
if (itemDataList.CandleDataLists_Im.Count > 2)
{
if (beforeVal < recentlyVal)
slopeDic[item] = true;
}
else if (slopeBuy == "-")
{
if (beforeVal > recentlyVal)
slopeDic[item] = true;
}
else
{
continue;
var before = itemDataList.CandleDataLists_Im[itemDataList.CandleDataLists_Im.Count - 2];
var key = CalculateManager.GetKeyData(indi);
var subKey = CalculateManager.GetKeyData(subSetup);
var mainVal = before.IndicatorDic[key].value;
var subVal = before.IndicatorDic[subKey].value;
if (subVal < mainVal)
continue;
}
}
}
@@ -959,6 +949,38 @@ namespace Million_Buyer
flag = true;
}
//손절 filter
if (sellExceptionCandleStateFlag)
{
try
{
var itemList = dataList[sellExceptionCandleStateType].FirstOrDefault(t => t.ConGoodsData.CoinFullName == item).CandleDataLists_Im;
if (itemList.Count >= sellExceptionCandleStateValue)
{
var stateFlag = true;
itemList.RemoveRange(0, itemList.Count - sellExceptionCandleStateValue);
foreach (var data in itemList)
{
if (data.EndValue > data.StartValue)
{
stateFlag = false;
break;
}
}
if (stateFlag)
{
str = "exception";
flag = true;
}
}
}
catch (Exception e)
{
InsertLog("Candle State Filter Error : " + e.Message);
}
}
if (!flag)
{
if (str != "exception")
@@ -997,57 +1019,7 @@ namespace Million_Buyer
scriptStr = sellScript.regularExpressionString;
}
if (allSell) flag = true;
if (slopeFlag)
{
if (!slopeDic.ContainsKey(item)) slopeDic[item] = true;
if (slopeDic[item])
{
var indi = totalIndicatorList.FirstOrDefault(t => t.IndexString == indicatorNum);
if (indi != null)
{
var timeType = indi.MCandleTimeType;
var timeTypeDataList = dataList[timeType];
var key = CalculateManager.GetKeyData(indi);
if (timeTypeDataList.Count > 0)
{
var itemDataList = timeTypeDataList.FirstOrDefault(t => t.ConGoodsData.CoinFullName == item);
if (itemDataList != null)
{
if (itemDataList.CandleDataLists_Im.Count > 2)
{
var before = itemDataList.CandleDataLists_Im[itemDataList.CandleDataLists_Im.Count - 2];
var beforeVal = before.IndicatorDic[key].value;
var recently = itemDataList.CandleDataLists_Im[itemDataList.CandleDataLists_Im.Count - 1];
var recentlyVal = recently.IndicatorDic[key].value;
if (slopeSell == "+")
{
if (beforeVal < recentlyVal)
{
slopeDic[item] = false;
if (buyCandleData.BuyValue < recentlyData.EndValue)
flag = true;
}
}
else if (slopeSell == "-")
{
if (beforeVal > recentlyVal)
{
slopeDic[item] = false;
if (buyCandleData.BuyValue < recentlyData.EndValue)
flag = true;
}
}
}
}
}
}
}
}
if (allSell) flag = true;
// 만약 팔때 거래량 부족이면 예외처리
if (TopVolFlag)

View File

@@ -86,15 +86,15 @@ namespace Million
cb_IncludeClearIndicator = new System.Windows.Forms.CheckBox();
cb_UpperMainIndi = new System.Windows.Forms.CheckBox();
groupBox12 = new System.Windows.Forms.GroupBox();
cb_SellExcpetionCandleStateType = new DevExpress.XtraEditors.ComboBoxEdit();
tb_SellExceptionCandleStateValue = new System.Windows.Forms.TextBox();
ck_SellExceptionCandleState = new System.Windows.Forms.CheckBox();
ck_SlopeSell = new System.Windows.Forms.CheckBox();
tb_BigMoneyVolCnt = new System.Windows.Forms.TextBox();
cb_BuyBigthanHighType = new DevExpress.XtraEditors.ComboBoxEdit();
cb_BigMoneyVolType = new DevExpress.XtraEditors.ComboBoxEdit();
ck_BigMoneyVol = new System.Windows.Forms.CheckBox();
ck_BuyBigthanHighVal = new System.Windows.Forms.CheckBox();
cb_sell = new DevExpress.XtraEditors.ComboBoxEdit();
cb_buy = new DevExpress.XtraEditors.ComboBoxEdit();
tb_IndicatorNum = new System.Windows.Forms.TextBox();
ck_SlopeSell = new System.Windows.Forms.CheckBox();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)comboBoxEdit_IndicatorSelection.Properties).BeginInit();
groupBox2.SuspendLayout();
@@ -126,10 +126,9 @@ namespace Million
((System.ComponentModel.ISupportInitialize)textEdit_SellExceptionRegularExpression.Properties).BeginInit();
groupBox10.SuspendLayout();
groupBox12.SuspendLayout();
((System.ComponentModel.ISupportInitialize)cb_SellExcpetionCandleStateType.Properties).BeginInit();
((System.ComponentModel.ISupportInitialize)cb_BuyBigthanHighType.Properties).BeginInit();
((System.ComponentModel.ISupportInitialize)cb_BigMoneyVolType.Properties).BeginInit();
((System.ComponentModel.ISupportInitialize)cb_sell.Properties).BeginInit();
((System.ComponentModel.ISupportInitialize)cb_buy.Properties).BeginInit();
SuspendLayout();
//
// groupBox1
@@ -805,9 +804,9 @@ namespace Million
// groupBox12
//
groupBox12.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
groupBox12.Controls.Add(cb_sell);
groupBox12.Controls.Add(cb_buy);
groupBox12.Controls.Add(tb_IndicatorNum);
groupBox12.Controls.Add(cb_SellExcpetionCandleStateType);
groupBox12.Controls.Add(tb_SellExceptionCandleStateValue);
groupBox12.Controls.Add(ck_SellExceptionCandleState);
groupBox12.Controls.Add(ck_SlopeSell);
groupBox12.Controls.Add(tb_BigMoneyVolCnt);
groupBox12.Controls.Add(cb_BuyBigthanHighType);
@@ -818,11 +817,50 @@ namespace Million
groupBox12.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
groupBox12.Name = "groupBox12";
groupBox12.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
groupBox12.Size = new System.Drawing.Size(249, 154);
groupBox12.Size = new System.Drawing.Size(249, 148);
groupBox12.TabIndex = 19;
groupBox12.TabStop = false;
groupBox12.Text = "Filter Setting";
//
// cb_SellExcpetionCandleStateType
//
cb_SellExcpetionCandleStateType.Location = new System.Drawing.Point(128, 121);
cb_SellExcpetionCandleStateType.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
cb_SellExcpetionCandleStateType.Name = "cb_SellExcpetionCandleStateType";
cb_SellExcpetionCandleStateType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) });
cb_SellExcpetionCandleStateType.Size = new System.Drawing.Size(61, 20);
cb_SellExcpetionCandleStateType.TabIndex = 32;
//
// tb_SellExceptionCandleStateValue
//
tb_SellExceptionCandleStateValue.Location = new System.Drawing.Point(195, 120);
tb_SellExceptionCandleStateValue.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tb_SellExceptionCandleStateValue.Name = "tb_SellExceptionCandleStateValue";
tb_SellExceptionCandleStateValue.Size = new System.Drawing.Size(30, 23);
tb_SellExceptionCandleStateValue.TabIndex = 31;
//
// ck_SellExceptionCandleState
//
ck_SellExceptionCandleState.AutoSize = true;
ck_SellExceptionCandleState.Location = new System.Drawing.Point(8, 122);
ck_SellExceptionCandleState.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
ck_SellExceptionCandleState.Name = "ck_SellExceptionCandleState";
ck_SellExceptionCandleState.Size = new System.Drawing.Size(122, 19);
ck_SellExceptionCandleState.TabIndex = 30;
ck_SellExceptionCandleState.Text = "몇 음봉 손절 조건";
ck_SellExceptionCandleState.UseVisualStyleBackColor = true;
//
// ck_SlopeSell
//
ck_SlopeSell.AutoSize = true;
ck_SlopeSell.Location = new System.Drawing.Point(8, 102);
ck_SlopeSell.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
ck_SlopeSell.Name = "ck_SlopeSell";
ck_SlopeSell.Size = new System.Drawing.Size(158, 19);
ck_SlopeSell.TabIndex = 29;
ck_SlopeSell.Text = "크로스 이전봉 확인 필터";
ck_SlopeSell.UseVisualStyleBackColor = true;
//
// tb_BigMoneyVolCnt
//
tb_BigMoneyVolCnt.Location = new System.Drawing.Point(97, 73);
@@ -872,41 +910,6 @@ namespace Million
ck_BuyBigthanHighVal.Text = "Buy가격>고가";
ck_BuyBigthanHighVal.UseVisualStyleBackColor = true;
//
// cb_sell
//
cb_sell.Location = new System.Drawing.Point(191, 127);
cb_sell.Name = "cb_sell";
cb_sell.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) });
cb_sell.Size = new System.Drawing.Size(45, 20);
cb_sell.TabIndex = 32;
//
// cb_buy
//
cb_buy.Location = new System.Drawing.Point(140, 127);
cb_buy.Name = "cb_buy";
cb_buy.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) });
cb_buy.Size = new System.Drawing.Size(45, 20);
cb_buy.TabIndex = 31;
//
// tb_IndicatorNum
//
tb_IndicatorNum.Location = new System.Drawing.Point(90, 124);
tb_IndicatorNum.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
tb_IndicatorNum.Name = "tb_IndicatorNum";
tb_IndicatorNum.Size = new System.Drawing.Size(44, 23);
tb_IndicatorNum.TabIndex = 30;
//
// ck_SlopeSell
//
ck_SlopeSell.AutoSize = true;
ck_SlopeSell.Location = new System.Drawing.Point(8, 102);
ck_SlopeSell.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
ck_SlopeSell.Name = "ck_SlopeSell";
ck_SlopeSell.Size = new System.Drawing.Size(227, 19);
ck_SlopeSell.TabIndex = 29;
ck_SlopeSell.Text = "기울기 판매 조건식 buy sell";
ck_SlopeSell.UseVisualStyleBackColor = true;
//
// MainForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -962,10 +965,9 @@ namespace Million
groupBox10.PerformLayout();
groupBox12.ResumeLayout(false);
groupBox12.PerformLayout();
((System.ComponentModel.ISupportInitialize)cb_SellExcpetionCandleStateType.Properties).EndInit();
((System.ComponentModel.ISupportInitialize)cb_BuyBigthanHighType.Properties).EndInit();
((System.ComponentModel.ISupportInitialize)cb_BigMoneyVolType.Properties).EndInit();
((System.ComponentModel.ISupportInitialize)cb_sell.Properties).EndInit();
((System.ComponentModel.ISupportInitialize)cb_buy.Properties).EndInit();
ResumeLayout(false);
}
@@ -1033,10 +1035,13 @@ namespace Million
private DevExpress.XtraEditors.ComboBoxEdit cb_BigMoneyVolType;
private System.Windows.Forms.CheckBox ck_BigMoneyVol;
private System.Windows.Forms.CheckBox ck_BuyBigthanHighVal;
private DevExpress.XtraEditors.ComboBoxEdit cb_sell;
private DevExpress.XtraEditors.ComboBoxEdit cb_buy;
private System.Windows.Forms.TextBox tb_IndicatorNum;
private System.Windows.Forms.CheckBox ck_SlopeSell;
private System.Windows.Forms.TextBox tb_SellExceptionCandleState;
private System.Windows.Forms.CheckBox cb_SellExceptionCandleState;
private System.Windows.Forms.CheckBox ck_SellExceptionCandleState;
private DevExpress.XtraEditors.ComboBoxEdit comboBoxEdit1;
private DevExpress.XtraEditors.ComboBoxEdit cb_SellExcpetionCandleStateType;
private System.Windows.Forms.TextBox tb_SellExceptionCandleStateValue;
}
}

View File

@@ -23,6 +23,7 @@ using Million_Hunter.HunterSubForm;
using System.Threading;
using DevExpress.CodeParser;
using System.DirectoryServices.ActiveDirectory;
using System.Printing;
namespace Million
{
@@ -40,12 +41,12 @@ namespace Million
private int _indexOfList = 0;
public Dictionary<string, bool> FirstTimeBuyFlag = null;
private Dictionary<string, bool> slopeDic = new Dictionary<string, bool>();
private bool slopeFlag = false;
private string indicatorNum = "";
private string slopeBuy = "";
private string slopeSell = "";
private bool sellExceptionCandleStateFlag = false;
private int sellExceptionCandleStateValue = 0;
private MCandleTimeType sellExceptionCandleStateType = MCandleTimeType.H1;
private Dictionary<string, DateTime> lastSellTime = new Dictionary<string, DateTime>();
@@ -71,6 +72,9 @@ namespace Million
comboBoxEdit_IndicatorSelection.Properties.Items.Clear();
comboBoxEdit_IndicatorSelection.Properties.Items.AddRange(InitManager.GetIndicatorTypeList());
cb_SellExcpetionCandleStateType.Properties.Items.Clear();
cb_SellExcpetionCandleStateType.Properties.Items.AddRange(InitManager.GetCandleTimeTypes());
cb_BigMoneyVolType.Properties.Items.Clear();
cb_BigMoneyVolType.Properties.Items.AddRange(InitManager.GetCandleTimeTypes());
cb_BuyBigthanHighType.Properties.Items.Clear();
@@ -91,16 +95,8 @@ namespace Million
simpleButton_SetupEdit.Visible = false;
simpleButton_SetupDelete.Visible = false;
simpleButton_TobuyList.Visible = true;
simpleButton_ToSellList.Visible = true;
var strList = new string[2];
strList[0] = "-";
strList[1] = "+";
cb_buy.Properties.Items.Clear();
cb_buy.Properties.Items.AddRange(strList);
cb_sell.Properties.Items.Clear();
cb_sell.Properties.Items.AddRange(strList);
simpleButton_ToSellList.Visible = true;
}
// 지표 콤보박스 클릭 시 이벤트
@@ -306,9 +302,15 @@ namespace Million
CommonProperty.InsertLogFlag = false;
int.TryParse(tb_BigMoneyVolCnt.Text, out int val);
if (cb_BigMoneyVolType.Text == "") cb_BigMoneyVolType.Text = "H1";
if (cb_BuyBigthanHighType.Text == "") cb_BuyBigthanHighType.Text = "H1";
if (cb_SellExcpetionCandleStateType.Text == "") cb_SellExcpetionCandleStateType.Text = "H1";
this.sellExceptionCandleStateFlag = ck_SellExceptionCandleState.Checked;
int.TryParse(tb_SellExceptionCandleStateValue.Text, out this.sellExceptionCandleStateValue);
this.sellExceptionCandleStateType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_SellExcpetionCandleStateType.Text.ToString());
this.slopeFlag = ck_SlopeSell.Checked;
CalculateDatas(_saveResultData, cb_UpperMainIndi.Checked, cb_IncludeClearIndicator.Checked, cb_DownBeforeValueFlag.Checked, rd_Hunter.Checked,
ck_BigMoneyVol.Checked, (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.Text.ToString()),
ck_BuyBigthanHighVal.Checked, (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BuyBigthanHighType.Text.ToString()), val);
@@ -357,12 +359,7 @@ namespace Million
var totalIndicator = new List<IndicatorCoditionSetup>();
totalIndicator.AddRange(buyIndicatorList);
totalIndicator.AddRange(sellIndicatorList);
slopeFlag = ck_SlopeSell.Checked;
indicatorNum = tb_IndicatorNum.Text;
slopeBuy = cb_buy.Text.ToString();
slopeSell = cb_sell.Text.ToString();
totalIndicator.AddRange(sellIndicatorList);
var tableList = CommonProperty.selectedMarketOfPlaceList;
var totalResultList = new List<SearchResult>();
@@ -702,11 +699,6 @@ namespace Million
//before 데이터 가져오는 함수 -> 사는 케이스만
var beforeData = standardData[type][standardData[type].Count - 2];
//예외처리
if(item == "KRW-BTC")
{
}
if (!buyList.Any(t => t.ConGoodsData.CoinFullName == item))
{
var flag = buyScript.DicExcuteScript(recentlyData.CalculateFlag);
@@ -769,31 +761,34 @@ namespace Million
if (slopeFlag)
{
var indi = totalIndicator.FirstOrDefault(t => t.IndexString == indicatorNum);
slopeDic[item] = false;
if (indi != null)
foreach (var indi in totalIndicator)
{
var timeType = indi.MCandleTimeType;
var key = CalculateManager.GetKeyData(indi);
var itemDataList = standardData[timeType];
if (itemDataList.Count > 2)
if (indi.SubIndicatorSetupType == SubIndicatorSetupType.크로스)
{
var before = itemDataList[itemDataList.Count - 2];
var beforeVal = before.IndicatorDic[key].value;
var recently = itemDataList[itemDataList.Count - 1];
var recentlyVal = recently.IndicatorDic[key].value;
if (slopeBuy == "+")
var mainIndex = indi.IndexString;
if (recentlyData.CalculateFlag[mainIndex])
{
if (beforeVal < recentlyVal)
slopeDic[item] = true;
}
else if (slopeBuy == "-")
{
if (beforeVal > recentlyVal)
slopeDic[item] = true;
var timeType = indi.MCandleTimeType;
var itemDataList = standardData[timeType];
var subIndex = indi.CrossSubRegExpression;
var subSetup = totalIndicator.FirstOrDefault(t => t.IndexString == subIndex);
if (itemDataList != null)
{
if (itemDataList.Count > 2)
{
var before = itemDataList[itemDataList.Count - 2];
var key = CalculateManager.GetKeyData(indi);
var subKey = CalculateManager.GetKeyData(subSetup);
var mainVal = before.IndicatorDic[key].value;
var subVal = before.IndicatorDic[subKey].value;
if (subVal < mainVal)
continue;
}
}
}
}
}
@@ -867,6 +862,29 @@ namespace Million
scriptStr = sellExceptionScript.regularExpressionString;
}
}
//손절 filter
if (sellExceptionCandleStateFlag)
{
var itemList = standardData[sellExceptionCandleStateType];
if(itemList.Count >= sellExceptionCandleStateValue)
{
var stateFlag = true;
itemList.RemoveRange(0,itemList.Count - sellExceptionCandleStateValue);
foreach(var data in itemList)
{
if (data.EndValue > data.StartValue) {
stateFlag = false;
break;
}
}
if (stateFlag)
{
str = "exception";
flag = true;
}
}
}
if (!flag)
{
@@ -906,48 +924,6 @@ namespace Million
scriptStr = sellScript.regularExpressionString;
}
if (slopeFlag)
{
var indi = totalIndicator.FirstOrDefault(t => t.IndexString == indicatorNum);
slopeDic[item] = false;
if (indi != null)
{
var timeType = indi.MCandleTimeType;
var key = CalculateManager.GetKeyData(indi);
var itemDataList = standardData[timeType];
if (itemDataList.Count > 2)
{
var before = itemDataList[itemDataList.Count - 2];
var beforeVal = before.IndicatorDic[key].value;
var recently = itemDataList[itemDataList.Count - 1];
var recentlyVal = recently.IndicatorDic[key].value;
if (slopeSell == "+")
{
if (beforeVal < recentlyVal)
{
slopeDic[item] = false;
if(recentlyData.EndValue > recentlyData.BuyValue)
flag = true;
}
}
else if (slopeSell == "-")
{
if (beforeVal > recentlyVal)
{
slopeDic[item] = false;
if (recentlyData.EndValue > recentlyData.BuyValue)
flag = true;
}
}
}
}
}
if (flag)
{
var sellItem = recentlyData;
@@ -1306,6 +1282,11 @@ namespace Million
{
CommonProperty.StarValueLowBuyValueUp = item.StarValueLowOverlapUp;
this.sellExceptionCandleStateFlag = item.SellExceptionCandleStateFlag;
this.sellExceptionCandleStateValue = item.SellExceptionCandleStateValue;
this.sellExceptionCandleStateType = item.SellExceptionCandleStateType;
this.slopeFlag = item.SlopeFlag;
CalculateDatas(item.SavedResultData, item.UpperMainIndicatorFlag, item.IncludeClearIndicator, item.DownBeforeValueFlag, item.HunterMode,
item.BigMoneyVolFlag, item.BigMoneyVolType, item.BuyBigthanHighValFlag, item.BuyBigthanHighValType, item.BigMoneyVolCnt);
LogManager.WriteLog("헌터 리스트 계산 완료. Name : " + item.SavedResultData.Name, "Hunter List 계산");
@@ -1354,7 +1335,7 @@ namespace Million
data.IncludeClearIndicator = cb_IncludeClearIndicator.Checked;
data.UpperMainIndicatorFlag = cb_UpperMainIndi.Checked;
data.StarValueLowOverlapUp = cb_StarValueLowOverlapUp.Checked;
data.SlopeFlag = ck_SlopeSell.Checked;
data.BigMoneyVolFlag = ck_BigMoneyVol.Checked;
if (data.BigMoneyVolFlag)
@@ -1363,7 +1344,15 @@ namespace Million
int.TryParse(tb_BigMoneyVolCnt.Text, out int val);
if (val == 0) val = 1;
data.BigMoneyVolCnt = val;
}
}
data.SellExceptionCandleStateFlag = ck_SellExceptionCandleState.Checked;
if (data.SellExceptionCandleStateFlag)
{
int.TryParse(tb_SellExceptionCandleState.Text, out int val);
data.SellExceptionCandleStateValue = val;
data.SellExceptionCandleStateType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_SellExcpetionCandleStateType.Text.ToString());
}
data.BuyBigthanHighValFlag = ck_BuyBigthanHighVal.Checked;

View File

@@ -38,5 +38,11 @@ namespace Million.Data.SaveData
public bool HunterMode { get; set; }
public string Name { get; set; }
public bool SlopeFlag { get; set; }
public bool SellExceptionCandleStateFlag { get; set; }
public int SellExceptionCandleStateValue { get; set; }
public CommonProperty.MCandleTimeType SellExceptionCandleStateType { get; set; }
}
}

View File

@@ -603,7 +603,7 @@ namespace Million.Manager
/// <param name="childrenCandleDataList"></param>
/// <returns></returns>
public static void CrossCondition(IndicatorCoditionSetup setUp, List<CandleData> parentCandleDataList, List<CandleData> childrenCandleDataList,
List<IndicatorCoditionSetup> subIndicatorList, string coinFullName, int type = 0)
List<IndicatorCoditionSetup> subIndicatorList, string coinFullName, int type = 0)
{
var key = GetKeyData(setUp);
if (key == null) return;
@@ -676,7 +676,7 @@ namespace Million.Manager
// 기준 Setup
var period = setUp.GetPeriod();
if (period > i) continue;
if (setUp.IndicatorType == IndicatorType.이동평균선)
if (((MovingAverageConditionSetup)setUp).MovingAverageType == MovingAverageType.거래량)
childs = GetChildrenDatas(parent, setUp.MCandleTimeType, childrenCandleDataList);
@@ -747,30 +747,30 @@ namespace Million.Manager
else
{
// 한개일 경우는 Overlap데이터를 0.1%씩 데이터를 올려서 확인
double mainValRate = (parent.IndicatorDic[key].highValue - parent.IndicatorDic[key].lowValue)/1000;
double subValRate = (parent.IndicatorDic[subKey].highValue - parent.IndicatorDic[subKey].lowValue)/1000;
double mainValRate = (parent.IndicatorDic[key].highValue - parent.IndicatorDic[key].lowValue) / 1000;
double subValRate = (parent.IndicatorDic[subKey].highValue - parent.IndicatorDic[subKey].lowValue) / 1000;
double valRate = (parent.HighValue - parent.LowValue) / 1000;
double mainVal = parent.IndicatorDic[key].lowValue;
double subVal = parent.IndicatorDic[subKey].lowValue;
double overlapVal = parent.LowValue;
double overlapVal = parent.LowValue;
for (var rate = 0; rate < 1000; rate++)
{
if(mainVal > subVal)
{
if (mainVal > subVal)
{
break;
}
mainVal += mainValRate;
subVal += subValRate;
overlapVal += valRate;
}
if (!parent.IndicatorDic.ContainsKey(key))
{
parent.IndicatorDic[key] = new IndicatorData();
parent.IndicatorDic[key].overlapValue = overlapVal;
parent.IndicatorDic[key].overlapValue = overlapVal;
}
else
{
@@ -786,8 +786,8 @@ namespace Million.Manager
item.CalculateFlag[setUp.IndexString] = true;
}
}
parent.CalculateFlag[setUp.IndexString] = true;
parent.CalculateFlag[setUp.IndexString] = true;
// 해당하는 봉만 True
if (setUp.CrossType == CrossType.CrossOverStatus)