This commit is contained in:
2025-10-07 18:09:38 +03:30
parent ebfde3cb48
commit 69e155e050
8 changed files with 802 additions and 184 deletions
+73 -8
View File
@@ -4433,32 +4433,64 @@ bool ToFVGBox(
bool ToSupportBox(
XOHCL &bar,
XBoxZone &box,
datetime toTime = NULL //
datetime toTime = NULL,
int validationLength = 0 //
)
{
//
bool result = false;
//
// Prepare ...
box.Clean();
toTime = NormalizeTime(toTime);
//
// Normalize ...
toTime = NormalizeTime(toTime);
validationLength = NormalizeInt(validationLength, 0);
//
// Validate ...
result = bar.IsValid();
if (!result)
{
return result;
}
//
XOHCL breaker;
result = GetBreakerBar(
bar,
breaker,
X_PRICE_LOW,
X_PRICE_DOWN,
X_DIRECTION_BEARISH,
500 //
);
if (!result)
{
breaker.Clean();
}
//
box.to = toTime;
box.from = bar.time;
box.at = bar.time;
box.from =
breaker.IsValid()
? breaker.time
: validationLength <= 0
? bar.time
: GetBarTime(
bar.symbol,
bar.period,
bar.Index() + validationLength //
);
box.lower = bar.low;
box.symbol = bar.symbol;
box.period = bar.period;
box.upper = bar.GetDown();
box.dir = X_DIRECTION_BULLISH;
box.type = "Support";
box.type = ToXString(X_BAR_PATTERN_SUPPORT);
//
result = box.IsValid();
@@ -4483,32 +4515,65 @@ bool ToSupportBox(
bool ToResistanceBox(
XOHCL &bar,
XBoxZone &box,
datetime toTime = NULL //
datetime toTime = NULL,
int validationLength = 0 //
)
{
//
bool result = false;
//
// Prepare ...
box.Clean();
toTime = NormalizeTime(toTime);
//
// Normalize ...
toTime = NormalizeTime(toTime);
validationLength = NormalizeInt(validationLength, 0);
//
// Validate ...
result = bar.IsValid();
if (!result)
{
return result;
}
//
XOHCL breaker;
result = GetBreakerBar(
bar,
breaker,
X_PRICE_HIGH,
X_PRICE_UP,
X_DIRECTION_BULLISH,
500 //
);
if (!result)
{
breaker.Clean();
}
//
box.to = toTime;
box.from = bar.time;
box.at = bar.time;
box.from =
breaker.IsValid()
? breaker.time
: validationLength <= 0
? bar.time
: GetBarTime(
bar.symbol,
bar.period,
bar.Index() + validationLength //
);
box.upper = bar.high;
box.symbol = bar.symbol;
box.period = bar.period;
box.lower = bar.GetUp();
box.dir = X_DIRECTION_BEARISH;
box.type = "Resistance";
box.type = ToXString(X_BAR_PATTERN_RESISTANCE);
;
//
result = box.IsValid();