Last Works on Validating Order Blocks ...

This commit is contained in:
2025-01-06 21:53:05 +03:30
parent 9d4b2ee578
commit 65b7a2ca7f
13 changed files with 3490 additions and 751 deletions
+213 -73
View File
@@ -257,9 +257,10 @@ struct X121SMCStrategyConditions
ENUM_X_DIRECTION signalDir;
//
XPriceZones priceZones;
XPriceZones decisionZones;
XMarketStructure marketStructure;
X121Conditions conditions;
// XPriceZones priceZones;
// XPriceZones decisionZones;
// XMarketStructure marketStructure;
//
void X121SMCStrategyConditions()
@@ -287,9 +288,10 @@ struct X121SMCStrategyConditions
signalDir = X_DIRECTION_NONE;
//
priceZones.Clean();
decisionZones.Clean();
marketStructure.Clean();
conditions.Clean();
// priceZones.Clean();
// decisionZones.Clean();
// marketStructure.Clean();
}
/**
@@ -537,75 +539,75 @@ int DrawX121SMCStrategyConditions(
//
bool isBullish = IsBullish(conditions.signalDir);
//
bool hasPriceZones = conditions.priceZones.IsValid();
if (hasPriceZones &&
drawPriceZones)
{
//
XCBaseObject *objects[];
int objectsCount = drawer.DrawPriceZone(
conditions.priceZones,
objects,
conditions.signalDir,
drawOnlyPriceZonesBoundary //
);
if (IsValidSize(objectsCount))
{
//
Copy(
objects,
drawnObjects,
false //
);
}
}
// //
// bool hasPriceZones = conditions.priceZones.IsValid();
// if (hasPriceZones &&
// drawPriceZones)
// {
// //
// XCBaseObject *objects[];
// int objectsCount = drawer.DrawPriceZone(
// conditions.priceZones,
// objects,
// conditions.signalDir,
// drawOnlyPriceZonesBoundary //
// );
// if (IsValidSize(objectsCount))
// {
// //
// Copy(
// objects,
// drawnObjects,
// false //
// );
// }
// }
//
bool hasDecisionZones = conditions.decisionZones.IsValid();
if (hasDecisionZones &&
drawDecisionZones)
{
//
XCBaseObject *objects[];
int objectsCount = drawer.DrawPriceZone(
conditions.decisionZones,
objects,
conditions.signalDir,
drawOnlyPriceZonesBoundary //
);
if (IsValidSize(objectsCount))
{
//
Copy(
objects,
drawnObjects,
false //
);
}
}
// //
// bool hasDecisionZones = conditions.decisionZones.IsValid();
// if (hasDecisionZones &&
// drawDecisionZones)
// {
// //
// XCBaseObject *objects[];
// int objectsCount = drawer.DrawPriceZone(
// conditions.decisionZones,
// objects,
// conditions.signalDir,
// drawOnlyPriceZonesBoundary //
// );
// if (IsValidSize(objectsCount))
// {
// //
// Copy(
// objects,
// drawnObjects,
// false //
// );
// }
// }
//
bool hasMarketStructure = conditions.marketStructure.IsValid();
if (hasMarketStructure &&
drawMarketStructure)
{
//
XCBaseObject *objects[];
int objectsCount = drawer.DrawMarketStructure(
conditions.marketStructure,
objects //
);
if (IsValidSize(objectsCount))
{
//
Copy(
objects,
drawnObjects,
false //
);
}
}
// //
// bool hasMarketStructure = conditions.marketStructure.IsValid();
// if (hasMarketStructure &&
// drawMarketStructure)
// {
// //
// XCBaseObject *objects[];
// int objectsCount = drawer.DrawMarketStructure(
// conditions.marketStructure,
// objects //
// );
// if (IsValidSize(objectsCount))
// {
// //
// Copy(
// objects,
// drawnObjects,
// false //
// );
// }
// }
//
result = ArraySize(drawnObjects);
@@ -713,4 +715,142 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
return result;
}
//
//
bool TestPOIState(
XCPOIDrawer *drawer,
ENUM_X_DIRECTION forDir, // Test For Specified Direction ...
XPOIState &biggerState, // Bigger TF POI(s) ...
XPOIState &midState, // Mid TF POI(s) ...
XPOIState &triggerState, // Trigger TF POI(s) ...
int barIndex = 0 // Bar Index ...
)
{
//
bool result = false;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
// Validate Args ...
result =
drawer != NULL &&
HasDirection(forDir) &&
biggerState.HasChild() &&
midState.HasChild() &&
triggerState.HasChild();
if (!result)
{
return result;
}
//
string symbol = biggerState.symbol;
ENUM_TIMEFRAMES period = biggerState.period;
//
// Retrieve Bars ...
XOHCL triggerCBar;
result = triggerCBar.Init(
symbol,
period,
barIndex //
);
//
// Select Order Blocks Which Has Big Changes ...
int count = 0;
datetime cTime = TimeCurrent();
//
// Bullish ...
XCOrderBlock *bullishOrderBlocks[];
int bullishOrderBlocksCount = biggerState.CountBullishOrderBlocks();
count = bullishOrderBlocksCount;
if (IsValidSize(count))
{
//
for (int i = count - 1; i >= 0; i--)
{
//
XCOrderBlock *iOb = biggerState.bullishOrderBlocks[i];
iOb.To(cTime);
//
// Find Exit Bar of Bullish OrderBlock Upper ...
XOHCL breakerBar;
bool hasBreakerBar = iOb.DetectBreakerBar(breakerBar);
if (!hasBreakerBar)
{
continue;
}
//
// Detect Order Block is Hunted Or Not ...
XOHCL huntedBar;
bool isHunted = iOb.IsHunted(huntedBar);
if (isHunted) {
continue;
}
//
XCBullishOrderBlockObject *iOBObject;
bool isInited = drawer.CreateBullishOrderBlock(
iOb,
iOBObject //
);
if (isInited)
{
}
//
XCOHCLObject *iBarObj;
isInited = drawer.CreateBar(
breakerBar,
iBarObj,
cTime //
);
if (isInited)
{
Print("");
}
}
}
//
// Bearish ...
XCOrderBlock *bearishOrderBlocks[];
int bearishOrderBlocksCount = biggerState.CountBearishOrderBlocks();
count = bearishOrderBlocksCount;
if (IsValidSize(count))
{
//
for (int i = count - 1; i >= 0; i--)
{
//
XCOrderBlock *iOb = biggerState.bearishOrderBlocks[i];
}
}
//
result =
//
IsValidSize(bullishOrderBlocksCount) ||
IsValidSize(bearishOrderBlocksCount)
//
;
if (!result)
{
return result;
}
//
return result;
}
//