This commit is contained in:
2025-10-08 18:47:29 +03:30
parent 96972931a7
commit d963ce8acf
10 changed files with 6108 additions and 3372 deletions
+268 -1
View File
@@ -908,6 +908,14 @@ class XCXFIMAHelper : public XCBaseHelper
barIndex = NormalizeInt(barIndex, 0);
validCrossDiffMultiplier = NormalizeDouble(validCrossDiffMultiplier, 0);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
double fast[];
int fastCount = CopyMAFast(barIndex, 2, fast);
@@ -1107,7 +1115,7 @@ class XCXFIMAHelper : public XCBaseHelper
//
// Validate ...
result = mHandler != INVALID_HANDLE;
result = IsValid();
if (!result)
{
return result;
@@ -1166,6 +1174,262 @@ class XCXFIMAHelper : public XCBaseHelper
return result;
}
/**
* Check Specified Bar's Price in Hot Place or Not ...
*
* @param dir: reference for holds cross Direction ...
* @param barIndex: int, Specified Bar Index ...
* @param overMaxPriceType: ENUM_X_PRICE, which price of Specified bar to Check ...
* @param underMinPriceType: ENUM_X_PRICE, which price of Specified bar to Check ...
*
* @return ( bool )
*/
bool IsInHotPlace(
ENUM_X_DIRECTION &dir,
int barIndex = 0,
ENUM_X_PRICE overMaxPriceType = X_PRICE_NONE,
ENUM_X_PRICE underMinPriceType = X_PRICE_NONE //
)
{
//
bool result = false;
//
// Prepare ...
dir = X_DIRECTION_NONE;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
if (!IsXValid(overMaxPriceType))
{
overMaxPriceType = X_PRICE_LOW;
}
if (!IsXValid(underMinPriceType))
{
underMinPriceType = X_PRICE_HIGH;
}
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
// Initialize Bar ...
XOHCL bar;
result = bar.Init(
mSymbol,
mPeriod,
barIndex);
if (!result)
{
//
bar.Clean();
return result;
}
//
double overMaxPrice = bar.GetPrice(overMaxPriceType);
double underMinPrice = bar.GetPrice(underMinPriceType);
//
// Reading Boundary Value ...
double min;
double max;
result = GetBoundaryValues(
min,
max,
barIndex //
);
if (!result)
{
//
bar.Clean();
return result;
}
//
bool isBullish = underMinPrice < min;
bool isBearish = overMaxPrice > max;
//
result = (isBullish && !isBearish) ||
(isBearish && !isBullish);
if (result)
{
//
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
}
//
// Cleanup Resources ...
bar.Clean();
//
return result;
}
bool (
ENUM_X_DIRECTION &dir,
int barIndex = 0 //
)
{
//
bool result = false;
//
// Prepare ...
dir = X_DIRECTION_NONE;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
double fast = GetMAFast(barIndex);
double slow = GetMASlow(barIndex);
//
double maBondUpper = GetMABondUpper(barIndex);
double maBondLower = GetMABondLower(barIndex);
//
double pbBondUpper = GetPBBondUpper(barIndex);
double pbBondLower = GetPBBondLower(barIndex);
//
double hkBondUpper = GetHKBondUpper(barIndex);
double hkBondLower = GetHKBondLower(barIndex);
//
result =
NotEmptyZero(fast) &&
NotEmptyZero(slow) &&
NotEmptyZero(maBondUpper) &&
NotEmptyZero(maBondLower) &&
NotEmptyZero(hkBondUpper) &&
NotEmptyZero(hkBondLower) &&
NotEmptyZero(pbBondUpper) &&
NotEmptyZero(pbBondLower);
if (!result)
{
return result;
}
//
bool isBullish =
fast > hkBondLower &&
slow > hkBondLower &&
maBondUpper > hkBondLower &&
maBondLower > hkBondLower &&
pbBondUpper > hkBondLower &&
pbBondLower > hkBondLower;
bool isBearish =
fast < hkBondUpper &&
slow < hkBondUpper &&
maBondUpper < hkBondUpper &&
maBondLower < hkBondUpper &&
pbBondUpper < hkBondUpper &&
pbBondLower < hkBondUpper;
//
result = (isBullish && !isBearish) ||
(isBearish && !isBullish);
if (result)
{
//
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
}
//
return result;
}
bool HasBoundarySwitch(
ENUM_X_DIRECTION &dir,
int barIndex = 0 //
)
{
//
bool result = false;
//
// Prepare ...
dir = X_DIRECTION_NONE;
//
// Normalize ...
barIndex = NormalizeBarIndex(barIndex);
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
result = HasBoundaryTrend(
dir,
barIndex //
);
if (!result)
{
return result;
}
bool isBullish = IsXBullish(dir);
bool isBearish = IsXBearish(dir);
//
result = HasBoundaryTrend(
dir,
barIndex + 1 //
);
if (!result)
{
return result;
}
bool isPBullish = IsXBullish(dir);
bool isPBearish = IsXBearish(dir);
//
bool isSwitchedToBullish =
isBullish && !isPBullish;
bool isSwitchedToBearish =
isBearish && !isPBearish;
result = isSwitchedToBullish ||
isSwitchedToBearish;
if (result)
{
//
dir = isSwitchedToBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
}
//
return result;
}
/**
* Check Peak Happens over Last ...
*
@@ -3101,6 +3365,9 @@ class XCXFIMAHelper : public XCBaseHelper
return result;
}
//
// Detectors ...
/**
* Detect Zones (Support / Resistance) based on XFIMA Validators ...
*