This commit is contained in:
2025-02-18 21:07:05 +03:30
parent 9f66dac977
commit 6ab805765c
2 changed files with 396 additions and 55 deletions
+387 -46
View File
@@ -6075,6 +6075,14 @@ struct XOBFVG
XCFVG *fvg; XCFVG *fvg;
XCOrderBlock *ob; XCOrderBlock *ob;
//
XCSupplyZone *supplyZones[];
XCDemandZone *demandZones[];
//
XCSupportZone *supportZones[];
XCResistanceZone *resistanceZones[];
// //
// Constructor ... // Constructor ...
XOBFVG() XOBFVG()
@@ -6114,12 +6122,64 @@ struct XOBFVG
fvg.IsValid(); fvg.IsValid();
} }
//
bool HasSupplyZones()
{
return HasChild(supplyZones);
}
//
int CountSupplyZones()
{
return ArraySize(supplyZones);
}
//
bool HasDemandZones()
{
return HasChild(demandZones);
}
//
int CountDemandZones()
{
return ArraySize(demandZones);
}
//
bool HasSupportZones()
{
return HasChild(supportZones);
}
//
int CountSupportZones()
{
return ArraySize(supportZones);
}
//
bool HasResistanceZones()
{
return HasChild(resistanceZones);
}
//
int CountResistanceZones()
{
return ArraySize(resistanceZones);
}
// //
void UpdateTo(datetime value = NULL) void UpdateTo(datetime value = NULL)
{ {
// //
value = NormalizeTime(value); value = NormalizeTime(value);
//
int count = 0;
bool has = false;
// //
if (HasOB()) if (HasOB())
{ {
@@ -6131,6 +6191,58 @@ struct XOBFVG
{ {
fvg.To(value); fvg.To(value);
} }
//
// Supply Zones ...
has = HasSupplyZones();
if (has)
{
//
count = CountSupplyZones();
for (int i = 0; count; i++)
{
supplyZones[i].To(value);
}
}
//
// Demand Zones ...
has = HasDemandZones();
if (has)
{
//
count = CountDemandZones();
for (int i = 0; count; i++)
{
demandZones[i].To(value);
}
}
//
// Support Zones ...
has = HasSupportZones();
if (has)
{
//
count = CountSupportZones();
for (int i = 0; count; i++)
{
supportZones[i].To(value);
}
}
//
// Resistance Zones ...
has = HasResistanceZones();
if (has)
{
//
count = CountResistanceZones();
for (int i = 0; count; i++)
{
resistanceZones[i].To(value);
}
}
} }
}; };
@@ -8232,29 +8344,30 @@ int GetLowest(
return result; return result;
} }
template <typename T, typename F> /**
int FilterZones( * Extract XOBFVG Collection of Market ...
T *source, *
F *&dest[], * @param htfState: Higher Time Frame POI State (Used For Detecting Order Blocks) ...
bool filterDirection = true, * @param mtfState: Medium Time Frame POI State (Used For Detecting Fair Value Gaps) ...
bool filterFrom = true, * @param stfState: Short Time Frame POI State (Used For Detecting Other POI(s)) ...
bool filterPrice = true, * @param dest: Result Collection ...
bool forceStarteds = true, * @param forDir: Market Direction for Detecting POI(s) ...
bool forceActivated = false, * @param forPeriod: Time Frame which Used for Zones actions (NULL for Default) ...
bool applySort = false, * @param startState: Zones Start State ...
bool ignoreInside = true // * @param forceStartedBodyOut: Zones Started Bar's Body State ...
) * @param activeState: Zones Activation State ...
{ * @param forceActivatedBodyIn: Zones Activated Bar's Body State ...
// * @param breakState: Zones Breaked State ...
int result = -1; * @param forceBreakedBodyOut: Zone Breaker Bar's Body State ...
* @param workState: Zones Worked State ...
// * @param forceWorkedBodyOut: Zones Worked Bar's Body State ...
result = ArraySize(dest); * @param applySort: Specify Applying Sorting on Collections ...
* @param applyFromFilter: Filter Sorted Zones based on Occured Date ...
// * @param applyPlaceFilter: Filter Sorted Zones based on Occured Place ...
return result; * @param ignoreInside: Ignore Inside Sides of POI(s) Zones in Related to Order Block ...
} *
* @return ( int )
*/
int ExtractOBFVGZones( int ExtractOBFVGZones(
XPOIState &htfState, XPOIState &htfState,
XPOIState &mtfState, XPOIState &mtfState,
@@ -8284,8 +8397,7 @@ int ExtractOBFVGZones(
bool applyFromFilter = true, bool applyFromFilter = true,
bool applyPlaceFilter = true, bool applyPlaceFilter = true,
// //
bool ignoreInside = true, bool ignoreInside = true
bool forceFVGsInsideStart = true
// //
) )
{ {
@@ -8758,7 +8870,7 @@ int ExtractOBFVGZones(
// //
// Detecting FVG ... // Detecting FVG ...
idx = -1; XCFVG *tmpWorkingFVGs[];
for (int j = 0; j < ArraySize(tmpFVGs); j++) for (int j = 0; j < ArraySize(tmpFVGs); j++)
{ {
// //
@@ -8791,11 +8903,19 @@ int ExtractOBFVGZones(
ignoreInside // ignoreInside //
); );
//
bool isInside = IsInsideDiff(
jFVG,
iOBFVG.ob,
false //
);
// //
bool isPlacePassed = bool isPlacePassed =
isBullish isInside ||
? isAbove (isBullish
: isBelow; ? isAbove
: isBelow);
if (!isPlacePassed) if (!isPlacePassed)
{ {
// //
@@ -8804,10 +8924,51 @@ int ExtractOBFVGZones(
} }
// //
idx = j; Add(
iOBFVG.fvg = jFVG; jFVG,
tmpWorkingFVGs //
);
} }
//
int fvgsCount = ArraySize(tmpWorkingFVGs);
has = IsValidSize(fvgsCount);
if (has)
{
//
idx =
isBullish
? GetLowest(tmpWorkingFVGs)
: GetHighest(tmpWorkingFVGs);
//
if (IsValidIndex(idx))
{
//
XCFVG *selectedFVG = tmpWorkingFVGs[idx];
//
iOBFVG.fvg = selectedFVG;
//
bool isExists = FindIndex(
idx,
selectedFVG,
tmpFVGs //
);
if (isExists)
{
//
ArrayRemove(
tmpFVGs,
idx,
1 //
);
}
}
}
Clean(tmpWorkingFVGs);
// //
bool isFVGPassed = iOBFVG.HasFVG(); bool isFVGPassed = iOBFVG.HasFVG();
if (!isFVGPassed) if (!isFVGPassed)
@@ -8817,21 +8978,6 @@ int ExtractOBFVGZones(
continue; continue;
} }
//
// Remove Selected FVG from List ...
if (IsValidIndex(idx))
{
//
ArrayRemove(
tmpFVGs,
idx,
1 //
);
}
//
// TODO: Detect Other POI(s) ...
// //
// Validate Model ... // Validate Model ...
bool isValid = iOBFVG.IsValid(); bool isValid = iOBFVG.IsValid();
@@ -8859,6 +9005,201 @@ int ExtractOBFVGZones(
Clean(tmpOBFVGs); Clean(tmpOBFVGs);
} }
//
// Detecting Other POI(s) ...
has = HasChild(dest);
if (has)
{
//
count = ArraySize(dest);
for (int i = 0; i < count; i++)
{
//
// Supply Zones ...
has = stfState.HasSupplyZones();
if (has)
{
//
for (int j = 0; j < stfState.CountSupplyZones(); j++)
{
//
bool isInsideOB = IsInsideDiff(
stfState.supplyZones[j],
dest[i].ob,
false //
) ||
IsInsideDiff(
stfState.supplyZones[j],
dest[i].ob,
true //
);
//
bool isInsideFVG = IsInsideDiff(
stfState.supplyZones[j],
dest[i].fvg,
false //
) ||
IsInsideDiff(
stfState.supplyZones[j],
dest[i].fvg,
true //
);
//
bool isInside = isInsideOB ||
isInsideFVG;
if (isInside)
{
//
Add(
stfState.supplyZones[j],
dest[i].supplyZones //
);
}
}
}
//
// Demand Zones ...
has = stfState.HasDemandZones();
if (has)
{
//
for (int j = 0; j < stfState.CountDemandZones(); j++)
{
//
bool isInsideOB = IsInsideDiff(
stfState.demandZones[j],
dest[i].ob,
false //
) ||
IsInsideDiff(
stfState.demandZones[j],
dest[i].ob,
true //
);
//
bool isInsideFVG = IsInsideDiff(
stfState.demandZones[j],
dest[i].fvg,
false //
) ||
IsInsideDiff(
stfState.demandZones[j],
dest[i].fvg,
true //
);
//
bool isInside = isInsideOB ||
isInsideFVG;
if (isInside)
{
//
Add(
stfState.demandZones[j],
dest[i].demandZones //
);
}
}
}
//
// Support Zones ...
has = stfState.HasSupportZones();
if (has)
{
//
for (int j = 0; j < stfState.CountSupportZones(); j++)
{
//
bool isInsideOB = IsInsideDiff(
stfState.supportZones[j],
dest[i].ob,
false //
) ||
IsInsideDiff(
stfState.supportZones[j],
dest[i].ob,
true //
);
//
bool isInsideFVG = IsInsideDiff(
stfState.supportZones[j],
dest[i].fvg,
false //
) ||
IsInsideDiff(
stfState.supportZones[j],
dest[i].fvg,
true //
);
//
bool isInside = isInsideOB ||
isInsideFVG;
if (isInside)
{
//
Add(
stfState.supportZones[j],
dest[i].supportZones //
);
}
}
}
//
// Resistance Zones ...
has = stfState.HasResistanceZones();
if (has)
{
//
for (int j = 0; j < stfState.CountResistanceZones(); j++)
{
//
bool isInsideOB = IsInsideDiff(
stfState.resistanceZones[j],
dest[i].ob,
false //
) ||
IsInsideDiff(
stfState.resistanceZones[j],
dest[i].ob,
true //
);
//
bool isInsideFVG = IsInsideDiff(
stfState.resistanceZones[j],
dest[i].fvg,
false //
) ||
IsInsideDiff(
stfState.resistanceZones[j],
dest[i].fvg,
true //
);
//
bool isInside = isInsideOB ||
isInsideFVG;
if (isInside)
{
//
Add(
stfState.resistanceZones[j],
dest[i].resistanceZones //
);
}
}
}
}
}
// //
Clean(tmpOBs); Clean(tmpOBs);
Clean(tmpFVGs); Clean(tmpFVGs);
@@ -241,15 +241,15 @@ class XCX121SMCXWZSignalDetector : public XCBase
visionCycleHelper.mPOIDrawer // visionCycleHelper.mPOIDrawer //
); );
// // //
// int bearishFlowCount = mConditions.DetectOrderFlow( int bearishFlowCount = mConditions.DetectOrderFlow(
// X_DIRECTION_BEARISH, X_DIRECTION_BEARISH,
// consolidationState, consolidationState,
// analyseState, analyseState,
// zIndex, zIndex,
// period, period,
// visionCycleHelper.mPOIDrawer // visionCycleHelper.mPOIDrawer //
// ); );
// //
return false; return false;