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
@@ -0,0 +1,168 @@
// #region KI Fast ...
//
// if (kiParser.IsKIFastBullish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKIFastSwitchedToBullish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKIFastBearish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKIFastSwitchedToBearish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKIFastOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKIFastUnderLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKIFastSameAsLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKIFastSwitchedOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKIFastSwitchedUnderLast(barIndex))
// {
// DebugBreak();
// }
// #endregion
// #region KI Slow ...
//
// if (kiParser.IsKISlowBullish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISlowSwitchedToBullish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISlowBearish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISlowSwitchedToBearish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISlowOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISlowUnderLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISlowSameAsLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISlowSwitchedOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISlowSwitchedUnderLast(barIndex))
// {
// DebugBreak();
// }
// #endregion
// #region KI Super Slow ...
//
// if (kiParser.IsKISuperSlowBullish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSwitchedToBullish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowBearish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSwitchedToBearish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowUnderLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSameAsLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSwitchedOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSwitchedUnderLast(barIndex))
// {
// DebugBreak();
// }
// #endregion
File diff suppressed because it is too large Load Diff
@@ -979,6 +979,66 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
bool isBearish = false;
int barIndex = bar.Index() + 1;
//
// TEST ...
//
// if (kiParser.IsKISuperSlowBullish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSwitchedToBullish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowBearish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSwitchedToBearish(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowUnderLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSameAsLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSwitchedOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsKISuperSlowSwitchedUnderLast(barIndex))
// {
// DebugBreak();
// }
//
return false;
//
// Initialize Indexed Bar ...
XOHCL iBar;
@@ -1072,44 +1132,44 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
//
// Count Touches ...
int bullishTouches = 0;
int bearishTouches = 0;
if (result)
{
//
kiParser.CountTouches(
bullishTouches,
bearishTouches,
barIndex,
4 // Loopback ...
);
// int bullishTouches = 0;
// int bearishTouches = 0;
// if (result)
// {
// //
// kiParser.CountTouches(
// bullishTouches,
// bearishTouches,
// barIndex,
// 4 // Loopback ...
// );
//
isBullish =
isBullish &&
bullishTouches >= bearishTouches;
// //
// isBullish =
// isBullish &&
// bullishTouches >= bearishTouches;
//
isBearish =
isBearish &&
bearishTouches >= bullishTouches;
// //
// isBearish =
// isBearish &&
// bearishTouches >= bullishTouches;
//
// Summarize Result ...
result = isBullish || isBearish;
if (!result)
{
//
isBullish = false;
isBearish = false;
}
// //
// // Summarize Result ...
// result = isBullish || isBearish;
// if (!result)
// {
// //
// isBullish = false;
// isBearish = false;
// }
//
if (bullishTouches > 0 || bearishTouches > 0)
{
// DebugBreak();
}
}
// //
// if (bullishTouches > 0 || bearishTouches > 0)
// {
// // DebugBreak();
// }
// }
//
if (!result)
@@ -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 ...