This commit is contained in:
2025-12-31 21:28:54 +03:30
parent ad945b90b2
commit a0876d5a05
12 changed files with 1789 additions and 185 deletions
@@ -907,180 +907,110 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
}
//
result = poiDetector.IsKISignal(
dir,
bar.Index() //
);
bool isBullish = result &&
IsXBullish(dir);
bool isBearish = result &&
IsXBearish(dir);
result = isBullish ||
isBearish;
if (!result)
{
return result;
}
int barIndex = bar.Index() + 1;
//
// Detect Nearest Directional ...
int nearestDirectionalSwitchIndex = -1;
if (isBullish)
{
//
isBullish = poiDetector.NearestKIFastSwitchedToBullish(
nearestDirectionalSwitchIndex,
bar.Index() + 2 //
);
}
else
{
//
isBearish = poiDetector.NearestKIFastSwitchedToBearish(
nearestDirectionalSwitchIndex,
bar.Index() + 2 //
);
}
result =
IsValidIndex(nearestDirectionalSwitchIndex) &&
(isBullish ||
isBearish);
if (!result)
{
//
bar.Clean();
return result;
}
// Safe for Entry ...
bool isSafe = false;
bool isSafeForBullishEntry = kiParser.IsSafeBullishEntry(barIndex);
bool isSafeForBearishEntry = kiParser.IsSafeBearishEntry(barIndex);
//
// Preparing Zone ...
double upper = bar.FindHighest(nearestDirectionalSwitchIndex - bar.Index(), MODE_HIGH);
double lower = bar.FindLowest(nearestDirectionalSwitchIndex - bar.Index(), MODE_LOW);
//
result = zone.Init(
symbol,
period,
upper,
lower,
GetBarTime(symbol, period, nearestDirectionalSwitchIndex),
bar.time,
dir,
"XKI1" //
);
//
// Support and Resistance ...
XBoxZone support;
XBoxZone resistance;
if (result)
// POI ...
bool isPOI = poiDetector.IsPOI(dir, barIndex);
bool isBullishPOI = isPOI &&
IsXBullish(dir);
bool isBearishPOI = isPOI &&
IsXBearish(dir);
isSafe = (isBullishPOI && isSafeForBullishEntry) ||
(isBearishPOI && isSafeForBearishEntry);
if (isPOI && isSafe)
{
//
XOHCL tmpBar;
int tmpIDX = -1;
bool has = false;
double upper = 0;
double lower = 0;
int length = zone.GetAge();
//
// Support ...
tmpIDX = bar.FindLowestIndex(length, MODE_LOW);
if (IsValidIndex(tmpIDX))
{
//
if (tmpBar.Init(symbol, period, tmpIDX))
{
//
lower = iLow(symbol, period, tmpIDX);
upper = bar.FindLowest(length, MODE_CLOSE);
if (upper <= lower)
{
upper = tmpBar.GetDown();
}
//
has = support.Init(
symbol,
period,
upper,
lower,
tmpBar.time,
bar.time,
X_DIRECTION_BULLISH,
X_BAR_PATTERN_SUPPORT //
);
//
tmpBar.Clean();
}
}
//
// Resistance ...
tmpIDX = bar.FindHighestIndex(length, MODE_HIGH);
if (IsValidIndex(tmpIDX))
{
//
if (tmpBar.Init(symbol, period, tmpIDX))
{
//
upper = iHigh(symbol, period, tmpIDX);
lower = bar.FindHighest(length, MODE_CLOSE);
if (upper <= lower)
{
upper = tmpBar.GetUp();
}
//
has = resistance.Init(
symbol,
period,
upper,
lower,
tmpBar.time,
bar.time,
X_DIRECTION_BEARISH,
X_BAR_PATTERN_RESISTANCE //
);
//
tmpBar.Clean();
}
}
}
//
// TODO: Rempve ...
if (result)
{
//
// Other Drawing Materials ...
XPOIDrawConfig drawConfig;
drawConfig.Default();
//
poiDrawer.DrawZone(zone, drawConfig);
//
if (support.IsValid())
{
poiDrawer.DrawZone(support, drawConfig);
}
//
if (resistance.IsValid())
{
poiDrawer.DrawZone(resistance, drawConfig);
}
//
drawConfig.Clean();
//
// Print("isPOI: ", ToXString(dir));
// DebugBreak();
}
//
// Breakout POI ...
bool isBreakoutPOI = poiDetector.IsBreakoutPOI(dir, barIndex);
bool isBullishBreakoutPOI = isBreakoutPOI &&
IsXBullish(dir);
bool isBearishBreakoutPOI = isBreakoutPOI &&
IsXBearish(dir);
isSafe = (isBullishBreakoutPOI && isSafeForBullishEntry) ||
(isBearishBreakoutPOI && isSafeForBearishEntry);
if (isBreakoutPOI && isSafe)
{
//
// Print("isBreakoutPOI: ", ToXString(dir));
// DebugBreak();
}
//
// Reversal POI ...
bool isReversalPOI = poiDetector.IsReversalPOI(dir, barIndex);
bool isBullishReversalPOI = isReversalPOI &&
IsXBullish(dir);
bool isBearishReversalPOI = isReversalPOI &&
IsXBearish(dir);
isSafe = (isBullishReversalPOI && isSafeForBullishEntry) ||
(isBearishReversalPOI && isSafeForBearishEntry);
if (isReversalPOI && isSafe)
{
//
Print("isReversalPOI: ", ToXString(dir));
DebugBreak();
}
//
// Continuation POI ...
bool isContinuationPOI = poiDetector.IsContinuationPOI(dir, barIndex);
bool isBullishContinuationPOI = isContinuationPOI &&
IsXBullish(dir);
bool isBearishContinuationPOI = isContinuationPOI &&
IsXBearish(dir);
isSafe = (isBullishContinuationPOI && isSafeForBullishEntry) ||
(isBearishContinuationPOI && isSafeForBearishEntry);
if (isContinuationPOI && isSafe)
{
//
// Print("isContinuationPOI: ", ToXString(dir));
// DebugBreak();
}
//
// Exhaustion POI ...
bool isExhaustionPOI = poiDetector.IsExhaustionPOI(dir, barIndex);
bool isBullishExhaustionPOI = isExhaustionPOI &&
IsXBullish(dir);
bool isBearishExhaustionPOI = isExhaustionPOI &&
IsXBearish(dir);
isSafe = (isBullishExhaustionPOI && isSafeForBullishEntry) ||
(isBearishExhaustionPOI && isSafeForBearishEntry);
if (isExhaustionPOI && isSafe)
{
//
Print("isExhaustionPOI: ", ToXString(dir));
DebugBreak();
}
//
// TrendExhausted POI ...
bool isTrendExhaustedPOI = poiDetector.IsTrendExhaustedPOI(dir, barIndex);
bool isBullishTrendExhaustedPOI = isTrendExhaustedPOI &&
IsXBullish(dir);
bool isBearishTrendExhaustedPOI = isTrendExhaustedPOI &&
IsXBearish(dir);
isSafe = (isBullishTrendExhaustedPOI && isSafeForBullishEntry) ||
(isBearishTrendExhaustedPOI && isSafeForBearishEntry);
if (isTrendExhaustedPOI && isSafe)
{
//
Print("isTrendExhaustedPOI: ", ToXString(dir));
DebugBreak();
}
//
result =
result &&