하향선 관련 처리 볼랜저

This commit is contained in:
kyh
2024-02-27 13:27:42 +09:00
parent 38a907ed15
commit 9df8324d48
2 changed files with 52 additions and 20 deletions

View File

@@ -21,6 +21,7 @@ using static Million.CommonProperty;
using Million.Data.SaveData;
using Million_Hunter.HunterSubForm;
using System.Threading;
using DevExpress.CodeParser;
namespace Million
{
@@ -368,20 +369,24 @@ namespace Million
// for (var i = 0; i < tableList.Count; i++)
//{
var market = tableList[i];
var distinctIndicator = IndicatorSetupManager.Distinct(totalIndicator);
if (!market.CoinFullName.Contains("BTT"))
{
var distinctIndicator = IndicatorSetupManager.Distinct(totalIndicator);
if (hunterMode)
{
var list = CalculateHunter(totalIndicator, startDate, endDate, market, distinctIndicator,
buyScript, sellScript);
dic[market.CoinFullName] = list;
}
else
{
var list = CalculateHunterRealtime(totalIndicator, startDate, endDate,
market, distinctIndicator, overlapBuyManagementList, buyScript, sellScript, sellExceptionScript,
bigMoneyVolFlag, bigMoneyVolType, buyBigthanHighValFlag, buyBigthanHighValType, bigMoneyVolCnt);
dic[market.CoinFullName] = list;
}
if (hunterMode)
{
var list = CalculateHunter(totalIndicator, startDate, endDate, market, distinctIndicator,
buyScript, sellScript);
dic[market.CoinFullName] = list;
}
else
{
var list = CalculateHunterRealtime(totalIndicator, startDate, endDate,
market, distinctIndicator, overlapBuyManagementList, buyScript, sellScript, sellExceptionScript,
bigMoneyVolFlag, bigMoneyVolType, buyBigthanHighValFlag, buyBigthanHighValType, bigMoneyVolCnt);
dic[market.CoinFullName] = list;
}
//}
});
@@ -1157,7 +1162,14 @@ namespace Million
}
multiSavedResultDatas.Add(data);
_saveResultData = new SavedResultData();
if (multiSavedResultDatas == null)
multiSavedResultDatas = new List<MultiSavedResultData>();
// 트리리스트 와 클래스 리스트 연결
treeList_BuySetupList.DataSource = _saveResultData.BuySetupList = new List<object>();
treeList_SellSetupList.DataSource = _saveResultData.SellSetupList = new List<object>();
MessageBox.Show("추가 완료");
}
}

View File

@@ -122,7 +122,7 @@ namespace Million.IndicatorConditionSetup
bol.lowValue = average_Low - Squared * Math.Sqrt(t_Low / Period);
bol.value = average - Squared * Math.Sqrt(t_Close / Period);
}
else
else if(Indicator_BolingerOverLine == CommonProperty.Indicator_BolingerOverLine.상향선)
{
bol.startValue = average_Open + Squared * Math.Sqrt(t_Open / Period);
bol.highValue = average_High + Squared * Math.Sqrt(t_High / Period);
@@ -188,10 +188,20 @@ namespace Million.IndicatorConditionSetup
t_Low += Math.Pow(data[j].LowValue - average_Low, 2);
t_Close += Math.Pow(data[j].EndValue - average, 2);
bol.startValue = average_Open + Squared * Math.Sqrt(t_Open / Period);
bol.highValue = average_High + Squared * Math.Sqrt(t_High / Period);
bol.lowValue = average_Low + Squared * Math.Sqrt(t_Low / Period);
bol.value = average + Squared * Math.Sqrt(t_Close / Period);
if(Indicator_BolingerOverLine == CommonProperty.Indicator_BolingerOverLine.상향선)
{
bol.startValue = average_Open + Squared * Math.Sqrt(t_Open / Period);
bol.highValue = average_High + Squared * Math.Sqrt(t_High / Period);
bol.lowValue = average_Low + Squared * Math.Sqrt(t_Low / Period);
bol.value = average + Squared * Math.Sqrt(t_Close / Period);
}
else if (Indicator_BolingerOverLine == CommonProperty.Indicator_BolingerOverLine.하향선)
{
bol.startValue = average_Open - +Squared * Math.Sqrt(t_Open / Period);
bol.highValue = average_High - Squared * Math.Sqrt(t_High / Period);
bol.lowValue = average_Low - Squared * Math.Sqrt(t_Low / Period);
bol.value = average - Squared * Math.Sqrt(t_Close / Period);
}
IndicatorData.OverChecker(data[i], bol, data[i - 1].IndicatorDic[bolKeyName].indicator_over);
@@ -214,7 +224,12 @@ namespace Million.IndicatorConditionSetup
}
t += Math.Pow(candle - aver, 2);
return aver + Squared * Math.Sqrt(t / Period);
if (Indicator_BolingerOverLine == CommonProperty.Indicator_BolingerOverLine.상향선)
return aver + Squared * Math.Sqrt(t / Period);
else if (Indicator_BolingerOverLine == CommonProperty.Indicator_BolingerOverLine.하향선)
return aver - Squared * Math.Sqrt(t / Period);
else return aver;
}
@@ -226,13 +241,18 @@ namespace Million.IndicatorConditionSetup
/// <param name="factor">표준편차 차이배수</param>
/// <param name="powSum">0~period-1의 각각 제곱의 합</param>
/// <returns></returns>
private static double getTargetValue(int period, double sum, double factor, double powSum)
private double getTargetValue(int period, double sum, double factor, double powSum)
{
int p = period - 1;
var a = p * p / (factor * factor) - p;
var b = 2 * sum - 2 * p * sum / (factor * factor);
var c = sum * sum / (factor * factor) + sum * sum - period * powSum;
if (Indicator_BolingerOverLine == CommonProperty.Indicator_BolingerOverLine.상향선)
return (-b + Math.Sqrt(Math.Abs(b * b - 4 * a * c))) / (2 * a);
else if (Indicator_BolingerOverLine == CommonProperty.Indicator_BolingerOverLine.하향선)
return (-b - Math.Sqrt(Math.Abs(b * b - 4 * a * c))) / (2 * a);
return (-b + Math.Sqrt(Math.Abs(b * b - 4 * a * c))) / (2 * a);
}