last ...
This commit is contained in:
@@ -238,6 +238,11 @@ class XCBasePOI : public XCBase
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
typedef void (*TOnPOIEvent)(ENUM_XPOI_EVENTS event,
|
||||
XCBasePOI *param //
|
||||
);
|
||||
|
||||
//
|
||||
// Zone POI Class ...
|
||||
class XCZone : public XCBasePOI
|
||||
@@ -8560,6 +8565,10 @@ int GetLowest(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
/**
|
||||
* Extract XOBFVG Collection of Market ...
|
||||
*
|
||||
@@ -9485,286 +9494,113 @@ int ExtractOBFVGZones(
|
||||
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 )
|
||||
*/
|
||||
template <typename T>
|
||||
int ExtractUnActivatedZones(
|
||||
T *&source[],
|
||||
T *&dest[] //
|
||||
int GetHighest(
|
||||
XOBFVG &source[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
Clean(dest);
|
||||
int result = -1;
|
||||
|
||||
//
|
||||
int count = ArraySize(source);
|
||||
int hasChild = IsValidSize(count);
|
||||
if (!hasChild)
|
||||
bool has = IsValidSize(count);
|
||||
if (!has)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOBFVG item;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
T *iChild = source[i];
|
||||
ENUM_X_DIRECTION iChildForDir = iChild.GetDirection();
|
||||
XOBFVG iOBFVG = source[i];
|
||||
|
||||
//
|
||||
// Validate Started Zones ...
|
||||
XOHCL iChildStartedBar;
|
||||
ENUM_X_DIRECTION iChildStartedDir;
|
||||
bool isStarted = iChild.IsStarted(
|
||||
iChildForDir,
|
||||
iChildStartedBar,
|
||||
iChildStartedDir //
|
||||
);
|
||||
if (!isStarted)
|
||||
bool canSet =
|
||||
!item.IsValid()
|
||||
? true
|
||||
: item.ob.Upper() < iOBFVG.ob.Upper();
|
||||
if (canSet)
|
||||
{
|
||||
continue;
|
||||
//
|
||||
item = iOBFVG;
|
||||
result = i;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate InActive Zone ...
|
||||
XOHCL iChildActivatedBar;
|
||||
ENUM_X_DIRECTION iChildActivatedDir;
|
||||
bool isActivated = iChild.IsActivated(
|
||||
iChildForDir,
|
||||
iChildActivatedBar,
|
||||
iChildActivatedDir //
|
||||
);
|
||||
if (isActivated)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Zone Iverse Breake ...
|
||||
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 //
|
||||
);
|
||||
iOBFVG.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(dest);
|
||||
item.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract ctivated Order Blocks / Fair Value Gaps ...
|
||||
* Find Lowest Order Block of XOBFVG Collection ...
|
||||
*
|
||||
* @param source: XOBFVG Collection ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
template <typename T>
|
||||
int ExtractActivatedZones(
|
||||
T *&source[],
|
||||
T *&dest[],
|
||||
bool ignoreBreaktion = false //
|
||||
int GetLowest(
|
||||
XOBFVG &source[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
Clean(dest);
|
||||
int result = -1;
|
||||
|
||||
//
|
||||
int count = ArraySize(source);
|
||||
int hasChild = IsValidSize(count);
|
||||
if (!hasChild)
|
||||
bool has = IsValidSize(count);
|
||||
if (!has)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOBFVG item;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
T *iChild = source[i];
|
||||
ENUM_X_DIRECTION iChildForDir = iChild.GetDirection();
|
||||
XOBFVG iOBFVG = source[i];
|
||||
|
||||
//
|
||||
// Validate Started Zones ...
|
||||
XOHCL iChildStartedBar;
|
||||
ENUM_X_DIRECTION iChildStartedDir;
|
||||
bool isStarted = iChild.IsStarted(
|
||||
iChildForDir,
|
||||
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)
|
||||
bool canSet =
|
||||
!item.IsValid()
|
||||
? true
|
||||
: item.ob.Lower() > iOBFVG.ob.Lower();
|
||||
if (canSet)
|
||||
{
|
||||
//
|
||||
XOHCL iChildBreakedBar;
|
||||
ENUM_X_DIRECTION iChildBreakedDir;
|
||||
bool isBreaked = iChild.IsBreaked(
|
||||
Opposit(iChildForDir),
|
||||
iChildBreakedBar,
|
||||
iChildBreakedDir,
|
||||
true // Ignore Activation ...
|
||||
);
|
||||
if (isBreaked)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
isBreaked = iChild.IsBreaked(
|
||||
iChildForDir,
|
||||
iChildBreakedBar,
|
||||
iChildBreakedDir,
|
||||
true // Ignore Activation ...
|
||||
);
|
||||
if (isBreaked)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
item = iOBFVG;
|
||||
result = i;
|
||||
}
|
||||
|
||||
//
|
||||
int iChildIDX = -1;
|
||||
bool isIChildExists = FindIndex(
|
||||
iChildIDX,
|
||||
iChild,
|
||||
dest //
|
||||
);
|
||||
if (isIChildExists)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
iChild,
|
||||
dest //
|
||||
);
|
||||
iOBFVG.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(dest);
|
||||
item.Clean();
|
||||
|
||||
//
|
||||
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 ...
|
||||
|
||||
@@ -263,7 +263,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
|
||||
//
|
||||
// Has Order Flow ...
|
||||
|
||||
mConditions.UpdateTo(cTime);
|
||||
|
||||
//
|
||||
// TODO: Remove this ...
|
||||
DrawConditions(
|
||||
@@ -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;
|
||||
|
||||
@@ -436,9 +436,9 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
bool hasBearOBFVGs = IsValidSize(bearOBFVGsCount);
|
||||
|
||||
//
|
||||
bool hasOrderBlow = hasBearOBFVGs ||
|
||||
bool hasOrderFlow = hasBearOBFVGs ||
|
||||
hasBullOBFVGs;
|
||||
if (hasOrderBlow)
|
||||
if (hasOrderFlow)
|
||||
{
|
||||
//
|
||||
// Vlidate ...
|
||||
@@ -446,13 +446,13 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
//
|
||||
(hasBullOBFVGs &&
|
||||
!hasBearOBFVGs &&
|
||||
bullOBFVGsCount > 1)
|
||||
bullOBFVGsCount >= 1)
|
||||
//
|
||||
||
|
||||
//
|
||||
(hasBearOBFVGs &&
|
||||
!hasBullOBFVGs &&
|
||||
bearOBFVGsCount > 1)
|
||||
bearOBFVGsCount >= 1)
|
||||
//
|
||||
;
|
||||
|
||||
@@ -496,6 +496,88 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user