last works ...

This commit is contained in:
2026-01-07 19:53:22 +03:30
parent 31232dffef
commit 2fe1037ea5
10 changed files with 4945 additions and 2371 deletions
@@ -1547,7 +1547,851 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
// #endregion
// #region Switches ...
// TODO: Implement Switches Checkers in Loopback ...
int HasKIFastSwitch(
XDirectionShift &switches[],
int barIndex = 0,
int loopback = 10,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
XClean(switches);
//
loopback = NormalizeInt(loopback, 2);
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
//
bool has = false;
XDirectionShift iShift;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
// Bullish ...
bool hasBullish = kiParser.IsKIFastSwitchedToBullish(i);
has = hasBullish && isBullish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_FAST),
GetBarTime(symbol, period, i),
kiHelper.GetKIFast(i),
kiHelper.GetKIFast(i + 1),
symbol,
period,
X_DIRECTION_BULLISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
//
// Bearish ...
bool hasBearish = kiParser.IsKIFastSwitchedToBearish(i);
has = hasBearish && isBearish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_FAST),
GetBarTime(symbol, period, i),
kiHelper.GetKIFast(i),
kiHelper.GetKIFast(i + 1),
symbol,
period,
X_DIRECTION_BEARISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
}
//
result = ArraySize(switches);
//
return result;
}
int HasKISlowSwitch(
XDirectionShift &switches[],
int barIndex = 0,
int loopback = 10,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
XClean(switches);
//
loopback = NormalizeInt(loopback, 2);
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
//
bool has = false;
XDirectionShift iShift;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
// Bullish ...
bool hasBullish = kiParser.IsKISlowSwitchedToBullish(i);
has = hasBullish && isBullish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_SLOW),
GetBarTime(symbol, period, i),
kiHelper.GetKISlow(i),
kiHelper.GetKISlow(i + 1),
symbol,
period,
X_DIRECTION_BULLISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
//
// Bearish ...
bool hasBearish = kiParser.IsKISlowSwitchedToBearish(i);
has = hasBearish && isBearish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_SLOW),
GetBarTime(symbol, period, i),
kiHelper.GetKIFast(i),
kiHelper.GetKIFast(i + 1),
symbol,
period,
X_DIRECTION_BEARISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
}
//
result = ArraySize(switches);
//
return result;
}
int HasKISuperSlowSwitch(
XDirectionShift &switches[],
int barIndex = 0,
int loopback = 10,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
XClean(switches);
//
loopback = NormalizeInt(loopback, 2);
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
//
bool has = false;
XDirectionShift iShift;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
// Bullish ...
bool hasBullish = kiParser.IsKISuperSlowSwitchedToBullish(i);
has = hasBullish && isBullish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_SUPER_SLOW),
GetBarTime(symbol, period, i),
kiHelper.GetKISuperSlow(i),
kiHelper.GetKISuperSlow(i + 1),
symbol,
period,
X_DIRECTION_BULLISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
//
// Bearish ...
bool hasBearish = kiParser.IsKISuperSlowSwitchedToBearish(i);
has = hasBearish && isBearish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_SUPER_SLOW),
GetBarTime(symbol, period, i),
kiHelper.GetKIFast(i),
kiHelper.GetKIFast(i + 1),
symbol,
period,
X_DIRECTION_BEARISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
}
//
result = ArraySize(switches);
//
return result;
}
int HasKIWaveSwitch(
XDirectionShift &switches[],
int barIndex = 0,
int loopback = 10,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
XClean(switches);
//
loopback = NormalizeInt(loopback, 2);
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
//
bool has = false;
XDirectionShift iShift;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
// Bullish ...
bool hasBullish = kiParser.IsKIWaveSwitchedToBullish(i);
has = hasBullish && isBullish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_WAVE),
GetBarTime(symbol, period, i),
kiHelper.GetKIWave(i),
kiHelper.GetKIWave(i + 1),
symbol,
period,
X_DIRECTION_BULLISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
//
// Bearish ...
bool hasBearish = kiParser.IsKIWaveSwitchedToBearish(i);
has = hasBearish && isBearish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_WAVE),
GetBarTime(symbol, period, i),
kiHelper.GetKIWave(i),
kiHelper.GetKIWave(i + 1),
symbol,
period,
X_DIRECTION_BEARISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
}
//
result = ArraySize(switches);
//
return result;
}
int HasMAFastSwitch(
XDirectionShift &switches[],
int barIndex = 0,
int loopback = 10,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
XClean(switches);
//
loopback = NormalizeInt(loopback, 2);
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
//
bool has = false;
XDirectionShift iShift;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
// Bullish ...
bool hasBullish = kiParser.IsMAFastSwitchedToBullish(i);
has = hasBullish && isBullish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_MA_FAST),
GetBarTime(symbol, period, i),
kiHelper.GetMAFast(i),
kiHelper.GetMAFast(i + 1),
symbol,
period,
X_DIRECTION_BULLISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
//
// Bearish ...
bool hasBearish = kiParser.IsMAFastSwitchedToBearish(i);
has = hasBearish && isBearish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_MA_FAST),
GetBarTime(symbol, period, i),
kiHelper.GetMAFast(i),
kiHelper.GetMAFast(i + 1),
symbol,
period,
X_DIRECTION_BEARISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
}
//
result = ArraySize(switches);
//
return result;
}
int HasMASlowSwitch(
XDirectionShift &switches[],
int barIndex = 0,
int loopback = 10,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
XClean(switches);
//
loopback = NormalizeInt(loopback, 2);
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
//
bool has = false;
XDirectionShift iShift;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
// Bullish ...
bool hasBullish = kiParser.IsMASlowSwitchedToBullish(i);
has = hasBullish && isBullish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_MA_SLOW),
GetBarTime(symbol, period, i),
kiHelper.GetMASlow(i),
kiHelper.GetMASlow(i + 1),
symbol,
period,
X_DIRECTION_BULLISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
//
// Bearish ...
bool hasBearish = kiParser.IsMASlowSwitchedToBearish(i);
has = hasBearish && isBearish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_MA_SLOW),
GetBarTime(symbol, period, i),
kiHelper.GetMAFast(i),
kiHelper.GetMAFast(i + 1),
symbol,
period,
X_DIRECTION_BEARISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
}
//
result = ArraySize(switches);
//
return result;
}
int HasMASuperSlowSwitch(
XDirectionShift &switches[],
int barIndex = 0,
int loopback = 10,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
XClean(switches);
//
loopback = NormalizeInt(loopback, 2);
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
//
bool has = false;
XDirectionShift iShift;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
// Bullish ...
bool hasBullish = kiParser.IsMASuperSlowSwitchedToBullish(i);
has = hasBullish && isBullish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_MA_SUPER_SLOW),
GetBarTime(symbol, period, i),
kiHelper.GetMASuperSlow(i),
kiHelper.GetMASuperSlow(i + 1),
symbol,
period,
X_DIRECTION_BULLISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
//
// Bearish ...
bool hasBearish = kiParser.IsMASuperSlowSwitchedToBearish(i);
has = hasBearish && isBearish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_MA_SUPER_SLOW),
GetBarTime(symbol, period, i),
kiHelper.GetMAFast(i),
kiHelper.GetMAFast(i + 1),
symbol,
period,
X_DIRECTION_BEARISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
}
//
result = ArraySize(switches);
//
return result;
}
int HasMACrossedSwitch(
XDirectionShift &switches[],
int barIndex = 0,
int loopback = 10,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
XClean(switches);
//
loopback = NormalizeInt(loopback, 2);
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
//
bool has = false;
XDirectionShift iShift;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
// Bullish ...
bool hasBullish = kiParser.IsMACrossoverSwitchedToBullish(i);
has = hasBullish && isBullish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_MA_CROSS),
GetBarTime(symbol, period, i),
MathMin(kiHelper.GetMAFast(i), kiHelper.GetMASlow(i)),
MathMin(kiHelper.GetMAFast(i + 1), kiHelper.GetMASlow(i + 1)),
symbol,
period,
X_DIRECTION_BULLISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
//
// Bearish ...
bool hasBearish = kiParser.IsMACrossoverSwitchedToBearish(i);
has = hasBearish && isBearish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_MA_CROSS),
GetBarTime(symbol, period, i),
MathMin(kiHelper.GetMAFast(i), kiHelper.GetMASlow(i)),
MathMin(kiHelper.GetMAFast(i + 1), kiHelper.GetMASlow(i + 1)),
symbol,
period,
X_DIRECTION_BEARISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
}
//
result = ArraySize(switches);
//
return result;
}
int HasATRVolatilitySwitch(
XDirectionShift &switches[],
int barIndex = 0,
int loopback = 10,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
XClean(switches);
//
loopback = NormalizeInt(loopback, 2);
barIndex = kiParser.NormalizeBarIndex(barIndex);
//
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
//
bool has = false;
XDirectionShift iShift;
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
// Bullish ...
bool hasBullish = kiParser.IsVolatilitySwitchdToHigh(i);
has = hasBullish && isBullish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_ATR),
GetBarTime(symbol, period, i),
kiHelper.GetATR(i),
kiHelper.GetATR(i + 1),
symbol,
period,
X_DIRECTION_BULLISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
//
// Bearish ...
bool hasBearish = kiParser.IsVolatilitySwitchdToLow(i);
has = hasBearish && isBearish;
if (has)
{
//
iShift.Clean();
has = iShift.Init(
ToXString(X121_XKI_ATR),
GetBarTime(symbol, period, i),
kiHelper.GetATR(i),
kiHelper.GetATR(i + 1),
symbol,
period,
X_DIRECTION_BEARISH //
);
if (has)
{
//
AddIfNotExists(
iShift,
switches //
);
//
iShift.Clean();
}
}
}
//
result = ArraySize(switches);
//
return result;
}
// #endregion
// #region Peak and Vale ...