This commit is contained in:
2025-02-19 05:46:06 +03:30
parent bf8b74d4e7
commit 39b9dc0388
3 changed files with 164 additions and 220 deletions
+51 -215
View File
@@ -238,6 +238,11 @@ class XCBasePOI : public XCBase
// //
}; };
//
typedef void (*TOnPOIEvent)(ENUM_XPOI_EVENTS event,
XCBasePOI *param //
);
// //
// Zone POI Class ... // Zone POI Class ...
class XCZone : public XCBasePOI class XCZone : public XCBasePOI
@@ -8560,6 +8565,10 @@ int GetLowest(
return result; return result;
} }
//
//
//
/** /**
* Extract XOBFVG Collection of Market ... * Extract XOBFVG Collection of Market ...
* *
@@ -9485,286 +9494,113 @@ int ExtractOBFVGZones(
return result; return result;
} }
//
typedef void (*TOnPOIEvent)(ENUM_XPOI_EVENTS event,
XCBasePOI *param //
);
//
//
//
/** /**
* Extract UnActivated Order Blocks / Fair Value Gaps ... * Find Highest Order Block of XOBFVG Collection ...
*
* @param source: XOBFVG Collection ...
* *
* @return ( int ) * @return ( int )
*/ */
template <typename T> int GetHighest(
int ExtractUnActivatedZones( XOBFVG &source[] //
T *&source[],
T *&dest[] //
) )
{ {
// //
int result = 0; int result = -1;
//
Clean(dest);
// //
int count = ArraySize(source); int count = ArraySize(source);
int hasChild = IsValidSize(count); bool has = IsValidSize(count);
if (!hasChild) if (!has)
{ {
return result; return result;
} }
// //
XOBFVG item;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
// //
T *iChild = source[i]; XOBFVG iOBFVG = source[i];
ENUM_X_DIRECTION iChildForDir = iChild.GetDirection();
// //
// Validate Started Zones ... bool canSet =
XOHCL iChildStartedBar; !item.IsValid()
ENUM_X_DIRECTION iChildStartedDir; ? true
bool isStarted = iChild.IsStarted( : item.ob.Upper() < iOBFVG.ob.Upper();
iChildForDir, if (canSet)
iChildStartedBar,
iChildStartedDir //
);
if (!isStarted)
{ {
continue; //
item = iOBFVG;
result = i;
} }
// //
// Validate InActive Zone ... iOBFVG.Clean();
XOHCL iChildActivatedBar;
ENUM_X_DIRECTION iChildActivatedDir;
bool isActivated = iChild.IsActivated(
iChildForDir,
iChildActivatedBar,
iChildActivatedDir //
);
if (isActivated)
{
continue;
} }
// //
// Validate Zone Iverse Breake ... item.Clean();
XOHCL iChildBreakedBar;
ENUM_X_DIRECTION iChildBreakedDir;
bool isBreaked = iChild.IsBreaked(
Opposit(iChildForDir),
iChildBreakedBar,
iChildBreakedDir,
true // Ignore Activation ...
);
if (isBreaked)
{
continue;
}
//
int iChildIDX = -1;
bool isIChildExists = FindIndex(
iChildIDX,
iChild,
dest //
);
if (isIChildExists)
{
continue;
}
//
Add(
iChild,
dest //
);
}
//
result = ArraySize(dest);
// //
return result; return result;
} }
/** /**
* Extract ctivated Order Blocks / Fair Value Gaps ... * Find Lowest Order Block of XOBFVG Collection ...
*
* @param source: XOBFVG Collection ...
* *
* @return ( int ) * @return ( int )
*/ */
template <typename T> int GetLowest(
int ExtractActivatedZones( XOBFVG &source[] //
T *&source[],
T *&dest[],
bool ignoreBreaktion = false //
) )
{ {
// //
int result = 0; int result = -1;
//
Clean(dest);
// //
int count = ArraySize(source); int count = ArraySize(source);
int hasChild = IsValidSize(count); bool has = IsValidSize(count);
if (!hasChild) if (!has)
{ {
return result; return result;
} }
// //
XOBFVG item;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
// //
T *iChild = source[i]; XOBFVG iOBFVG = source[i];
ENUM_X_DIRECTION iChildForDir = iChild.GetDirection();
// //
// Validate Started Zones ... bool canSet =
XOHCL iChildStartedBar; !item.IsValid()
ENUM_X_DIRECTION iChildStartedDir; ? true
bool isStarted = iChild.IsStarted( : item.ob.Lower() > iOBFVG.ob.Lower();
iChildForDir, if (canSet)
iChildStartedBar,
iChildStartedDir //
);
if (!isStarted)
{
continue;
}
//
// Validate InActive Zone ...
XOHCL iChildActivatedBar;
ENUM_X_DIRECTION iChildActivatedDir;
bool isActivated = iChild.IsActivated(
iChildForDir,
iChildActivatedBar,
iChildActivatedDir //
);
if (!isActivated)
{
continue;
}
//
// Validate Zone Iverse Breake ...
if (!ignoreBreaktion)
{ {
// //
XOHCL iChildBreakedBar; item = iOBFVG;
ENUM_X_DIRECTION iChildBreakedDir; result = i;
bool isBreaked = iChild.IsBreaked(
Opposit(iChildForDir),
iChildBreakedBar,
iChildBreakedDir,
true // Ignore Activation ...
);
if (isBreaked)
{
continue;
} }
// //
isBreaked = iChild.IsBreaked( iOBFVG.Clean();
iChildForDir,
iChildBreakedBar,
iChildBreakedDir,
true // Ignore Activation ...
);
if (isBreaked)
{
continue;
}
} }
// //
int iChildIDX = -1; item.Clean();
bool isIChildExists = FindIndex(
iChildIDX,
iChild,
dest //
);
if (isIChildExists)
{
continue;
}
//
Add(
iChild,
dest //
);
}
//
result = ArraySize(dest);
// //
return result; return result;
} }
/** //
* Extract Directinal Based Order Blocks / Fair Value Gaps ... //
* //
* @param forDir: ENUM_X_DIRECTION member ...
*
* @return ( int )
*/
template <typename T>
int ExtractDirectionalZones(
ENUM_X_DIRECTION forDir,
T *&source[],
T *&dest[] //
)
{
//
int result = 0;
//
Clean(dest);
//
int count = ArraySize(source);
if (!IsValidSize(count) ||
!HasDirection(forDir))
{
return result;
}
//
for (int i = 0; i < count; i++)
{
//
T *iChild = source[i];
//
ENUM_X_DIRECTION iForDir = iChild.GetDirection();
if (forDir == iForDir)
{
//
Add(
iChild,
dest //
);
}
}
//
result = ArraySize(dest);
//
return result;
}
/** /**
* Check Trading Conditions based on Specified Box ... * Check Trading Conditions based on Specified Box ...
@@ -263,6 +263,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
// //
// Has Order Flow ... // Has Order Flow ...
mConditions.UpdateTo(cTime);
// //
// TODO: Remove this ... // TODO: Remove this ...
@@ -272,7 +273,32 @@ class XCX121SMCXWZSignalDetector : public XCBase
); );
// //
// Checking Order Flow Break ...
bool isOrderFlowBreaked = mConditions
.IsOrderFlowBreaked(
zIndex,
period //
);
//
// Order Flow Breaked Senario ...
if (isOrderFlowBreaked)
{
//
// TODO: Implement Order Flow Breaker Bar Senario ...
//
mConditions.Clean();
}
result = !isOrderFlowBreaked;
if (!result)
{
//
// TODO: Implement Clean ...
//
return result;
}
// //
return false; return false;
+86 -4
View File
@@ -436,9 +436,9 @@ struct X121SMCStrategyXWZSignalConditions
bool hasBearOBFVGs = IsValidSize(bearOBFVGsCount); bool hasBearOBFVGs = IsValidSize(bearOBFVGsCount);
// //
bool hasOrderBlow = hasBearOBFVGs || bool hasOrderFlow = hasBearOBFVGs ||
hasBullOBFVGs; hasBullOBFVGs;
if (hasOrderBlow) if (hasOrderFlow)
{ {
// //
// Vlidate ... // Vlidate ...
@@ -446,13 +446,13 @@ struct X121SMCStrategyXWZSignalConditions
// //
(hasBullOBFVGs && (hasBullOBFVGs &&
!hasBearOBFVGs && !hasBearOBFVGs &&
bullOBFVGsCount > 1) bullOBFVGsCount >= 1)
// //
|| ||
// //
(hasBearOBFVGs && (hasBearOBFVGs &&
!hasBullOBFVGs && !hasBullOBFVGs &&
bearOBFVGsCount > 1) bearOBFVGsCount >= 1)
// //
; ;
@@ -496,6 +496,88 @@ struct X121SMCStrategyXWZSignalConditions
return result; return result;
} }
//
bool IsOrderFlowBreaked(
int barIndex = 0,
ENUM_TIMEFRAMES forPeriod = NULL //
)
{
//
bool result = false;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
if (!IsValid(forPeriod))
{
forPeriod = period;
}
//
ENUM_X_DIRECTION orderFlowDir;
result = HasOrderFlow(orderFlowDir);
if (!result)
{
return result;
}
//
XOHCL bar;
result = bar.Init(
symbol,
forPeriod,
barIndex //
);
if (!result)
{
//
bar.Clean();
return result;
}
//
bool isBullish = IsBullish(orderFlowDir);
//
int idx =
isBullish
? GetHighest(orderFlow)
: GetLowest(orderFlow);
result = IsValidIndex(idx);
if (!result)
{
//
bar.Clean();
return result;
}
//
XOHCL breakerBar;
bool isBodyOut = false;
result = orderFlow[idx].ob.IsBreaked(
orderFlowDir,
breakerBar,
isBodyOut,
false, // Ignore Start ...
true, // Started Bar Body Out ...
forPeriod //
);
//
result = breakerBar.Index() == bar.Index() + 1;
//
bar.Clean();
breakerBar.Clean();
//
return result;
}
// //
}; };