This commit is contained in:
2025-09-07 19:25:16 +03:30
parent 5987194e51
commit 4b333d7f76
4 changed files with 239 additions and 118 deletions
+1 -1
View File
@@ -543,7 +543,7 @@ class XCXOM1EAExpert : public XCBase
// Configure Indicator ...
XOM1Inputs iDZoneOMInputs;
iDZoneOMInputs.Default();
iDZoneOMInputs.showFiboZone = false;
iDZoneOMInputs.showFiboZone = true;
//
// Configure Signaller ...
+191 -68
View File
@@ -257,85 +257,209 @@ class XCXOM1SignallerBase
int p2Idx = pIdx + 1;
//
// Check New Peak or Vale Happens ...
// New Peak Under Last ...
// New Vale Over Last ...
bool isValeReason = iConditions.valeBuffer[cIdx] > iConditions.valeBuffer[pIdx];
bool isPeakReason = iConditions.peakBuffer[cIdx] < iConditions.peakBuffer[pIdx];
has = isValeReason || isPeakReason;
if (!has)
// Check Zones Flags ...
bool checkPVZones = false;
bool checkMAZones = true;
//
// Check PV Zones ...
if (checkPVZones)
{
//
iBar.Clean();
iConditions.Clean();
return;
// Check New Peak or Vale Happens ...
//
// New Vale Over Last ...
bool isValeReason = iConditions.valeBuffer[cIdx] > iConditions.valeBuffer[pIdx];
//
// New Peak Under Last ...
bool isPeakReason = iConditions.peakBuffer[cIdx] < iConditions.peakBuffer[pIdx];
//
has = isValeReason || isPeakReason;
if (has)
{
//
// Prepare Reason ...
ENUM_XOM1_ZONE_REASON iReason = isValeReason
? X_OM1_ZONE_REASON_VALE
: X_OM1_ZONE_REASON_PEAK;
//
// Extract Upper / Lower Values ...
double iUpper = iConditions.peakBuffer[pIdx];
double iLower = iConditions.valeBuffer[pIdx];
//
// Calculate Mid Range ...
double iMiddle = iLower + ((iUpper - iLower) / 2);
if (iMiddle > 0)
{
iMiddle = NormalizePrice(iMiddle, symbol);
}
//
// Detect Reason Price ...
double iPrice =
isValeReason
? iConditions.valeBuffer[cIdx]
: iConditions.peakBuffer[cIdx];
if (iPrice > 0)
{
iPrice = NormalizePrice(iPrice, symbol);
}
//
// Detect Reason Direction ...
ENUM_X_DIRECTION iDir = iPrice > iMiddle
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// Try to Initialize Zone ...
XOM1Zone iZone;
has = iZone.Init(
symbol,
period,
name, // Signaller Name ...
iUpper,
iLower,
iPrice,
iDir,
iReason,
iConditions.bars[pIdx].time, // From ...
iConditions.bars[cIdx].time // To
);
if (has)
{
//
// Add New Detected Zone to Zones ...
AddRef(
iZone,
zones //
);
}
//
iZone.Clean();
}
}
//
// Prepare Reason ...
ENUM_XOM1_ZONE_REASON iReason = isValeReason
? X_OM1_ZONE_REASON_VALE
: X_OM1_ZONE_REASON_PEAK;
//
// Extract Upper / Lower Values ...
double iUpper = iConditions.peakBuffer[pIdx];
double iLower = iConditions.valeBuffer[pIdx];
//
// Calculate Mid Range ...
double iMiddle = iLower + ((iUpper - iLower) / 2);
if (iMiddle > 0)
{
iMiddle = NormalizePrice(iMiddle, symbol);
}
//
// Detect Reason Price ...
double iPrice =
isValeReason
? iConditions.valeBuffer[cIdx]
: iConditions.peakBuffer[cIdx];
if (iPrice > 0)
{
iPrice = NormalizePrice(iPrice, symbol);
}
//
// Detect Reason Direction ...
ENUM_X_DIRECTION iDir = iPrice > iMiddle
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// Try to Initialize Zone ...
XOM1Zone iZone;
has = iZone.Init(
symbol,
period,
name, // Signaller Name ...
iUpper,
iLower,
iPrice,
iDir,
iReason,
iConditions.bars[pIdx].time, // From ...
iConditions.bars[cIdx].time // To
);
if (has)
// Check MA Zones ...
if (checkMAZones)
{
//
// Add New Detected Zone to Zones ...
AddRef(
iZone,
zones //
);
// Crossed Over ...
bool isFastCrossedOverSlow = iConditions.maFastBuffer[cIdx] > iConditions.maSlowBuffer[cIdx] &&
!(iConditions.maFastBuffer[pIdx] >= iConditions.maSlowBuffer[pIdx]);
//
// Crossed Under ...
bool isFastCrossedUnderSlow = iConditions.maFastBuffer[cIdx] < iConditions.maSlowBuffer[cIdx] &&
!(iConditions.maFastBuffer[pIdx] <= iConditions.maSlowBuffer[pIdx]);
//
double iFast = iConditions.maFastBuffer[cIdx];
double iSlow = iConditions.maSlowBuffer[cIdx];
double iFibUpper = iConditions.fiboUpperBuffer[cIdx];
double iFibLower = iConditions.fiboLowerBuffer[cIdx];
//
double iValues[] = {
iFast,
iSlow,
iFibUpper,
iFibLower //
};
//
// Extract Upper / Lower Values ...
double iUpper = GetMax(iValues);
double iLower = GetMin(iValues);
//
has = isFastCrossedOverSlow || isFastCrossedUnderSlow;
//
// Validate Cross Between Zone ...
if (has)
{
//
has = iFast >= iLower &&
iFast <= iUpper &&
iSlow >= iLower &&
iSlow <= iUpper;
}
//
if (has)
{
//
// Prepare Reason ...
ENUM_XOM1_ZONE_REASON iReason = isFastCrossedOverSlow
? X_OM1_ZONE_REASON_FCOS
: X_OM1_ZONE_REASON_FCUS;
//
// Calculate Mid Range ...
double iMiddle = iLower + ((iUpper - iLower) / 2);
if (iMiddle > 0)
{
iMiddle = NormalizePrice(iMiddle, symbol);
}
//
// Detect Reason Price ...
double iPrice = iConditions.maFastBuffer[cIdx];
if (iPrice > 0)
{
iPrice = NormalizePrice(iPrice, symbol);
}
//
// Detect Reason Direction ...
ENUM_X_DIRECTION iDir = isFastCrossedOverSlow
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// Try to Initialize Zone ...
XOM1Zone iZone;
has = iZone.Init(
symbol,
period,
name, // Signaller Name ...
iUpper,
iLower,
iPrice,
iDir,
iReason,
iConditions.bars[pIdx].time, // From ...
iConditions.bars[cIdx].time // To
);
if (has)
{
//
// Add New Detected Zone to Zones ...
AddRef(
iZone,
zones //
);
}
//
iZone.Clean();
}
//
Clean(iValues);
}
//
// Clean Resources ...
iBar.Clean();
iZone.Clean();
iConditions.Clean();
}
@@ -419,7 +543,6 @@ class XCXOM1SignallerBase
//
}
}
};
//
+14 -28
View File
@@ -32,9 +32,11 @@
// Zone Creation Reason ...
enum ENUM_XOM1_ZONE_REASON
{
X_OM1_ZONE_REASON_NONE,
X_OM1_ZONE_REASON_PEAK,
X_OM1_ZONE_REASON_VALE
X_OM1_ZONE_REASON_NONE, // NONE
X_OM1_ZONE_REASON_PEAK, // PEAK
X_OM1_ZONE_REASON_VALE, // VALE
X_OM1_ZONE_REASON_FCOS, // FCOS
X_OM1_ZONE_REASON_FCUS, // FCUS
};
/**
@@ -65,31 +67,7 @@ bool IsXValid(ENUM_XOM1_ZONE_REASON value)
*/
string ToXString(ENUM_XOM1_ZONE_REASON value)
{
//
string result = NULL;
//
if (!IsXValid(value))
{
return result;
}
//
switch (value)
{
//
case X_OM1_ZONE_REASON_PEAK:
result = "PEAK";
break;
//
case X_OM1_ZONE_REASON_VALE:
result = "VALE";
break;
}
//
return result;
return EnumToString(value);
}
/**
@@ -123,6 +101,14 @@ ENUM_XOM1_ZONE_REASON FromXString(string value)
{
result = X_OM1_ZONE_REASON_VALE;
}
else if (value == ToXString(X_OM1_ZONE_REASON_FCOS))
{
result = X_OM1_ZONE_REASON_FCOS;
}
else if (value == ToXString(X_OM1_ZONE_REASON_FCUS))
{
result = X_OM1_ZONE_REASON_FCUS;
}
//
return result;