명명규칙 수정
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm
|
||||
|
||||
// 기준선 (OverLine으로 설정)
|
||||
checkedListBoxControl_Lines.Items.First(item =>
|
||||
item.Value == CommonProperty.Indicator_IchmokuOverLine.선행스팬1OR2중고가.ToString()).CheckState = CheckState.Checked;
|
||||
item.Value.ToString() == CommonProperty.Indicator_IchmokuOverLine.선행스팬1OR2중고가.ToString()).CheckState = CheckState.Checked;
|
||||
|
||||
}
|
||||
// 저장된 데이터인 경우
|
||||
@@ -69,7 +69,7 @@ namespace Million_Hunter.HunterSubForm.IndicatorSetupForm
|
||||
|
||||
// 지표 기준선 설정
|
||||
checkedListBoxControl_Lines.Items
|
||||
.First(item => item.Value == _ichimokuConditionSetup.IndicatorIchmokuOverLine.ToString()).CheckState =
|
||||
.First(item => item.Value.ToString() == _ichimokuConditionSetup.IndicatorIchmokuOverLine.ToString()).CheckState =
|
||||
CheckState.Checked;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,18 @@
|
||||
using Million;
|
||||
|
||||
using Million.Data;
|
||||
using Million.Data.Upbit;
|
||||
using Million.DbManagement;
|
||||
using Million.Indicators;
|
||||
using Million.Manager;
|
||||
using Million.WebMangement.Upbit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using static Million.CommonProperty;
|
||||
using Million.IndicatorConditionSetup;
|
||||
using System.CodeDom.Compiler;
|
||||
using Microsoft.CodeAnalysis.CSharp.Scripting;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Million_Prototype
|
||||
{
|
||||
@@ -120,28 +108,7 @@ namespace Million_Prototype
|
||||
//DB데이터 불러오기
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
DbServiceFunctions.GetMarketTable_FromDB("Upbit");
|
||||
var tableList = CommonProperty.selectedMarketOfPlaceList;
|
||||
|
||||
var selectTable = tableList.FirstOrDefault(t => t.CodeFullName == "KRW-BTC");
|
||||
if (selectTable != null)
|
||||
{
|
||||
var startDate = new DateTime(2000, 1, 1);
|
||||
var candleData = DbServiceFunctions.GetCandleData(selectTable, startDate, 100000, MCandleTimeType.M1);
|
||||
|
||||
Bollinger_Bands.AddMovingAndBollingerBands(candleData.CandleDataLists_Im, 40, 2);
|
||||
Bollinger_Bands.AddMovingAndBollingerBands(candleData.CandleDataLists_Im, 40, 1, false);
|
||||
Ichimoku_cloud.excute1(candleData.CandleDataLists_Im);
|
||||
|
||||
var resultdata = candleData.CandleDataLists_Im.FindAll(x => x.IndicatorDic["Bol401"].overStatus == OverStatus.Over);
|
||||
|
||||
resultdata.ToString();
|
||||
}
|
||||
|
||||
List<Indicator> indiList = new List<Indicator>();
|
||||
|
||||
indiList.Add(new Bollinger_Bands(40, 1));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
@@ -186,255 +153,255 @@ namespace Million_Prototype
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
DbServiceFunctions.GetMarketTable_FromDB("Upbit");
|
||||
var tableList = CommonProperty.selectedMarketOfPlaceList;
|
||||
var resultList = new List<SearchResult>();
|
||||
var errorResultList = new List<SearchResult>();
|
||||
var win = 0;
|
||||
var lose = 0;
|
||||
foreach (var marketData in tableList)
|
||||
{
|
||||
//DbServiceFunctions.GetMarketTable_FromDB("Upbit");
|
||||
//var tableList = CommonProperty.selectedMarketOfPlaceList;
|
||||
//var resultList = new List<SearchResult>();
|
||||
//var errorResultList = new List<SearchResult>();
|
||||
//var win = 0;
|
||||
//var lose = 0;
|
||||
//foreach (var marketData in tableList)
|
||||
//{
|
||||
|
||||
var buyCandleList = new List<CandleDataList>();
|
||||
var sellList = new List<CandleData>();
|
||||
if (marketData != null)
|
||||
{
|
||||
//사는 로직
|
||||
var candleDataH1 = new CandleDataList();
|
||||
var candleDataM1 = new CandleDataList();
|
||||
var splitDataM = new List<List<CandleData>>();
|
||||
var splitData = ValidationCheckManager.GetValidationCandleDatas(marketData, ref splitDataM, ref candleDataH1, ref candleDataM1, new DateTime(2022, 1, 1), DateTime.Now);
|
||||
// var buyCandleList = new List<CandleDataList>();
|
||||
// var sellList = new List<CandleData>();
|
||||
// if (marketData != null)
|
||||
// {
|
||||
// //사는 로직
|
||||
// var candleDataH1 = new CandleDataList();
|
||||
// var candleDataM1 = new CandleDataList();
|
||||
// var splitDataM = new List<List<CandleData>>();
|
||||
// var splitData = ValidationCheckManager.GetValidationCandleDatas(marketData, ref splitDataM, ref candleDataH1, ref candleDataM1, new DateTime(2022, 1, 1), DateTime.Now);
|
||||
|
||||
var buyData = new CandleDataList();
|
||||
buyData.ConGoodsData = marketData;
|
||||
buyData.CandleDataLists_Im = new List<CandleData>();
|
||||
// var buyData = new CandleDataList();
|
||||
// buyData.ConGoodsData = marketData;
|
||||
// buyData.CandleDataLists_Im = new List<CandleData>();
|
||||
|
||||
foreach (var split in splitData)
|
||||
{
|
||||
var overData = split.FindAll(x => (int)x.IndicatorDic["Bol401"].overStatus >= -2 && x.IndicatorDic["Bol401"].overStatus != OverStatus.None
|
||||
&& ((IchimokData)x.IndicatorDic["Ich"]).value < x.StartValue && ((IchimokData)x.IndicatorDic["Ich"]).value2 < x.StartValue);
|
||||
// foreach (var split in splitData)
|
||||
// {
|
||||
// var overData = split.FindAll(x => (int)x.IndicatorDic["Bol401"].overStatus >= -2 && x.IndicatorDic["Bol401"].overStatus != OverStatus.None
|
||||
// && ((IchimokData)x.IndicatorDic["Ich"]).value < x.StartValue && ((IchimokData)x.IndicatorDic["Ich"]).value2 < x.StartValue);
|
||||
|
||||
buyData = BuyLogicManager.GetBuyLogicByBol401Upper(overData, candleDataM1);
|
||||
if (buyData.CandleDataLists_Im != null && buyData.CandleDataLists_Im.Count > 0)
|
||||
buyCandleList.Add(buyData);
|
||||
}
|
||||
// buyData = BuyLogicManager.GetBuyLogicByBol401Upper(overData, candleDataM1);
|
||||
// if (buyData.CandleDataLists_Im != null && buyData.CandleDataLists_Im.Count > 0)
|
||||
// buyCandleList.Add(buyData);
|
||||
// }
|
||||
|
||||
//파는 로직
|
||||
foreach (var item in splitDataM)
|
||||
{
|
||||
var sell1 = SellLogicManager.GetSellLogicOverUnderIch(item);
|
||||
var sell2 = SellLogicManager.GetSellLogicOVerUnderBol(item, 40, 1);
|
||||
var sell3 = SellLogicManager.GetSellLogicOVerUnderBol(item, 40, 2);
|
||||
// //파는 로직
|
||||
// foreach (var item in splitDataM)
|
||||
// {
|
||||
// var sell1 = SellLogicManager.GetSellLogicOverUnderIch(item);
|
||||
// var sell2 = SellLogicManager.GetSellLogicOVerUnderBol(item, 40, 1);
|
||||
// var sell3 = SellLogicManager.GetSellLogicOVerUnderBol(item, 40, 2);
|
||||
|
||||
sell1.AddRange(sell2);
|
||||
sell1.AddRange(sell3);
|
||||
// sell1.AddRange(sell2);
|
||||
// sell1.AddRange(sell3);
|
||||
|
||||
var dateTimeList = sell1.Select(t => t.DateTime).Distinct().ToList();
|
||||
// var dateTimeList = sell1.Select(t => t.DateTime).Distinct().ToList();
|
||||
|
||||
foreach (var date in dateTimeList)
|
||||
{
|
||||
sellList.Add(sell1.FirstOrDefault(t => t.DateTime == date));
|
||||
}
|
||||
}
|
||||
// foreach (var date in dateTimeList)
|
||||
// {
|
||||
// sellList.Add(sell1.FirstOrDefault(t => t.DateTime == date));
|
||||
// }
|
||||
// }
|
||||
|
||||
var result = new SearchResult();
|
||||
var sellData = new CandleData();
|
||||
//Result 계산
|
||||
foreach (var item in buyCandleList)
|
||||
{
|
||||
result.BuyList.ConGoodsData = marketData;
|
||||
// var result = new SearchResult();
|
||||
// var sellData = new CandleData();
|
||||
// //Result 계산
|
||||
// foreach (var item in buyCandleList)
|
||||
// {
|
||||
// result.BuyList.ConGoodsData = marketData;
|
||||
|
||||
if (item.CandleDataLists_Im.Count > 0)
|
||||
{
|
||||
sellData = sellList.FirstOrDefault(t => t.DateTime > item.CandleDataLists_Im[0].DateTime);
|
||||
if (sellData == null) continue;
|
||||
foreach (var buy in item.CandleDataLists_Im)
|
||||
{
|
||||
// if (item.CandleDataLists_Im.Count > 0)
|
||||
// {
|
||||
// sellData = sellList.FirstOrDefault(t => t.DateTime > item.CandleDataLists_Im[0].DateTime);
|
||||
// if (sellData == null) continue;
|
||||
// foreach (var buy in item.CandleDataLists_Im)
|
||||
// {
|
||||
|
||||
if (buy.DateTime < sellData.DateTime)
|
||||
{
|
||||
result.BuyList.CandleDataLists_Im.Add(buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
var sDate = result.BuyList.CandleDataLists_Im[0].DateTime;
|
||||
var eDate = sellData.DateTime;
|
||||
// if (buy.DateTime < sellData.DateTime)
|
||||
// {
|
||||
// result.BuyList.CandleDataLists_Im.Add(buy);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var sDate = result.BuyList.CandleDataLists_Im[0].DateTime;
|
||||
// var eDate = sellData.DateTime;
|
||||
|
||||
//Result Data Setting
|
||||
result.TermCandleDataList = candleDataM1.CandleDataLists_Im.Where(x => x.DateTime >= sDate && x.DateTime <= eDate).ToList();
|
||||
result.CodeFullName = result.BuyList.ConGoodsData.CodeFullName;
|
||||
result.StartDate = sDate;
|
||||
result.EndDate = eDate;
|
||||
result.SellData = sellData;
|
||||
var sellLogicKeys = result.SellData.SellLogicFlag.Keys;
|
||||
// //Result Data Setting
|
||||
// result.TermCandleDataList = candleDataM1.CandleDataLists_Im.Where(x => x.DateTime >= sDate && x.DateTime <= eDate).ToList();
|
||||
// result.CodeFullName = result.BuyList.ConGoodsData.CodeFullName;
|
||||
// result.StartDate = sDate;
|
||||
// result.EndDate = eDate;
|
||||
// result.SellData = sellData;
|
||||
// var sellLogicKeys = result.SellData.SellLogicFlag.Keys;
|
||||
|
||||
double sellValue = 0;
|
||||
#region 파는 값 계산(파는 로직 중 제일 높은 값)
|
||||
var key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.IchMok);
|
||||
if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
{
|
||||
if (sellValue < ((IchimokData)result.SellData.IndicatorDic["Ich"]).GetOverValue())
|
||||
{
|
||||
sellValue = ((IchimokData)result.SellData.IndicatorDic["Ich"]).GetOverValue();
|
||||
}
|
||||
}
|
||||
// double sellValue = 0;
|
||||
// #region 파는 값 계산(파는 로직 중 제일 높은 값)
|
||||
// var key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.IchMok);
|
||||
// if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
// {
|
||||
// if (sellValue < ((IchimokData)result.SellData.IndicatorDic["Ich"]).GetOverValue())
|
||||
// {
|
||||
// sellValue = ((IchimokData)result.SellData.IndicatorDic["Ich"]).GetOverValue();
|
||||
// }
|
||||
// }
|
||||
|
||||
key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "401";
|
||||
if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
{
|
||||
if (sellValue < result.SellData.IndicatorDic[key].overlapValue)
|
||||
{
|
||||
sellValue = result.SellData.IndicatorDic[key].overlapValue;
|
||||
}
|
||||
}
|
||||
// key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "401";
|
||||
// if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
// {
|
||||
// if (sellValue < result.SellData.IndicatorDic[key].overlapValue)
|
||||
// {
|
||||
// sellValue = result.SellData.IndicatorDic[key].overlapValue;
|
||||
// }
|
||||
// }
|
||||
|
||||
key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "402";
|
||||
if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
{
|
||||
if (sellValue < result.SellData.IndicatorDic[key].overlapValue)
|
||||
{
|
||||
sellValue = result.SellData.IndicatorDic[key].overlapValue;
|
||||
}
|
||||
}
|
||||
result.SellValue = sellValue;
|
||||
#endregion
|
||||
// key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "402";
|
||||
// if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
// {
|
||||
// if (sellValue < result.SellData.IndicatorDic[key].overlapValue)
|
||||
// {
|
||||
// sellValue = result.SellData.IndicatorDic[key].overlapValue;
|
||||
// }
|
||||
// }
|
||||
// result.SellValue = sellValue;
|
||||
// #endregion
|
||||
|
||||
#region Rating 계산
|
||||
double totalVal = 0;
|
||||
foreach (var x in result.BuyList.CandleDataLists_Im)
|
||||
{
|
||||
var dateTime = x.DateTime.AddMinutes(x.DateTime.Minute * -1);
|
||||
var hCandle = candleDataH1.CandleDataLists_Im.FirstOrDefault(t => t.DateTime == dateTime);
|
||||
var buyValue = hCandle.IndicatorDic[Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "401"].overlapValue;
|
||||
var rate = ((sellValue - buyValue) / buyValue) * 100;
|
||||
result.BuyEarningRate.Add(rate);
|
||||
result.BuyValueList.Add(buyValue);
|
||||
// #region Rating 계산
|
||||
// double totalVal = 0;
|
||||
// foreach (var x in result.BuyList.CandleDataLists_Im)
|
||||
// {
|
||||
// var dateTime = x.DateTime.AddMinutes(x.DateTime.Minute * -1);
|
||||
// var hCandle = candleDataH1.CandleDataLists_Im.FirstOrDefault(t => t.DateTime == dateTime);
|
||||
// var buyValue = hCandle.IndicatorDic[Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "401"].overlapValue;
|
||||
// var rate = ((sellValue - buyValue) / buyValue) * 100;
|
||||
// result.BuyEarningRate.Add(rate);
|
||||
// result.BuyValueList.Add(buyValue);
|
||||
|
||||
if (rate >= 0) win++;
|
||||
else lose++;
|
||||
// if (rate >= 0) win++;
|
||||
// else lose++;
|
||||
|
||||
totalVal += rate;
|
||||
}
|
||||
result.TotalEarningRate = totalVal / result.BuyValueList.Count;
|
||||
#endregion
|
||||
// totalVal += rate;
|
||||
// }
|
||||
// result.TotalEarningRate = totalVal / result.BuyValueList.Count;
|
||||
// #endregion
|
||||
|
||||
var errorList = ValidationCheckManager.ValidateCandleDataList(result.TermCandleDataList, "", MCandleTimeType.M1);
|
||||
// var errorList = ValidationCheckManager.ValidateCandleDataList(result.TermCandleDataList, "", MCandleTimeType.M1);
|
||||
|
||||
if (errorList.Count == 0)
|
||||
{
|
||||
result.SellData = sellData;
|
||||
resultList.Add(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.SellData = sellData;
|
||||
errorResultList.Add(result);
|
||||
}
|
||||
// if (errorList.Count == 0)
|
||||
// {
|
||||
// result.SellData = sellData;
|
||||
// resultList.Add(result);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// result.SellData = sellData;
|
||||
// errorResultList.Add(result);
|
||||
// }
|
||||
|
||||
result = new SearchResult();
|
||||
result.BuyList.CandleDataLists_Im.Add(buy);
|
||||
result.CodeFullName = result.BuyList.ConGoodsData.CodeFullName;
|
||||
sellData = sellList.FirstOrDefault(t => t.DateTime > buy.DateTime);
|
||||
}
|
||||
}
|
||||
// result = new SearchResult();
|
||||
// result.BuyList.CandleDataLists_Im.Add(buy);
|
||||
// result.CodeFullName = result.BuyList.ConGoodsData.CodeFullName;
|
||||
// sellData = sellList.FirstOrDefault(t => t.DateTime > buy.DateTime);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//Sell 시점이 더 늦는 경우에 대한 처리(나중에 안에 있는 로직이랑 병합해서 한번에처리해야함
|
||||
if (result.BuyList.CandleDataLists_Im.Count > 0)
|
||||
{
|
||||
var sDate = result.BuyList.CandleDataLists_Im[0].DateTime;
|
||||
var eDate = sellData.DateTime;
|
||||
// }
|
||||
// }
|
||||
// //Sell 시점이 더 늦는 경우에 대한 처리(나중에 안에 있는 로직이랑 병합해서 한번에처리해야함
|
||||
// if (result.BuyList.CandleDataLists_Im.Count > 0)
|
||||
// {
|
||||
// var sDate = result.BuyList.CandleDataLists_Im[0].DateTime;
|
||||
// var eDate = sellData.DateTime;
|
||||
|
||||
//Result Data Setting
|
||||
result.TermCandleDataList = candleDataM1.CandleDataLists_Im.Where(x => x.DateTime >= sDate && x.DateTime <= eDate).ToList();
|
||||
result.CodeFullName = result.BuyList.ConGoodsData.CodeFullName;
|
||||
result.StartDate = sDate;
|
||||
result.EndDate = eDate;
|
||||
result.SellData = sellData;
|
||||
var sellLogicKeys = result.SellData.SellLogicFlag.Keys;
|
||||
// //Result Data Setting
|
||||
// result.TermCandleDataList = candleDataM1.CandleDataLists_Im.Where(x => x.DateTime >= sDate && x.DateTime <= eDate).ToList();
|
||||
// result.CodeFullName = result.BuyList.ConGoodsData.CodeFullName;
|
||||
// result.StartDate = sDate;
|
||||
// result.EndDate = eDate;
|
||||
// result.SellData = sellData;
|
||||
// var sellLogicKeys = result.SellData.SellLogicFlag.Keys;
|
||||
|
||||
double sellValue = 0;
|
||||
#region 파는 값 계산(파는 로직 중 제일 높은 값)
|
||||
var key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.IchMok);
|
||||
if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
{
|
||||
if (sellValue < ((IchimokData)result.SellData.IndicatorDic["Ich"]).GetOverValue())
|
||||
{
|
||||
sellValue = ((IchimokData)result.SellData.IndicatorDic["Ich"]).GetOverValue();
|
||||
}
|
||||
}
|
||||
// double sellValue = 0;
|
||||
// #region 파는 값 계산(파는 로직 중 제일 높은 값)
|
||||
// var key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.IchMok);
|
||||
// if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
// {
|
||||
// if (sellValue < ((IchimokData)result.SellData.IndicatorDic["Ich"]).GetOverValue())
|
||||
// {
|
||||
// sellValue = ((IchimokData)result.SellData.IndicatorDic["Ich"]).GetOverValue();
|
||||
// }
|
||||
// }
|
||||
|
||||
key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "401";
|
||||
if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
{
|
||||
if (sellValue < result.SellData.IndicatorDic[key].overlapValue)
|
||||
{
|
||||
sellValue = result.SellData.IndicatorDic[key].overlapValue;
|
||||
}
|
||||
}
|
||||
// key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "401";
|
||||
// if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
// {
|
||||
// if (sellValue < result.SellData.IndicatorDic[key].overlapValue)
|
||||
// {
|
||||
// sellValue = result.SellData.IndicatorDic[key].overlapValue;
|
||||
// }
|
||||
// }
|
||||
|
||||
key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "402";
|
||||
if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
{
|
||||
if (sellValue < result.SellData.IndicatorDic[key].overlapValue)
|
||||
{
|
||||
sellValue = result.SellData.IndicatorDic[key].overlapValue;
|
||||
}
|
||||
}
|
||||
result.SellValue = sellValue;
|
||||
#endregion
|
||||
// key = Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "402";
|
||||
// if (result.SellData.SellLogicFlag.ContainsKey(key))
|
||||
// {
|
||||
// if (sellValue < result.SellData.IndicatorDic[key].overlapValue)
|
||||
// {
|
||||
// sellValue = result.SellData.IndicatorDic[key].overlapValue;
|
||||
// }
|
||||
// }
|
||||
// result.SellValue = sellValue;
|
||||
// #endregion
|
||||
|
||||
#region Rating 계산
|
||||
double totalVal = 0;
|
||||
foreach (var x in result.BuyList.CandleDataLists_Im)
|
||||
{
|
||||
var dateTime = x.DateTime.AddMinutes(x.DateTime.Minute * -1);
|
||||
var hCandle = candleDataH1.CandleDataLists_Im.FirstOrDefault(t => t.DateTime == dateTime);
|
||||
var buyValue = hCandle.IndicatorDic[Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "401"].overlapValue;
|
||||
var rate = ((sellValue - buyValue) / buyValue) * 100;
|
||||
result.BuyEarningRate.Add(rate);
|
||||
result.BuyValueList.Add(buyValue);
|
||||
// #region Rating 계산
|
||||
// double totalVal = 0;
|
||||
// foreach (var x in result.BuyList.CandleDataLists_Im)
|
||||
// {
|
||||
// var dateTime = x.DateTime.AddMinutes(x.DateTime.Minute * -1);
|
||||
// var hCandle = candleDataH1.CandleDataLists_Im.FirstOrDefault(t => t.DateTime == dateTime);
|
||||
// var buyValue = hCandle.IndicatorDic[Enum.GetName(typeof(CommonProperty.SellLogicKeyList), CommonProperty.SellLogicKeyList.Bol) + "401"].overlapValue;
|
||||
// var rate = ((sellValue - buyValue) / buyValue) * 100;
|
||||
// result.BuyEarningRate.Add(rate);
|
||||
// result.BuyValueList.Add(buyValue);
|
||||
|
||||
if (rate >= 0) win++;
|
||||
else lose++;
|
||||
// if (rate >= 0) win++;
|
||||
// else lose++;
|
||||
|
||||
totalVal += rate;
|
||||
}
|
||||
result.TotalEarningRate = totalVal / result.BuyValueList.Count;
|
||||
#endregion
|
||||
// totalVal += rate;
|
||||
// }
|
||||
// result.TotalEarningRate = totalVal / result.BuyValueList.Count;
|
||||
// #endregion
|
||||
|
||||
var errorList = ValidationCheckManager.ValidateCandleDataList(result.TermCandleDataList, "", MCandleTimeType.M1);
|
||||
// var errorList = ValidationCheckManager.ValidateCandleDataList(result.TermCandleDataList, "", MCandleTimeType.M1);
|
||||
|
||||
if (errorList.Count == 0)
|
||||
{
|
||||
result.SellData = sellData;
|
||||
resultList.Add(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.SellData = sellData;
|
||||
errorResultList.Add(result);
|
||||
}
|
||||
}
|
||||
// if (errorList.Count == 0)
|
||||
// {
|
||||
// result.SellData = sellData;
|
||||
// resultList.Add(result);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// result.SellData = sellData;
|
||||
// errorResultList.Add(result);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
double total = 0;
|
||||
foreach (var item in resultList)
|
||||
{
|
||||
Console.WriteLine(item.CodeFullName);
|
||||
Console.WriteLine(item.TotalEarningRate);
|
||||
total += item.TotalEarningRate;
|
||||
}
|
||||
// }
|
||||
//}
|
||||
//double total = 0;
|
||||
//foreach (var item in resultList)
|
||||
//{
|
||||
// Console.WriteLine(item.CodeFullName);
|
||||
// Console.WriteLine(item.TotalEarningRate);
|
||||
// total += item.TotalEarningRate;
|
||||
//}
|
||||
|
||||
Console.WriteLine("Total 수익률 : " + total / resultList.Count);
|
||||
Console.WriteLine("Win : " + win);
|
||||
Console.WriteLine("Lose : " + lose);
|
||||
Console.WriteLine("승률 : " + win * 100 / (win + lose));
|
||||
resultList.ToString();
|
||||
//Console.WriteLine("Total 수익률 : " + total / resultList.Count);
|
||||
//Console.WriteLine("Win : " + win);
|
||||
//Console.WriteLine("Lose : " + lose);
|
||||
//Console.WriteLine("승률 : " + win * 100 / (win + lose));
|
||||
//resultList.ToString();
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Million.Data;
|
||||
using Million.Indicators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -72,7 +71,7 @@ namespace Million.IndicatorConditionSetup
|
||||
if (mov_save)
|
||||
{
|
||||
//단순 이평선 계산
|
||||
Moving_average.SMA_average(data[i], mov, total_average - data[i].EndValue, Period, data[i - 1].IndicatorDic[movingKeyName].indicator_over);
|
||||
MovingAverageConditionSetup.SMA_average(data[i], mov, total_average - data[i].EndValue, Period, data[i - 1].IndicatorDic[movingKeyName].indicator_over);
|
||||
}
|
||||
double average = total_average / Period;
|
||||
double average_Open = total_Open / Period;
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using Million.Data;
|
||||
using Million.DbManagement;
|
||||
using Million.Indicators;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Million.CommonProperty;
|
||||
|
||||
namespace Million.Manager
|
||||
@@ -202,34 +199,7 @@ namespace Million.Manager
|
||||
}
|
||||
if (returnData.Count == 0) returnData.Add(list);
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Candle Data 기준 사용가능한 Candle Data Return 해주는 함수
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<List<CandleData>> GetValidationCandleDatas(MarketData marketData,ref List<List<CandleData>> candleDataM, ref CandleDataList candleDataH1, ref CandleDataList candleDataM1, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
if(startDate == null)
|
||||
startDate = new DateTime(2000, 1, 1);
|
||||
|
||||
if (endDate == null)
|
||||
endDate = DateTime.Now;
|
||||
|
||||
//1시간
|
||||
candleDataH1 = DbServiceFunctions.GetCandleData(marketData, startDate, endDate, MCandleTimeType.H1);
|
||||
Bollinger_Bands.AddMovingAndBollingerBands(candleDataH1.CandleDataLists_Im, 40, 1);
|
||||
Ichimoku_cloud.excute1(candleDataH1.CandleDataLists_Im);
|
||||
|
||||
//1분봉
|
||||
candleDataM1 = DbServiceFunctions.GetCandleData(marketData, startDate, endDate, MCandleTimeType.M1);
|
||||
Bollinger_Bands.AddMovingAndBollingerBands(candleDataM1.CandleDataLists_Im, 40, 1);
|
||||
Bollinger_Bands.AddMovingAndBollingerBands(candleDataM1.CandleDataLists_Im, 40, 2, false);
|
||||
Ichimoku_cloud.excute1(candleDataM1.CandleDataLists_Im);
|
||||
candleDataM = SplitValidationCandleDataList(candleDataM1.CandleDataLists_Im,MCandleTimeType.M1);
|
||||
return SplitValidationCandleDataList(candleDataH1.CandleDataLists_Im, MCandleTimeType.H1);
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 기간별 무결성 검사 후 사용가능한 List만 Return되도록 하는 함수
|
||||
/// 0개일 경우 사용불가
|
||||
|
||||
Reference in New Issue
Block a user