This commit is contained in:
2025-06-03 20:51:46 +03:30
parent 078dc35ae0
commit 043c635812
4 changed files with 666 additions and 90 deletions
+216 -77
View File
@@ -352,8 +352,6 @@ bool ToSignal(
* @return ( bool )
*/
bool DetectSignalZone(
XBoxZone &peak,
XBoxZone &vale,
XCX121XCatbHelper *helper,
XCXCATBEAPOIDrawer *drawer,
XCXCATBEAPOIDetector *detector,
@@ -377,8 +375,6 @@ bool DetectSignalZone(
//
// Validate Args ...
result =
peak.IsValid() &&
vale.IsValid() &&
helper != NULL &&
detector != NULL &&
barAnalyser != NULL;
@@ -406,9 +402,13 @@ bool DetectSignalZone(
int p4IDX = p3IDX + 1;
//
XBoxZone iOB;
XBoxZone iMT;
int idx = -1;
XBoxZone iPeak;
XBoxZone iVale;
XBoxZone iOBBull;
XBoxZone iOBBear;
XBoxZone iMTBull;
XBoxZone iMTBear;
bool has = false;
bool isBullish = false;
bool isBearish = false;
@@ -425,6 +425,154 @@ bool DetectSignalZone(
ENUM_TIMEFRAMES iPeriod = NULL;
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
//
// Select MT Block ...
if (result)
{
//
// New MT Pivot Detected ...
if (detector.newMTBullishPivotDetected)
{
//
idx = GetYoungest(detector.mtBullishPivots);
if (IsValidIndex(idx))
{
iMTBull = detector.mtBullishPivots[idx];
}
}
else if (detector.newMTBearishPivotDetected)
{
//
idx = GetYoungest(detector.mtBearishPivots);
if (IsValidIndex(idx))
{
iMTBear = detector.mtBearishPivots[idx];
}
}
//
// Draw MT ...
//
// Bullish ...
has = iMTBull.IsValid();
if (has)
{
//
iMTBull.to = conditions.bars[zIDX].time;
//
XCBoxObject *iObj;
has = drawer
.drawer
.DrawBox(
iMTBull,
iObj //
);
if (has)
{
drawer.ApplyMTBullishPivotStyle(iObj);
}
}
//
// Bearish ...
has = iMTBear.IsValid();
if (has)
{
//
iMTBear.to = conditions.bars[zIDX].time;
//
XCBoxObject *iObj;
has = drawer
.drawer
.DrawBox(
iMTBear,
iObj //
);
if (has)
{
drawer.ApplyMTBearishPivotStyle(iObj);
}
}
}
//
// Select Peak and Vale ...
// this used to Signalling Better ...
if (result)
{
//
// Select Peak ...
idx = GetLowest(
conditions.bars[cIDX],
detector.peakPivots //
);
if (IsValidIndex(idx))
{
//
iPeak = detector.peakPivots[idx];
iPeak.to = conditions.bars[zIDX].time;
}
//
// Select Vale ...
idx = GetHighest(
conditions.bars[cIDX],
detector.valePivots //
);
if (IsValidIndex(idx))
{
//
iVale = detector.valePivots[idx];
iVale.to = conditions.bars[zIDX].time;
}
//
// Checkig Result ...
result =
iPeak.IsValid() &&
iVale.IsValid();
//
// Draw Peak and Vales ...
if (result)
{
//
// Object Definitions ...
XCBoxObject *iObj;
//
// Draw Peak ...
has = drawer
.drawer
.DrawBox(
iPeak,
iObj //
);
if (has)
{
drawer.ApplyPeakPivotStyle(iObj);
}
ZeroMemory(iObj);
//
// Draw Vale ...
has = drawer
.drawer
.DrawBox(
iVale,
iObj //
);
if (has)
{
drawer.ApplyValePivotStyle(iObj);
}
ZeroMemory(iObj);
}
}
//
// Signalling ...
if (result)
@@ -878,9 +1026,9 @@ bool DetectSignalZone(
// Conditions 1:
// --------------
// Descriptions:
// using Parabolic Sar Trending Start Conditions
// then attached others ..
// ----------------------------------
// - [] Detect Parabolic Sar Start ...
// - [] Convert is to Box ...
// ------------------------------------
//
bool isCond1Bullish =
@@ -943,52 +1091,62 @@ bool DetectSignalZone(
//
// Validate Some Other Requirements ...
//
// We Have to Detect Youngest Order Block ...
// or Mitigation Block ...
if (isCond1Bullish)
{
//
// OB ...
idx = GetYoungest(detector.obBullishPivots);
has = IsValidIndex(idx);
if (has)
{
iOB = detector.obBullishPivots[idx];
}
// //
// // We Have to Detect Youngest Order Block ...
// // or Mitigation Block ...
// if (isCond1Bullish)
// {
// // //
// // // OB ...
// // idx = GetYoungest(detector.obBullishPivots);
// // has = IsValidIndex(idx);
// // if (has)
// // {
// // iOB = detector.obBullishPivots[idx];
// // }
//
// MT ...
idx = GetYoungest(detector.mtBullishPivots);
has = IsValidIndex(idx);
if (has)
{
iOB = detector.mtBullishPivots[idx];
}
}
else if (isCond1Bearish)
{
//
// OB
idx = GetYoungest(detector.obBearishPivots);
has = IsValidIndex(idx);
if (has)
{
iOB = detector.obBearishPivots[idx];
}
// //
// // MT ...
// idx = GetYoungest(detector.mtBullishPivots);
// has = IsValidIndex(idx);
// if (has)
// {
// iOB = detector.mtBullishPivots[idx];
// }
// }
// else if (isCond1Bearish)
// {
// //
// // OB
// // idx = GetYoungest(detector.obBearishPivots);
// // has = IsValidIndex(idx);
// // if (has)
// // {
// // iOB = detector.obBearishPivots[idx];
// // }
//
// MT
idx = GetYoungest(detector.mtBearishPivots);
has = IsValidIndex(idx);
if (has)
{
iMT = detector.mtBearishPivots[idx];
}
}
// //
// // MT
// idx = GetYoungest(detector.mtBearishPivots);
// has = IsValidIndex(idx);
// if (has)
// {
// iMT = detector.mtBearishPivots[idx];
// }
// }
//
// Now we can Do some Verifications Using these ...
// //
// // Now we can Do some Verifications Using these ...
// result =
// isCond1Bullish
// ? iMT.IsBullish()
// : iMT.IsBearish();
// if (!result)
// {
// //
// isCond1Bullish = false;
// isCond1Bearish = false;
// }
//
// All Requirements based on Cond 1 ...
@@ -1069,29 +1227,6 @@ bool DetectSignalZone(
drawer.DrawBox(signalZone);
}
//
// Draw MT and OB if Exists ...
if (iOB.IsValid())
{
//
drawer.DrawBox(
iOB,
conditions.bars[zIDX].time,
false, // Draw Middle ...
true // Ignore Type ...
);
}
if (iMT.IsValid())
{
//
drawer.DrawBox(
iMT,
conditions.bars[zIDX].time,
false, // Draw Middle ...
true // Ignore Type ...
);
}
//
Print("Conditions ...");
}
@@ -1104,8 +1239,12 @@ bool DetectSignalZone(
// Cleanup Resources ...
//
iOB.Clean();
iMT.Clean();
iPeak.Clean();
iVale.Clean();
iOBBull.Clean();
iOBBear.Clean();
iMTBull.Clean();
iMTBear.Clean();
//
if (!result)