Fix Order Blocks ...

This commit is contained in:
2025-03-17 23:02:12 +03:30
parent 48c78e1256
commit 3f26a75e2e
4 changed files with 146 additions and 56 deletions
+101 -4
View File
@@ -1336,6 +1336,24 @@ class XCBarAnalyser : public XCBase
return result; return result;
} }
//
XOHCL sBar;
if (bar.Index() == 0)
{
//
result = bar.GetPreviousBar(sBar);
if (!result)
{
//
sBar.Clean();
return result;
}
}
else
{
sBar = bar;
}
// //
// First Step We Have to Check Same Bars ... // First Step We Have to Check Same Bars ...
int spikeRootIDX = -1; int spikeRootIDX = -1;
@@ -1365,7 +1383,7 @@ class XCBarAnalyser : public XCBase
spikeRootIDX, // Spike Root Index ... spikeRootIDX, // Spike Root Index ...
X_PRICE_CLOSE, // Price Type ... X_PRICE_CLOSE, // Price Type ...
true, // Force Body ... true, // Force Body ...
1.0, // Range Extend Multiplier ... 1.5, // Range Extend Multiplier ...
sameBars // sameBars //
); );
result = result =
@@ -1380,12 +1398,69 @@ class XCBarAnalyser : public XCBase
} }
// //
// Select Order Block Bar ... // Select OB Candidate Bars ...
result = ob.Init(
XOHCL sameBar;
XOHCL rootBar;
XOHCL rootPBar;
result = sameBar.Init(
bar.symbol, bar.symbol,
bar.period, bar.period,
sameBarsIndex + 1 // sameBarsIndex + 1 //
); );
if (!result)
{
//
sBar.Clean();
sameBar.Clean();
return result;
}
result = rootBar.Init(
bar.symbol,
bar.period,
spikeRootIDX //
);
if (!result)
{
//
sBar.Clean();
rootBar.Clean();
sameBar.Clean();
return result;
}
result = rootBar.GetPreviousBar(rootPBar);
if (!result)
{
//
sBar.Clean();
rootBar.Clean();
sameBar.Clean();
rootPBar.Clean();
return result;
}
//
// Select ob Bar ...
if (rootBar.GetDirection() == Opposit(dir))
{
ob = rootBar;
}
else if (rootPBar.GetDirection() == Opposit(dir))
{
ob = rootPBar;
}
else if (sameBar.GetDirection() == Opposit(dir))
{
ob = sameBar;
}
else
{
ob.Clean();
}
//
// Select Order Block Bar ...
result = ob.IsValid();
ENUM_X_DIRECTION obDir = ob.GetDirection(); ENUM_X_DIRECTION obDir = ob.GetDirection();
result = result =
result && result &&
@@ -1393,7 +1468,12 @@ class XCBarAnalyser : public XCBase
if (!result) if (!result)
{ {
// //
ob.Clean(); sBar.Clean();
rootBar.Clean();
sameBar.Clean();
rootPBar.Clean();
//
return result; return result;
} }
@@ -1432,7 +1512,15 @@ class XCBarAnalyser : public XCBase
// //
if (!result) if (!result)
{ {
//
ob.Clean(); ob.Clean();
sBar.Clean();
rootBar.Clean();
sameBar.Clean();
rootPBar.Clean();
//
return result;
} }
} }
@@ -1463,6 +1551,15 @@ class XCBarAnalyser : public XCBase
fromBar.Clean(); fromBar.Clean();
} }
//
// Cleanup Resource ...
//
sBar.Clean();
rootBar.Clean();
sameBar.Clean();
rootPBar.Clean();
// //
return result; return result;
} }
+33 -33
View File
@@ -717,7 +717,7 @@ class XCPOIDetector : public XCBaseAlert
OrderBlockSameBars(3); OrderBlockSameBars(3);
OrderBlockForceSpike(true); OrderBlockForceSpike(true);
OrderBlockForceFairValueGap(true); OrderBlockForceFairValueGap(true);
OrderBlockForceSupportResistance(true); OrderBlockForceSupportResistance(false);
} }
/** /**
@@ -846,31 +846,31 @@ class XCPOIDetector : public XCBaseAlert
// //
// Supply ... // Supply ...
// DetectSupplyZone( DetectSupplyZone(
// iBar, iBar,
// iEvent // iEvent //
// ); );
// //
// Demand ... // Demand ...
// DetectDemandZone( DetectDemandZone(
// iBar, iBar,
// iEvent // iEvent //
// ); );
// //
// FairValueGap ... // FairValueGap ...
// DetectFairValueGap( DetectFairValueGap(
// iBar, iBar,
// iEvent // iEvent //
// ); );
// //
// OrderBlock ... // OrderBlock ...
// DetectOrderBlock( DetectOrderBlock(
// iBar, iBar,
// iEvent // iEvent //
// ); );
// //
canContinue = canContinue =
@@ -1081,10 +1081,10 @@ class XCPOIDetector : public XCBaseAlert
// //
// Supply ... // Supply ...
// has = DetectSupplyZone( has = DetectSupplyZone(
// iBar, iBar,
// iEvent // iEvent //
// ); );
if (has) if (has)
{ {
// //
@@ -1096,10 +1096,10 @@ class XCPOIDetector : public XCBaseAlert
// //
// Demand ... // Demand ...
// has = DetectDemandZone( has = DetectDemandZone(
// iBar, iBar,
// iEvent // iEvent //
// ); );
if (has) if (has)
{ {
// //
@@ -1111,10 +1111,10 @@ class XCPOIDetector : public XCBaseAlert
// //
// FairValueGap ... // FairValueGap ...
// has = DetectFairValueGap( has = DetectFairValueGap(
// iBar, iBar,
// iEvent // iEvent //
// ); );
if (has) if (has)
{ {
// //
@@ -1126,10 +1126,10 @@ class XCPOIDetector : public XCBaseAlert
// //
// OrderBlock ... // OrderBlock ...
// has = DetectOrderBlock( has = DetectOrderBlock(
// iBar, iBar,
// iEvent // iEvent //
// ); );
if (has) if (has)
{ {
// //
+4 -11
View File
@@ -344,37 +344,30 @@ void DetectPOIState()
// Bullish ... // Bullish ...
showBullishPOIs && true, // SwingLows showBullishPOIs && true, // SwingLows
showBullishPOIs && true, // DemandZones showBullishPOIs && true, // DemandZones
showBullishPOIs && false, // SupportZones showBullishPOIs && true, // SupportZones
showBullishPOIs && true, // BullishSharps showBullishPOIs && true, // BullishSharps
showBullishPOIs && true, // BullishSpikes showBullishPOIs && true, // BullishSpikes
showBullishPOIs && true, // BullishPullbacks showBullishPOIs && true, // BullishPullbacks
showBullishPOIs && true, // BullishMomentums showBullishPOIs && true, // BullishMomentums
showBullishPOIs && true, // BullishRejections showBullishPOIs && true, // BullishRejections
showBullishPOIs && true, // BullishOrderBlocks showBullishPOIs && false, // BullishOrderBlocks
showBullishPOIs && true, // BullishFairValueGaps showBullishPOIs && true, // BullishFairValueGaps
showBullishPOIs && true, // BullishConsolidationZones showBullishPOIs && true, // BullishConsolidationZones
// //
// Bearish ... // Bearish ...
showBearishPOIs && true, // SwingHighs showBearishPOIs && true, // SwingHighs
showBearishPOIs && true, // SupplyZones showBearishPOIs && true, // SupplyZones
showBearishPOIs && false, // ResistanceZones showBearishPOIs && true, // ResistanceZones
showBearishPOIs && true, // BearishSharps showBearishPOIs && true, // BearishSharps
showBearishPOIs && true, // BearishSpikes showBearishPOIs && true, // BearishSpikes
showBearishPOIs && true, // BearishPullbacks showBearishPOIs && true, // BearishPullbacks
showBearishPOIs && true, // BearishMomentums showBearishPOIs && true, // BearishMomentums
showBearishPOIs && true, // BearishRejections showBearishPOIs && true, // BearishRejections
showBearishPOIs && true, // BearishOrderBlocks showBearishPOIs && false, // BearishOrderBlocks
showBearishPOIs && true, // BearishFairValueGaps showBearishPOIs && true, // BearishFairValueGaps
showBearishPOIs && true // BearishConsolidationZones showBearishPOIs && true // BearishConsolidationZones
); );
//
if (poiEventNotifier.hasNewSupportZone ||
poiEventNotifier.hasNewResistanceZone)
{
Print("Support/Resistance ...");
}
// //
Clean(poiEvents); Clean(poiEvents);
poiEventNotifier.Clean(); poiEventNotifier.Clean();
+8 -8
View File
@@ -680,8 +680,8 @@ struct XPOIStateEvents
// //
// Supply/Demand (s) ... // Supply/Demand (s) ...
bool hasSupplyZone; bool hasNewSupplyZone;
bool hasDemandZone; bool hasNewDemandZone;
// //
// Fair Value Gaps ... // Fair Value Gaps ...
@@ -748,8 +748,8 @@ struct XPOIStateEvents
hasNewResistanceZone = false; hasNewResistanceZone = false;
// //
hasSupplyZone = false; hasNewSupplyZone = false;
hasDemandZone = false; hasNewDemandZone = false;
// //
hasNewFairValueGap = false; hasNewFairValueGap = false;
@@ -812,8 +812,8 @@ struct XPOIStateEvents
hasNewResistanceZone = HasNewResistanceZone(events); hasNewResistanceZone = HasNewResistanceZone(events);
// //
hasSupplyZone = HasSupplyZone(events); hasNewSupplyZone = HasNewSupplyZone(events);
hasDemandZone = HasDemandZone(events); hasNewDemandZone = HasNewDemandZone(events);
// //
hasNewFairValueGap = HasNewFairValueGap(events); hasNewFairValueGap = HasNewFairValueGap(events);
@@ -4981,7 +4981,7 @@ bool HasNewResistanceZone(ENUM_XPOI_EVENTS &events[])
// Supply / Demand Zones ... // Supply / Demand Zones ...
// //
bool HasSupplyZone(ENUM_XPOI_EVENTS &events[]) bool HasNewSupplyZone(ENUM_XPOI_EVENTS &events[])
{ {
return Contains( return Contains(
X_SUPPLY_ZONE_DETECTED, X_SUPPLY_ZONE_DETECTED,
@@ -4990,7 +4990,7 @@ bool HasSupplyZone(ENUM_XPOI_EVENTS &events[])
} }
// //
bool HasDemandZone(ENUM_XPOI_EVENTS &events[]) bool HasNewDemandZone(ENUM_XPOI_EVENTS &events[])
{ {
return Contains( return Contains(
X_DEMAND_ZONE_DETECTED, X_DEMAND_ZONE_DETECTED,