This commit is contained in:
2025-10-19 01:00:24 +03:30
parent d24610c47b
commit ba492bf205
4 changed files with 330 additions and 16 deletions
@@ -406,11 +406,26 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
//
// Strategy 3 ...
if (!has)
{
//
// has = Strategy3HasSignal(
// iBar,
// iZone,
// iTargets,
// iDir,
// iFIMAConditions,
// structure //
// );
}
//
// Strategy 4 ...
has = false;
if (!has)
{
//
has = Strategy3HasSignal(
has = Strategy4HasSignal(
iBar,
iZone,
iTargets,
@@ -423,13 +438,13 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
//
has = HasDirection(iDir) &&
iZone.IsValid();
// if (has)
// {
// //
// has = false;
// iZone.Clean();
// iDir = X_DIRECTION_NONE;
// }
if (has)
{
//
has = false;
iZone.Clean();
iDir = X_DIRECTION_NONE;
}
//
if (has)
@@ -1478,6 +1493,164 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
return result;
}
/**
* Check Bar Has Signal Based on Strategy 4 ...
*
* @param bar: XOHCL, reference to Bar ...
* @param zone: XBoxZone, reference to holds affected zone ...
* @param targets: XTarget, reference to detected Signal's Targets collections ...
* @param dir: ENUM_X_DIRECTION, detected Signal's direction ...
* @param conditions: XFIMAConditions, reference to Bar Specified XFIMA Conditions ...
* @param structure: XFIMAMarketStructure, refrence to Provides Market Structure ...
*
* @return ( bool )
*/
bool Strategy4HasSignal(
XOHCL &bar,
XBoxZone &zone,
XTarget &targets[],
ENUM_X_DIRECTION &dir,
XFIMAConditions &conditions,
XFIMAMarketStructure &_structure //
)
{
//
bool result = false;
//
// Prepare ...
zone.Clean();
XClean(targets);
dir = X_DIRECTION_NONE;
//
// Validate ...
result = bar.IsValid();
if (!result)
{
return result;
}
//
// Define Requirements ...
bool isBullish = false;
bool isBearish = false;
//
XOHCL pBar;
int barIndex = bar.Index();
int pBarIndex = barIndex + 1;
result = bar.GetPreviousBar(pBar);
if (!result)
{
return result;
}
//
// Do Conditions Checking ...
//
// Reading HK Bond ...
double hkBondUpper = fimaHelper.GetHKBondUpper(pBarIndex);
double hkBondLower = fimaHelper.GetHKBondLower(pBarIndex);
bool hasHKBoundary =
NotEmptyZero(hkBondUpper) &&
NotEmptyZero(hkBondLower);
//
// Pullback Detection ...
bool isPullback = poiDetector.IsPullbackPattern(
pBar,
zone,
dir,
2,
false //
);
//
isBullish =
isPullback &&
hasHKBoundary &&
IsXBullish(dir) &&
zone.lower > hkBondLower;
//
isBearish =
isPullback &&
hasHKBoundary &&
IsXBearish(dir) &&
zone.upper < hkBondUpper;
//
result =
isBullish ||
isBearish;
//
// Do Validations ...
if (result)
{
//
// Direction Assignment ...
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// TEMP ...
poiDrawer.DrawZone(
zone,
structureDrawConfig.drawConfig //
);
}
//
// Prepare Decision Zone ...
if (result)
{
//
// Zone Detection ...
zone.Clean();
//
// zone.dir = dir;
// zone.type = name;
// zone.to = bar.time;
// zone.at = pBar.time;
// zone.from = pBar.time;
// zone.symbol = bar.symbol;
// zone.period = bar.period;
// zone.lower = MathMin(pBar.low, bar.low);
// zone.upper = MathMax(pBar.high, bar.high);
//
result = zone.IsValid();
}
//
// Prepare Targets ...
if (result)
{
//
// Target Handling ...
}
//
// Cleanup ...
if (!result)
{
//
zone.Clean();
XClean(targets);
dir = X_DIRECTION_NONE;
}
pBar.Clean();
//
return result;
}
//
};