This commit is contained in:
2025-02-07 18:27:55 +03:30
parent 4e7975859b
commit 1060997f82
5 changed files with 3214 additions and 323 deletions
+281 -61
View File
@@ -680,77 +680,141 @@ bool DetectX121SMCXOBSSignalSetup(
UpdateTo(conditions.validBullishOBs);
UpdateTo(conditions.validBearishOBs);
//
DrawX121SMCXOBSConditions(
conditions,
drawer //
);
//
DrawX121SMCXOBSPOIs(
visionState,
drawer //
);
//
DrawX121SMCXOBSPOIs(
consolidationState,
drawer //
);
//
// Lookup for new Order Block ...
// for Clearing Conditions ....
//
XCOrderBlock *newBullishOB = NULL;
bool hasNewBullishOB = Contains(
X_BULLISH_ORDERBLOCK_DETECTED,
consolidationPoiEvents //
);
if (hasNewBullishOB)
{
//
int hasOBs = consolidationState.HasBullishOrderBlocks();
int count = consolidationState.CountBullishOrderBlocks();
if (hasOBs)
{
//
newBullishOB = consolidationState.bullishOrderBlocks[count - 1];
}
//
hasNewBullishOB = newBullishOB != NULL &&
newBullishOB.IsValid();
}
//
XCOrderBlock *newBearishOB = NULL;
bool hasNewBearishOB = Contains(
X_BEARISH_ORDERBLOCK_DETECTED,
consolidationPoiEvents //
);
if (hasNewBearishOB)
{
//
int hasOBs = consolidationState.HasBearishOrderBlocks();
int count = consolidationState.CountBearishOrderBlocks();
if (hasOBs)
{
newBearishOB = consolidationState.bearishOrderBlocks[count - 1];
}
//
hasNewBearishOB = newBearishOB != NULL &&
newBearishOB.IsValid();
}
//
bool isNewOBDetected = hasNewBullishOB ||
hasNewBearishOB;
if (isNewOBDetected)
if (hasYoungestOB)
{
//
XCOrderBlock *newBullishOB = NULL;
bool hasNewBullishOB = Contains(
X_BULLISH_ORDERBLOCK_DETECTED,
consolidationPoiEvents //
);
if (hasNewBullishOB)
{
//
DrawX121SMCXOBSOrderBlock(
newBullishOB,
consolidationCycleHelper.mPOIDrawer //
);
int hasOBs = consolidationState.HasBullishOrderBlocks();
int count = consolidationState.CountBullishOrderBlocks();
if (hasOBs)
{
//
newBullishOB = consolidationState.bullishOrderBlocks[count - 1];
}
//
hasNewBullishOB = newBullishOB != NULL &&
newBullishOB.IsValid();
}
//
XCOrderBlock *newBearishOB = NULL;
bool hasNewBearishOB = Contains(
X_BEARISH_ORDERBLOCK_DETECTED,
consolidationPoiEvents //
);
if (hasNewBearishOB)
{
//
DrawX121SMCXOBSOrderBlock(
newBearishOB,
consolidationCycleHelper.mPOIDrawer //
);
int hasOBs = consolidationState.HasBearishOrderBlocks();
int count = consolidationState.CountBearishOrderBlocks();
if (hasOBs)
{
newBearishOB = consolidationState.bearishOrderBlocks[count - 1];
}
//
hasNewBearishOB = newBearishOB != NULL &&
newBearishOB.IsValid();
}
//
bool isNewOBDetected = hasNewBullishOB ||
hasNewBearishOB;
if (isNewOBDetected)
{
//
if (hasNewBullishOB)
{
//
DrawX121SMCXOBSOrderBlock(
newBullishOB,
drawer //
);
}
//
if (hasNewBearishOB)
{
//
DrawX121SMCXOBSOrderBlock(
newBearishOB,
drawer //
);
}
}
//
// Check Conditions ...
if (isNewOBDetected)
{
//
bool isSameOB = false;
//
if (hasNewBullishOB &&
hasYoungestBullishOB)
{
//
isSameOB = IsSame(
newBullishOB,
conditions.youngestBullishOB //
);
}
//
if (!isSameOB &&
hasNewBearishOB &&
hasYoungestBearishOB)
{
//
isSameOB = IsSame(
newBearishOB,
conditions.youngestBearishOB //
);
}
//
if (!isSameOB)
{
//
result = false;
conditions.Clean();
mX121SMCXOBSObjects.Clear();
}
}
//
}
//
@@ -1104,12 +1168,6 @@ bool DetectX121SMCXOBSSignalSetup(
return result;
}
//
DrawX121SMCXOBSConditions(
conditions,
visionCycleHelper.mPOIDrawer //
);
//
return false;
@@ -1536,7 +1594,7 @@ bool DetectX121SMCXOBSGuards(
bool result = false;
//
string provider = ToString(X_121_SMC_PROVIDER_X);
string provider = ToString(X_121_SMC_PROVIDER_XOBS);
//
result = DetectX121SMCGuards(
@@ -1855,3 +1913,165 @@ void DrawX121SMCXOBSConditions(
}
//
void DrawX121SMCXOBSPOIs(
XPOIState &state,
XCPOIDrawer *drawer //
)
{
//
if (!state.IsValid() &&
drawer == NULL &&
!state.HasChild())
{
return;
}
//
bool hasSupplyZones = state.HasSupplyZones();
int supplyZonesCount = state.CountSupplyZones();
if (hasSupplyZones)
{
//
int idx = GetHighest(state.supplyZones);
if (IsValidIndex(idx))
{
//
XCSupplyZone *iZone = state.supplyZones[idx];
//
iZone.To(TimeCurrent());
//
XCSupplyZoneObject *iObj;
bool isCreated = drawer.CreateSupplyZone(
iZone,
iObj //
);
if (isCreated)
{
iObj.ZoneColor(clrRed);
mX121SMCXOBSObjects.Add(iObj);
}
}
//
// for (int i = 0; i < supplyZonesCount; i++)
// {
// //
// XCSupplyZone *iZone = state.supplyZones[i];
// //
// iZone.To(TimeCurrent());
// //
// XCSupplyZoneObject *iObj;
// bool isCreated = drawer.CreateSupplyZone(
// iZone,
// iObj //
// );
// if (isCreated)
// {
// iObj.ZoneColor(clrRed);
// mX121SMCXOBSObjects.Add(iObj);
// }
// }
}
//
bool hasDemandZones = state.HasDemandZones();
int demandZonesCount = state.CountDemandZones();
if (hasDemandZones)
{
int idx = GetLowest(state.demandZones);
if (IsValidIndex(idx))
{
//
XCDemandZone *iZone = state.demandZones[idx];
//
iZone.To(TimeCurrent());
//
XCDemandZoneObject *iObj;
bool isCreated = drawer.CreateDemandZone(
iZone,
iObj //
);
if (isCreated)
{
//
iObj.ZoneColor(clrLime);
mX121SMCXOBSObjects.Add(iObj);
}
}
//
// for (int i = 0; i < demandZonesCount; i++)
// {
// //
// XCDemandZone *iZone = state.demandZones[i];
// //
// iZone.To(TimeCurrent());
// //
// XCDemandZoneObject *iObj;
// bool isCreated = drawer.CreateDemandZone(
// iZone,
// iObj //
// );
// if (isCreated)
// {
// //
// iObj.ZoneColor(clrLime);
// mX121SMCXOBSObjects.Add(iObj);
// }
// }
}
//
// bool hasBullishOrderBlocks = state.HasBullishOrderBlocks();
// int bullishOrderBlocksCount = state.CountBullishOrderBlocks();
// if (hasBullishOrderBlocks)
// {
// //
// for (int i = 0; i < bullishOrderBlocksCount; i++)
// {
// //
// XCOrderBlock *iZone = state.bullishOrderBlocks[i];
// //
// iZone.To(TimeCurrent());
// //
// DrawX121SMCXOBSOrderBlock(
// iZone,
// drawer //
// );
// }
// }
//
// bool hasBearishOrderBlocks = state.HasBearishOrderBlocks();
// int bearishOrderBlocksCount = state.CountBearishOrderBlocks();
// if (hasBearishOrderBlocks)
// {
// //
// for (int i = 0; i < bearishOrderBlocksCount; i++)
// {
// //
// XCOrderBlock *iZone = state.bearishOrderBlocks[i];
// //
// iZone.To(TimeCurrent());
// //
// DrawX121SMCXOBSOrderBlock(
// iZone,
// drawer //
// );
// }
// }
}
//
File diff suppressed because it is too large Load Diff