This commit is contained in:
2025-03-05 04:47:19 +03:30
parent 17c6704104
commit 8f9ad96b90
3 changed files with 507 additions and 36 deletions
+206 -4
View File
@@ -122,8 +122,52 @@ struct XOBFVG
//
bool IsValid()
{
return HasOB() &&
HasFVGs();
//
bool result = false;
//
result = HasOB() &&
HasFVGs();
if (!result)
{
return result;
}
//
XOHCL passedBar;
bool isBodyOut;
bool isOBStarted = ob.IsStarted(
ob.GetDirection(),
passedBar,
isBodyOut //
);
//
int idx = GetOldest(fvgs);
result = IsValidIndex(idx);
if (!result)
{
//
passedBar.Clean();
return result;
}
//
bool isFVGStarted = fvgs[idx].IsStarted(
ob.GetDirection(),
passedBar,
isBodyOut //
);
//
result = isOBStarted &&
isFVGStarted;
//
passedBar.Clean();
//
return result;
}
//
@@ -305,6 +349,59 @@ struct XOBFVG
return result;
}
//
bool GetMainFVG(
XCFVG *&fvg //
)
{
//
bool result = false;
//
fvg = NULL;
//
result = IsValid();
if (!result)
{
return result;
}
//
int idx = GetOldest(fvgs);
result = IsValidIndex(idx);
if (!result)
{
//
ZeroMemory(fvg);
return result;
}
//
fvg = fvgs[idx];
result = fvg != NULL &&
fvg.IsValid();
//
return result;
}
//
bool ToZone(XBoxZone &box)
{
//
bool result = false;
//
result = ToZoneBox(
box,
this //
);
//
return result;
}
//
void AddFVG(XCFVG *fvg)
{
@@ -313,8 +410,11 @@ struct XOBFVG
bool has = false;
//
has = fvg != NULL &&
fvg.IsValid();
has =
HasOB() &&
fvg != NULL &&
fvg.IsValid() &&
ob.GetDirection() == fvg.GetDirection();
if (!has)
{
return;
@@ -3714,6 +3814,108 @@ void SpecifiedUpdateTo(
}
}
/**
* Extract Box Zone's of Specified OBFVG ...
*
* @param box: XBoxZone instance, represent result ...
* @param obfvg: XOBFVG instance, specified Model ...
*
* @return ( bool )
*/
bool ToZoneBox(
XBoxZone &box,
XOBFVG &obfvg //
)
{
//
bool result = false;
//
box.Clean();
//
// Check Model Validation ...
result = obfvg.IsValid();
if (!result)
{
return result;
}
//
// Retrieve Model Main Fair Value Gap ...
XCFVG *fvg;
result = obfvg.GetMainFVG(fvg);
if (!result)
{
//
box.Clean();
ZeroMemory(fvg);
//
return result;
}
//
// Retrieve Main Fair Value Gap's Started Bar ...
XOHCL startedBar;
bool isBodyOut = false;
bool isStarted = fvg.IsStarted(
fvg.GetDirection(),
startedBar,
isBodyOut //
);
result = isStarted;
if (!result)
{
//
box.Clean();
ZeroMemory(fvg);
startedBar.Clean();
//
return result;
}
//
// Converts Main Fair Value Gaps to Box ...
result = ToBox(
box,
fvg //
);
if (!result)
{
//
box.Clean();
ZeroMemory(fvg);
startedBar.Clean();
//
return result;
}
//
// Update Box using Started Bar ...
box.lower = startedBar.low;
box.upper = startedBar.high;
box.from = startedBar.NextAt();
//
// Check Box Validation ...
result = box.IsValid();
if (!result)
{
box.Clean();
}
//
// Cleanup Resources ...
ZeroMemory(fvg);
startedBar.Clean();
//
return result;
}
/**
* Converts to XBoxZone ...
*