This commit is contained in:
kyh
2025-05-20 12:34:26 +09:00
parent c17b0baf5b
commit 1bfc763bde
2 changed files with 34 additions and 14 deletions

View File

@@ -712,11 +712,11 @@ namespace BitgetAPI.IndicatorConditionSetup
if (tradingViewConditionSetup.IsLongSignal())
{
BuyLongStep[market] = 1;
BuyLongStepStampData[market] = 저고점_30["tempLowVal"];
//BuyLongStepStampData[market] = 저고점_30["tempLowVal"];
}
}
if(BuyLongStep[market] == 1 && BuyLongStepStampData[market] < 저고점_30["tempLowVal"])
if(BuyLongStep[market] == 1 )//&& BuyLongStepStampData[market] < 저고점_30["tempLowVal"])
{
buyFlag = ((저고점_30["Type"] == 0 &&
저고점_30["전전전저가"] > 저고점_30["전전저가"] && 저고점_30["전전저가"] < 저고점_30["전저가"] && candleData_30_전봉.Close < 저고점_30["전고가"] && candleData_30.Close > 저고점_30["전고가"])
@@ -729,7 +729,8 @@ namespace BitgetAPI.IndicatorConditionSetup
//초기화 처리 필요
if (저고점_30["전고가"] < 저고점_30["전전고가"] ||
저고점_30["전저가"] < 저고점_30["전전저가"])
저고점_30["전저가"] < 저고점_30["전전저가"] ||
tradingViewConditionSetup.IsShortSignal())
{
BuyLongStep[market] = 0;
buyFlag = false;
@@ -824,9 +825,9 @@ namespace BitgetAPI.IndicatorConditionSetup
var sellFlag = false;
if(tradingViewConditionSetup.IsSmaMiddle(4, 12, true) ||
저고점_30["전고가"] < 저고점_30["전전고가"] ||
저고점_30["전저가"] > candleData_30_전봉.Close)
if( 저고점_30["전고가"] < 저고점_30["전전고가"] ||
저고점_30["전저가"] > candleData_30_전봉.Close ||
tradingViewConditionSetup.IsShortSignal())
{
sellFlag = true;
}
@@ -932,11 +933,11 @@ namespace BitgetAPI.IndicatorConditionSetup
if (tradingViewConditionSetup.IsShortSignal())
{
BuyShortStep[market] = 1;
BuyShortStepStampData[market] = 저고점_30["tempHighVal"];
//BuyShortStepStampData[market] = 저고점_30["tempHighVal"];
}
}
if (BuyShortStep[market] == 1 && BuyShortStepStampData[market] < 저고점_30["tempHighVal"])
if (BuyShortStep[market] == 1)// && BuyShortStepStampData[market] < 저고점_30["tempHighVal"])
{
buyFlag = ((저고점_30["Type"] == 1 &&
저고점_30["전전전고가"] < 저고점_30["전전고가"] && 저고점_30["전전고가"] > 저고점_30["전고가"] && candleData_30.Close < 저고점_30["전저가"] && candleData_30_전봉.Close > 저고점_30["전저가"])
@@ -948,7 +949,8 @@ namespace BitgetAPI.IndicatorConditionSetup
//초기화 처리 필요
if (저고점_30["전고가"] > 저고점_30["전전고가"] ||
저고점_30["전저가"] > 저고점_30["전전저가"])
저고점_30["전저가"] > 저고점_30["전전저가"] ||
tradingViewConditionSetup.IsLongSignal())
{
BuyShortStep[market] = 0;
buyFlag = false;
@@ -1041,9 +1043,10 @@ namespace BitgetAPI.IndicatorConditionSetup
}
var sellFlag = false;
if (tradingViewConditionSetup.IsSmaMiddle(4, 12, false) ||
저고점_30["전저가"] > 저고점_30["전전저가"] ||
저고점_30["전고가"] < candleData_30_전봉.Close)
if (저고점_30["전저가"] > 저고점_30["전전저가"] ||
저고점_30["전고가"] < candleData_30_전봉.Close ||
tradingViewConditionSetup.IsLongSignal())
{
sellFlag = true;
}

View File

@@ -135,6 +135,19 @@ namespace BitgetApi.IndicatorConditionSetup
return (macdLine, signalLine);
}
// 7. MACD, SignalLine 계산(이전꺼)
public (double macdLine, double signalLine) PrevComputeMacd()
{
var temp = new List<double>();
foreach (var item in Close)
temp.Add(item);
temp.RemoveAt(temp.Count - 1);
double macdLine = Ema(temp, 34) - Ema(temp, 12);
double signalLine = Ema(Enumerable.Repeat(macdLine, temp.Count).ToList(), 12);
return (macdLine, signalLine);
}
// 8. RangeBound 필터
public bool IsRangeBound()
{
@@ -164,10 +177,12 @@ namespace BitgetApi.IndicatorConditionSetup
double md = ComputeMd();
double prevMd = ComputeMd(false);
var (macd, signal) = ComputeMacd();
var (prevMacd, prevSignal) = PrevComputeMacd();
bool isUptrend = Close.Last() > Sma4.Last();
return isUptrend &&
((prevMd == 0 && md > 0) || (macd < 0 && macd > signal)) &&
((prevMd == 0 && md > 0) || (macd > prevMacd && signal > prevSignal && md > 0 && macd > signal)) &&
IsTrending() && !IsRangeBound();
}
@@ -177,10 +192,12 @@ namespace BitgetApi.IndicatorConditionSetup
double md = ComputeMd();
double prevMd = ComputeMd(false);
var (macd, signal) = ComputeMacd();
var (prevMacd, prevSignal) = PrevComputeMacd();
bool isDowntrend = Close.Last() < Sma4.Last();
return isDowntrend &&
((prevMd == 0 && md < 0) || (macd > 0 && macd < signal)) &&
((prevMd == 0 && md < 0) || (macd < prevMacd && signal < prevSignal && md < 0 && macd < signal)) &&
IsTrending() && !IsRangeBoundSell();
}