This commit is contained in:
2025-03-07 03:56:11 +03:30
parent 6157bbe125
commit 5534bde7e5
6 changed files with 3636 additions and 3126 deletions
+99 -72
View File
@@ -388,7 +388,6 @@ struct XOBFVG
//
bool IsValidZone(
XOHCL &invalidBar,
int barIndex = 0 //
)
{
@@ -401,9 +400,6 @@ struct XOBFVG
barIndex = 0;
}
//
invalidBar.Clean();
//
result = IsValid();
if (!result)
@@ -412,101 +408,132 @@ struct XOBFVG
}
//
XCFVG *fvg;
result = GetMainFVG(fvg);
if (!result)
{
//
ZeroMemory(fvg);
return result;
}
//
XOHCL startedBar;
bool isBodyOut = false;
result = fvg.IsStarted(
fvg.GetDirection(),
startedBar,
isBodyOut //
XCFVG *tmpFVGs[];
Copy(
fvgs,
tmpFVGs //
);
if (!result)
int count = CountFVGs();
for (int i = 0; i < count; i++)
{
//
ZeroMemory(fvg);
startedBar.Clean();
XCFVG *iFVG = tmpFVGs[i];
//
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 //
XOHCL startedBar;
bool isBodyOut = false;
result = iFVG.IsStarted(
iFVG.GetDirection(),
startedBar,
isBodyOut //
);
if (!isInited)
if (!result)
{
//
bar.Clean();
ZeroMemory(iFVG);
startedBar.Clean();
ArrayRemove(
fvgs,
i,
1 //
);
//
continue;
}
//
bool isBarAbove =
bar.low > fvg.Upper();
bool isBarBelow =
bar.high < fvg.Lower();
XOHCL bar;
bool isBullish = iFVG.IsBullish();
datetime fromTime = startedBar.NextAt();
//
result =
isBullish
? isBarAbove
: isBarBelow;
int fromIndex = iBarShift(
iFVG.GetSymbol(),
iFVG.GetPeriod(),
fromTime //
);
result = IsValidIndex(fromIndex);
if (!result)
{
//
invalidBar = bar;
bar.Clean();
ZeroMemory(iFVG);
startedBar.Clean();
ArrayRemove(
fvgs,
i,
1 //
);
//
break;
continue;
}
//
bool isInited = false;
bool isValidFVG = false;
for (int j = barIndex; j < fromIndex; j++)
{
//
isInited = bar.Init(
iFVG.GetSymbol(),
iFVG.GetPeriod(),
j //
);
if (!isInited)
{
//
bar.Clean();
continue;
}
//
bool isBarAbove =
bar.low > iFVG.Upper();
bool isBarBelow =
bar.high < iFVG.Lower();
//
isValidFVG =
isBullish
? isBarAbove
: isBarBelow;
if (!isValidFVG)
{
//
bar.Clean();
//
break;
}
//
bar.Clean();
}
//
if (!isValidFVG)
{
//
ArrayRemove(
fvgs,
i,
1 //
);
}
//
bar.Clean();
ZeroMemory(iFVG);
startedBar.Clean();
}
//
bar.Clean();
ZeroMemory(fvg);
startedBar.Clean();
Clean(tmpFVGs);
//
result = HasFVGs();
//
return result;