This commit is contained in:
2024-12-14 01:15:29 +03:30
parent 940931d78a
commit 5d0431893c
3 changed files with 260 additions and 31 deletions
@@ -977,12 +977,101 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
// XPVPivot lastPivot = orderFlow[pivotsCount - 1];
//
double zoneVerificationDivider = 10;
bool isPeakInsideSupplyZone = false;
bool isValeInsideDemandZone = false;
//
XPOIState state = conditions.consolidationConditions.state;
// //
// // Detect Order Block ...
// XCOrderBlock *orderBlock = NULL;
// //
// int bullishOBCount = state.CountBullishOrderBlocks();
// if (IsValidSize(bullishOBCount))
// {
// //
// for (int i = 0; i < bullishOBCount; i++)
// {
// //
// XCOrderBlock *iZone = state.bullishOrderBlocks[i];
// //
// bool isInside = vale >= iZone.Lower() &&
// vale <= iZone.Upper() &&
// bid <= iZone.Lower() + ((iZone.Upper() - iZone.Lower()) / zoneVerificationDivider);
// if (isInside)
// {
// //
// orderBlock = iZone;
// break;
// }
// }
// }
// //
// int bearishOBCount = state.CountBearishOrderBlocks();
// if (IsValidSize(bearishOBCount))
// {
// //
// for (int i = 0; i < bearishOBCount; i++)
// {
// //
// XCOrderBlock *iZone = state.bearishOrderBlocks[i];
// //
// bool isInside = peak >= iZone.Lower() &&
// peak <= iZone.Upper() &&
// bid >= iZone.Upper() - ((iZone.Upper() - iZone.Lower()) / zoneVerificationDivider);
// if (isInside)
// {
// //
// orderBlock = iZone;
// break;
// }
// }
// }
// //
// result = orderBlock != NULL &&
// orderBlock.IsValid();
// if (!result)
// {
// return result;
// }
// //
// // Draw Order Block ...
// orderBlock.To(TimeCurrent());
// if (orderBlock.IsBullish())
// {
// //
// XCBullishOrderBlockObject *iObj;
// bool isCreated = mPOIDrawer.CreateBullishOrderBlock(
// orderBlock,
// iObj //
// );
// if (isCreated)
// {
// AddObjectIfNotExists(iObj);
// }
// }
// else
// {
// //
// XCBearishOrderBlockObject *iObj;
// bool isCreated = mPOIDrawer.CreateBearishOrderBlock(
// orderBlock,
// iObj //
// );
// if (isCreated)
// {
// AddObjectIfNotExists(iObj);
// }
// }
//
XCSupplyZone *supplyZone;
int supplyCount = state.CountSupplyZones();
@@ -995,7 +1084,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
XCSupplyZone *iZone = state.supplyZones[i];
isPeakInsideSupplyZone = peak >= iZone.Lower() &&
peak <= iZone.Upper() &&
bid >= iZone.Lower() + ((iZone.Upper() - iZone.Lower()) / 2);
bid >= iZone.Lower() + ((iZone.Upper() - iZone.Lower()) / zoneVerificationDivider);
if (isPeakInsideSupplyZone)
{
//
@@ -1017,7 +1106,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
XCDemandZone *iZone = state.demandZones[i];
isValeInsideDemandZone = vale >= iZone.Lower() &&
vale <= iZone.Upper() &&
bid <= iZone.Lower() + ((iZone.Upper() - iZone.Lower()) / 2);
bid <= iZone.Lower() + ((iZone.Upper() - iZone.Lower()) / zoneVerificationDivider);
if (isValeInsideDemandZone)
{
//
@@ -1051,35 +1140,35 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
return result;
}
// //
// if (isPeakAttacked)
// {
// //
// supplyZone.To(TimeCurrent());
// XCSupplyZoneObject *iObj;
// bool isCreated = mPOIDrawer.CreateSupplyZone(
// supplyZone,
// iObj //
// );
// if (isCreated)
// {
// AddObjectIfNotExists(iObj);
// }
// }
// else
// {
// //
// demandZone.To(TimeCurrent());
// XCDemandZoneObject *iObj;
// bool isCreated = mPOIDrawer.CreateDemandZone(
// demandZone,
// iObj //
// );
// if (isCreated)
// {
// AddObjectIfNotExists(iObj);
// }
// }
//
if (isPeakAttacked)
{
//
supplyZone.To(TimeCurrent());
XCSupplyZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateSupplyZone(
supplyZone,
iObj //
);
if (isCreated)
{
AddObjectIfNotExists(iObj);
}
}
else
{
//
demandZone.To(TimeCurrent());
XCDemandZoneObject *iObj;
bool isCreated = mPOIDrawer.CreateDemandZone(
demandZone,
iObj //
);
if (isCreated)
{
AddObjectIfNotExists(iObj);
}
}
//
bool isBullish =
@@ -2269,6 +2358,22 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
{
result = conditions.triggerConditions.x121Conditions.sarBuffer[0];
}
else if (type == X_121_SMC_SL_TYPE_TENKAN_SEN)
{
//
double hh = zBar.FindHighest(
9,
MODE_HIGH //
);
double ll = zBar.FindLowest(
9,
MODE_LOW //
);
double mid = (hh - ll) / 2;
result = isBullish
? ll - mid
: hh + mid;
}
else if (type == X_121_SMC_SL_TYPE_CURRENT_SAR_BOX ||
type == X_121_SMC_SL_TYPE_LAST_SAR_CHANGED_BAR ||
type == X_121_SMC_SL_TYPE_LAST_DIRECTIONAL_SAR)