From 3be354f879143e7c9c5ff1a237da4dfec160ff7a Mon Sep 17 00:00:00 2001 From: kyh <1329522@naver.com> Date: Fri, 23 May 2025 13:17:18 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A6=AC=ED=94=8C=EC=9A=A9=EC=9C=BC=EB=A1=9C?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=EA=B0=92=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SMABandConditionSetup.cs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/BitgetApi/IndicatorConditionSetup/SMABandConditionSetup.cs b/BitgetApi/IndicatorConditionSetup/SMABandConditionSetup.cs index f7b4723..d2d95e2 100644 --- a/BitgetApi/IndicatorConditionSetup/SMABandConditionSetup.cs +++ b/BitgetApi/IndicatorConditionSetup/SMABandConditionSetup.cs @@ -11,10 +11,11 @@ namespace BitgetApi.IndicatorConditionSetup { public class SMABandConditionSetup { - private readonly int rangeLookback = 10; - private readonly double rangeThresholdPercent = 1.0; + private readonly int rangeLookback = 12; + private readonly double rangeThresholdPercent = 0.7; private readonly int bandLength = 12; - private readonly int recentTouchLookback = 5; + private readonly int recentTouchLookbackTypeLong = 5; + private readonly int recentTouchLookbackTypeShort = 15; private int? sma4LongTouchBar = null; private int? sma4ShortTouchBar = null; @@ -76,12 +77,12 @@ namespace BitgetApi.IndicatorConditionSetup if (sma4 == sma4Low) sma4LongTouchBar = currentIndex; - bool isLongRecentTouch = sma4LongTouchBar.HasValue && currentIndex - sma4LongTouchBar.Value >= recentTouchLookback; + bool isLongRecentTouch = sma4LongTouchBar.HasValue && currentIndex - sma4LongTouchBar.Value >= recentTouchLookbackTypeLong; - if (sma4 == sma4High) + if (sma4 < sma4Middle) sma4ShortTouchBar = currentIndex; - bool isShortRecentTouch = sma4ShortTouchBar.HasValue && currentIndex - sma4ShortTouchBar.Value >= recentTouchLookback; + bool isShortRecentTouch = sma4ShortTouchBar.HasValue && currentIndex - sma4ShortTouchBar.Value >= recentTouchLookbackTypeShort; // === 시그널 계산 === if (type == SMABandType.LongBuy) @@ -89,18 +90,19 @@ namespace BitgetApi.IndicatorConditionSetup return isLongRecentTouch && isSideways && prevSma4 < sma4 && sma4High == sma4 && prevSma4High > prevSma4 && (prev2Sma4Middle - prevSma4Middle) > (prevSma4Middle - sma4Middle); } - else if(type == SMABandType.ShortBuy) + else if (type == SMABandType.ShortBuy) { - return isShortRecentTouch && prevSma4 < sma4 && sma4High == sma4 && - prevSma4High > prevSma4 && (prev2Sma4Middle - prevSma4Middle) > (prevSma4Middle - sma4Middle); + return isShortRecentTouch && prevSma4High > prevSma4 && prev2Sma4High == prev2Sma4 && + prevSma4 > sma4; } - else if(type == SMABandType.LongSell) + else if (type == SMABandType.LongSell) { return (!isSideways && prevSma4High > prevSma4) || (isSideways && prev2Sma4High > prev2Sma4 && prevSma4High > prevSma4); } - else if(type == SMABandType.ShortSell) + else if (type == SMABandType.ShortSell) { - return (!isSideways && prevSma4Low < prevSma4) || (isSideways && prev2Sma4Low < prev2Sma4 && prevSma4Low < prevSma4); + return (sma4High == sma4 && prevSma4High > prevSma4) || (!isSideways && prevSma4Low == prevSma4 && sma4Low < sma4) || (isSideways && prev2Sma4Low == prev2Sma4 && prevSma4Low < prevSma4 && sma4Low < sma4); + } return false; }