complete and fix momentums ...

This commit is contained in:
2025-03-17 13:22:16 +03:30
parent a1f3289bb6
commit ad3b0ae4ac
4 changed files with 72 additions and 34 deletions
+21 -14
View File
@@ -2099,13 +2099,12 @@ class XCBarAnalyser : public XCBase
} }
// //
// Check Bar Must Engulfed ... XOHCL pBar;
result = IsEngulfed( result = bar.GetPreviousBar(pBar);
bar,
dir //
);
if (!result) if (!result)
{ {
//
pBar.Clean();
return result; return result;
} }
@@ -2131,24 +2130,32 @@ class XCBarAnalyser : public XCBase
IsValidIndex(hhIDX); IsValidIndex(hhIDX);
if (!result) if (!result)
{ {
//
pBar.Clean();
return result; return result;
} }
//
// TODO: Fix Momentum Extends and Also Rejection ...
double llhhDiff = MathAbs(hh - ll);
// //
bool isBullish = bool isBullish =
bar.low > ll && bar.low > ll &&
IsBullish(dir) && bar.close >= hh &&
bar.close >= hh; bar.IsBullish() &&
bar.low > pBar.low &&
bar.high > pBar.high &&
bar.GetBody() > pBar.GetBody() &&
bar.GetRange() > pBar.GetRange() &&
bar.GetShadows() < pBar.GetShadows();
// //
bool isBearish = bool isBearish =
bar.high < hh && bar.high < hh &&
IsBearish(dir) && bar.close <= ll &&
bar.close <= ll; bar.IsBearish() &&
bar.low < pBar.low &&
bar.high < pBar.high &&
bar.GetBody() > pBar.GetBody() &&
bar.GetRange() > pBar.GetRange() &&
bar.GetShadows() < pBar.GetShadows();
// //
result = isBullish || result = isBullish ||
@@ -2163,7 +2170,7 @@ class XCBarAnalyser : public XCBase
} }
// //
// Cleanup Resources ... pBar.Clean();
// //
return result; return result;
+42 -11
View File
@@ -788,10 +788,10 @@ class XCPOIDetector : public XCBaseAlert
// //
// Momentum ... // Momentum ...
// DetectMomentum( DetectMomentum(
// iBar, iBar,
// iEvent // iEvent //
// ); );
// //
// Rejection ... // Rejection ...
@@ -952,10 +952,10 @@ class XCPOIDetector : public XCBaseAlert
// //
// Momentum ... // Momentum ...
// has = DetectMomentum( has = DetectMomentum(
// iBar, iBar,
// iEvent // iEvent //
// ); );
if (has) if (has)
{ {
// //
@@ -1181,7 +1181,7 @@ class XCPOIDetector : public XCBaseAlert
// //
Copy( Copy(
mBullishMomentums, mBearishMomentums,
state.bearishMomentums // state.bearishMomentums //
); );
@@ -1570,10 +1570,32 @@ class XCPOIDetector : public XCBaseAlert
return result; return result;
} }
//
XOHCL sBar;
if (bar.Index() == 0)
{
//
result = sBar.Init(
bar.symbol,
bar.period,
bar.Index() + 1 //
);
if (!result)
{
//
sBar.Clean();
return result;
}
}
else
{
sBar = bar;
}
// //
ENUM_X_DIRECTION iDir; ENUM_X_DIRECTION iDir;
result = mBarAnalyser.IsMomentum( result = mBarAnalyser.IsMomentum(
bar, sBar,
iDir, iDir,
mMomentumLoopback, mMomentumLoopback,
mMomentumRangeExtendMultiplier // mMomentumRangeExtendMultiplier //
@@ -1584,6 +1606,8 @@ class XCPOIDetector : public XCBaseAlert
HasDirection(iDir); HasDirection(iDir);
if (!result) if (!result)
{ {
//
sBar.Clean();
return result; return result;
} }
@@ -1602,10 +1626,12 @@ class XCPOIDetector : public XCBaseAlert
XCMomentumBar *momentum; XCMomentumBar *momentum;
momentum = new XCMomentumBar(); momentum = new XCMomentumBar();
result = momentum.Init( result = momentum.Init(
bar // sBar //
); );
if (!result) if (!result)
{ {
//
sBar.Clean();
return result; return result;
} }
@@ -1617,6 +1643,8 @@ class XCPOIDetector : public XCBaseAlert
result = !IsValidIndex(idx); result = !IsValidIndex(idx);
if (!result) if (!result)
{ {
//
sBar.Clean();
return result; return result;
} }
@@ -1653,6 +1681,9 @@ class XCPOIDetector : public XCBaseAlert
? X_BULLISH_MOMENTUM_BAR_DETECTED ? X_BULLISH_MOMENTUM_BAR_DETECTED
: X_BEARISH_MOMENTUM_BAR_DETECTED; : X_BEARISH_MOMENTUM_BAR_DETECTED;
//
sBar.Clean();
// //
return result; return result;
} }
+1 -1
View File
@@ -3364,9 +3364,9 @@ class XCPOIDrawer : public XCBase
// Bearish ... // Bearish ...
bool ignoreSwingHighs = false, bool ignoreSwingHighs = false,
bool ignoreSupplyZones = false, bool ignoreSupplyZones = false,
bool ignoreResistanceZones = false,
bool ignoreBearishSharps = false, bool ignoreBearishSharps = false,
bool ignoreBearishSpikes = false, bool ignoreBearishSpikes = false,
bool ignoreResistanceZones = false,
bool ignoreBearishMomentums = false, bool ignoreBearishMomentums = false,
bool ignoreBearishRejections = false, bool ignoreBearishRejections = false,
bool ignoreBearishOrderBlocks = false, bool ignoreBearishOrderBlocks = false,
+8 -8
View File
@@ -342,24 +342,24 @@ void DetectPOIState()
stateObjects, stateObjects,
// //
// Bullish ... // Bullish ...
showBullishPOIs && false, // SwingLows showBullishPOIs && true, // SwingLows
showBullishPOIs && true, // DemandZones showBullishPOIs && true, // DemandZones
showBullishPOIs && true, // SupportZones showBullishPOIs && true, // SupportZones
showBullishPOIs && true, // BullishSharps showBullishPOIs && true, // BullishSharps
showBullishPOIs && false, // BullishSpikes showBullishPOIs && true, // BullishSpikes
showBullishPOIs && true, // BullishMomentums showBullishPOIs && false, // BullishMomentums
showBullishPOIs && true, // BullishRejections showBullishPOIs && true, // BullishRejections
showBullishPOIs && true, // BullishOrderBlocks showBullishPOIs && true, // BullishOrderBlocks
showBullishPOIs && true, // BullishFairValueGaps showBullishPOIs && true, // BullishFairValueGaps
showBullishPOIs && true, // BullishConsolidationZones showBullishPOIs && true, // BullishConsolidationZones
// //
// Bearish ... // Bearish ...
showBearishPOIs && false, // SwingHighs showBearishPOIs && true, // SwingHighs
showBearishPOIs && true, // SupplyZones showBearishPOIs && true, // SupplyZones
showBearishPOIs && true, // BearishSharps showBearishPOIs && true, // BearishSharps
showBearishPOIs && false, // BearishSpikes showBearishPOIs && true, // BearishSpikes
showBearishPOIs && true, // ResistanceZones showBearishPOIs && true, // ResistanceZones
showBearishPOIs && true, // BearishMomentums showBearishPOIs && false, // BearishMomentums
showBearishPOIs && true, // BearishRejections showBearishPOIs && true, // BearishRejections
showBearishPOIs && true, // BearishOrderBlocks showBearishPOIs && true, // BearishOrderBlocks
showBearishPOIs && true, // BearishFairValueGaps showBearishPOIs && true, // BearishFairValueGaps
@@ -367,9 +367,9 @@ void DetectPOIState()
); );
// //
if (poiEventNotifier.hasNewSwing) if (poiEventNotifier.hasNewMomentum)
{ {
Print("Swing ..."); Print("Momentum ...");
} }
// //