This commit is contained in:
2025-03-06 05:34:36 +03:30
parent 5160ea1c82
commit ee3eaa2396
3 changed files with 211 additions and 1 deletions
+127 -1
View File
@@ -386,6 +386,132 @@ struct XOBFVG
return result;
}
//
bool IsValidZone(
XOHCL &invalidBar,
int barIndex = 0 //
)
{
//
bool result = false;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
invalidBar.Clean();
//
result = IsValid();
if (!result)
{
return result;
}
//
XCFVG *fvg;
result = GetMainFVG(fvg);
if (!result)
{
//
ZeroMemory(fvg);
return result;
}
//
XOHCL startedBar;
bool isBodyOut = false;
result = fvg.IsStarted(
fvg.GetDirection(),
startedBar,
isBodyOut //
);
if (!result)
{
//
ZeroMemory(fvg);
startedBar.Clean();
//
return result;
}
//
XOHCL bar;
bool isBullish = fvg.IsBullish();
//
int fromIndex = iBarShift(
fvg.GetSymbol(),
fvg.GetPeriod(),
startedBar.NextAt() //
);
result = IsValidIndex(fromIndex);
if (!result)
{
//
bar.Clean();
ZeroMemory(fvg);
startedBar.Clean();
//
return result;
}
//
bool isInited = false;
for (int i = barIndex; i < fromIndex; i++)
{
//
isInited = bar.Init(
fvg.GetSymbol(),
fvg.GetPeriod(),
i //
);
if (!isInited)
{
//
bar.Clean();
continue;
}
//
bool isBarAbove =
bar.low > fvg.Upper();
bool isBarBelow =
bar.high < fvg.Lower();
//
result =
isBullish
? isBarAbove
: isBarBelow;
if (!result)
{
//
invalidBar = bar;
bar.Clean();
//
break;
}
//
bar.Clean();
}
//
bar.Clean();
ZeroMemory(fvg);
startedBar.Clean();
//
return result;
}
//
bool ToZone(XBoxZone &box)
{
@@ -3926,7 +4052,7 @@ bool ToZoneBox(
: box.upper;
//
box.from = startedBar.time;
box.from = startedBar.NextAt();
//
// Check Box Validation ...