This commit is contained in:
2024-11-20 13:12:19 +03:30
parent 6aeea1c5c7
commit 70a373802d
@@ -120,6 +120,9 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
double pip = GetPipPrice(_symbol);
double pip2 = 2 * pip;
//
datetime cTime = TimeCurrent();
//
int zIndex = 0;
int cIndex = zIndex + 1;
@@ -184,9 +187,6 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
return result;
}
//
RedrawOrderFlow();
//
XPVPivot lastPivot;
result = GetLastItem(
@@ -197,6 +197,113 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
{
return result;
}
bool isBullishOrderFlow = IsBullish(mOrderFlowDir);
bool isBearishOrderFlow = IsBearish(mOrderFlowDir);
double pivotMid = lastPivot.CalculateMid();
// RedrawOrderFlow();
//
// Calculate Liquidity Percent ...
double bullishLiquidityPercent = lastPivot
.CalculateLiquidityPercent(X_DIRECTION_BULLISH);
double bearishLiquidityPercent = lastPivot
.CalculateLiquidityPercent(X_DIRECTION_BEARISH);
//
// Detect Order Blocks ...
int obsCount = 0;
//
// Find Bullish Order Block ...
XCOrderBlock *bullishOB = NULL;
obsCount = lastPivot.state.CountBullishOrderBlocks();
if (IsValidSize(obsCount))
{
//
for (int i = 0; i < obsCount; i++)
{
//
XCOrderBlock *iOB = lastPivot.state.bullishOrderBlocks[i];
//
XOHCL iBar;
bool hasBar = iOB.FillBar(iBar);
bool isPeriodSame = hasBar &&
iBar.period == _period;
//
if (iOB.Upper() <= pivotMid &&
iOB.Lower() >= lastPivot.lower)
{
//
bullishOB = iOB;
break;
}
}
}
bool hasBullishOB = bullishOB != NULL;
if (hasBullishOB)
{
//
bullishOB.To(cTime);
XCBullishOrderBlockObject *iObj;
bool isCreated = mPOIDrawer.CreateBullishOrderBlock(
bullishOB,
iObj //
);
if (isCreated)
{
AddObjectIfNotExists(iObj);
}
}
//
// Find Bearish Order Block ...
XCOrderBlock *bearishOB = NULL;
obsCount = lastPivot.state.CountBearishOrderBlocks();
if (IsValidSize(obsCount))
{
//
for (int i = 0; i < obsCount; i++)
{
//
XCOrderBlock *iOB = lastPivot.state.bearishOrderBlocks[i];
//
XOHCL iBar;
bool hasBar = iOB.FillBar(iBar);
bool isPeriodSame = hasBar &&
iBar.period == _period;
//
if (iOB.Lower() >= pivotMid &&
iOB.Upper() <= lastPivot.upper)
{
//
bearishOB = iOB;
break;
}
}
}
bool hasBearishOB = bearishOB != NULL;
if (hasBearishOB)
{
//
bearishOB.To(cTime);
XCBearishOrderBlockObject *iObj;
bool isCreated = mPOIDrawer.CreateBearishOrderBlock(
bearishOB,
iObj //
);
if (isCreated)
{
AddObjectIfNotExists(iObj);
}
}
//
// Find an Order Block ...
bool isBearishOrderBlockRejected = false;
//
// Check Candlestick PullBacks ...
@@ -411,16 +518,6 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
//
// Prepare Areas ...
double bid = GetBid(_symbol);
bool isBullish = IsBullish(mOrderFlowDir);
bool isBearish = IsBearish(mOrderFlowDir);
double pivotMid = lastPivot.CalculateMid();
//
// Calculate Liquidity Percent ...
double bullishLiquidityPercent = lastPivot
.CalculateLiquidityPercent(X_DIRECTION_BULLISH);
double bearishLiquidityPercent = lastPivot
.CalculateLiquidityPercent(X_DIRECTION_BEARISH);
//
bool isInDiscount =
@@ -439,21 +536,21 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
// For Bullish Order Flow ...
// if Price Breakes Lower to Down, means Change of Charcter Happens ...
bool isCHOCHHappens =
isBullish ? bid < lastPivot.lower - pip
isBullishOrderFlow ? bid < lastPivot.lower - pip
: bid > lastPivot.upper + pip;
//
// For Bullish Order Flow ...
// if Price Breakes Upper to Up, means Breake of Structure Happens ...
bool isBOSHappens =
isBullish ? bid > lastPivot.upper + pip
isBullishOrderFlow ? bid > lastPivot.upper + pip
: bid < lastPivot.lower - pip;
//
if (isBOSHappens)
{
//
RedrawOrderFlow();
// RedrawOrderFlow();
}
//
@@ -465,27 +562,27 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
return result;
}
//
hasLong =
//
is3Bullish &&
// isInDiscount &&
isSarBullish &&
// hasBullishPullback &&
bullishLiquidityPercent > 30
//
;
// //
// hasLong =
// //
// is3Bullish &&
// // isInDiscount &&
// isSarBullish // &&
// // hasBullishPullback &&
// // bullishLiquidityPercent > 30
// //
// ;
//
hasShort =
//
is3Bearish &&
// isInPremium &&
isSarBearish &&
// hasBearishPullback &&
bearishLiquidityPercent > 30
//
;
// //
// hasShort =
// //
// is3Bearish &&
// // isInPremium &&
// isSarBearish // &&
// // hasBearishPullback &&
// // bearishLiquidityPercent > 30
// //
// ;
//
result = hasLong ||
@@ -776,11 +873,11 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
//
// Check Order Flow Direction ...
result = mOrderFlowDir != X_DIRECTION_NONE;
if (!result)
{
return result;
}
// result = mOrderFlowDir != X_DIRECTION_NONE;
// if (!result)
// {
// return result;
// }
//
return result;
@@ -1952,8 +2049,8 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
false, // Draw ResistanceZones ..
false, // Draw SupplyZones ..
false, // Draw DemandZones ..
false, // Draw BullishOrderBlocks ..
false, // Draw BearishOrderBlocks ..
true, // Draw BullishOrderBlocks ..
true, // Draw BearishOrderBlocks ..
false, // Draw BullishFairValueGaps ..
false, // Draw BearishFairValueGaps ..
false, // Draw BullishRejectionBars ..