This commit is contained in:
2026-01-08 18:44:19 +03:30
parent 649cef249f
commit 5c7c5f288d
8 changed files with 2073 additions and 527 deletions
+65 -1
View File
@@ -2124,4 +2124,68 @@ bool Strategy1HasSignal(
{
DebugBreak();
}
}
}
int CountSameVales(
int barIndex = 0,
int loopback = 10 //
)
{
//
int result = 0;
//
if (!IsValid())
{
return result;
}
//
loopback = NormalizeInt(loopback, 2);
barIndex = NormalizeBarIndex(barIndex);
//
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
if (IsValeSameAsLast(i))
{
result++;
}
}
//
return result;
}
int CountSamePeaks(
int barIndex = 0,
int loopback = 10 //
)
{
//
int result = 0;
//
if (!IsValid())
{
return result;
}
//
loopback = NormalizeInt(loopback, 2);
barIndex = NormalizeBarIndex(barIndex);
//
for (int i = barIndex; i < barIndex + loopback; i++)
{
//
if (IsPeakSameAsLast(i))
{
result++;
}
}
//
return result;
}
+151 -73
View File
@@ -14,15 +14,6 @@
"id": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73",
"title": "Doing",
"cards": [
{
"id": "a59a73f4-1ab4-477b-893e-b2dfb71fe6ea",
"listId": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73",
"title": "Add Support for PV in XKI Indicator.",
"description": "",
"labels": [],
"checkboxes": [],
"comments": []
},
{
"id": "f8eb6951-f337-40da-9b98-e468f77709fd",
"listId": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73",
@@ -58,8 +49,23 @@
"comments": []
},
{
"id": "bcb422f9-89db-4816-ba3a-bae95c9c8da4",
"id": "ab436301-ddac-4e19-97e6-935986e0316b",
"listId": "6f8db3d6-fcaa-4522-bee5-0e3e38c96e73",
"title": "Add Composite Semantic Conditions ...",
"description": "here we complete all stand alone semantic conditions ...\nbut for now we have to add some Composite Conditions ...",
"labels": [],
"checkboxes": [],
"comments": []
}
]
},
{
"id": "c6b07a7f-d2e7-4f67-a5a9-0d93cd8bf981",
"title": "Test",
"cards": [
{
"id": "bcb422f9-89db-4816-ba3a-bae95c9c8da4",
"listId": "c6b07a7f-d2e7-4f67-a5a9-0d93cd8bf981",
"title": "Test all XKI Helper Functions",
"description": "Test all KI Parser Conditional Tools ...\n ",
"labels": [],
@@ -457,112 +463,184 @@
{
"id": "dd69c2c0-c999-4235-8cb5-74607b27c7ec",
"title": "IsATRBreakoutUp",
"checked": false
"checked": true
},
{
"id": "1a77e8e1-b3e8-48b4-b072-1cda3a69c6f9",
"title": "IsATRBreakoutDown",
"checked": false
"checked": true
},
{
"id": "bfeb3c24-f0ed-4aed-99af-bec8db026a62",
"title": "IsATROverLast",
"checked": false
},
{
"id": "62881e04-9b38-49e4-ae9d-e5161c1b0b5c",
"title": "IsATRUnderLast",
"checked": false
"checked": true
},
{
"id": "33ec5ba0-d31a-4602-ba79-7d3b4d9d7986",
"title": "IsATRSwitchedOverLast",
"checked": false
"checked": true
},
{
"id": "62881e04-9b38-49e4-ae9d-e5161c1b0b5c",
"title": "IsATRUnderLast",
"checked": true
},
{
"id": "cf0fb674-8dfc-4ed1-b1dd-5a8447d818a4",
"title": "IsATRSwitchedUnderLast",
"checked": false
"checked": true
},
{
"id": "efaca1b4-aa77-4809-b3ad-6a3962da8c40",
"title": "IsATRSmoothedOverLast",
"checked": true
},
{
"id": "5778c239-bf3a-40f1-88f5-9073c77d5b33",
"title": "IsATRSmoothedSwitchedOverLast",
"checked": true
},
{
"id": "d9f2be28-df91-4317-b5bb-227edcd0be7d",
"title": "IsATRSmoothedUnderLast",
"checked": true
},
{
"id": "d26df086-8d93-4d3a-abbc-64c59efd564c",
"title": "IsATRSmoothedSwitchedUnderLast",
"checked": true
},
{
"id": "ab07c8e5-454c-4c9b-a69d-fa2e8330a2e0",
"title": "IsVolatilityHigh",
"checked": false
},
{
"id": "031521be-0062-4d07-ade4-ff17782888c7",
"title": "IsVolatilityLow",
"checked": false
"checked": true
},
{
"id": "49376783-45aa-4a57-a304-3547babf0ccd",
"title": "IsVolatilitySwitchdToHigh",
"checked": false
"checked": true
},
{
"id": "031521be-0062-4d07-ade4-ff17782888c7",
"title": "IsVolatilityLow",
"checked": true
},
{
"id": "5803601b-9143-471d-968f-59622d37b70a",
"title": "IsVolatilitySwitchdToLow",
"checked": false
"checked": true
},
{
"id": "0ab99ddc-75b8-45c7-9140-8cd3dc6921c6",
"title": "IsRSIBullish",
"checked": false
},
{
"id": "ba39f76c-2257-48fe-94ca-addf2148ee23",
"title": "IsRSIBearish",
"checked": false
},
{
"id": "91c098b3-56d8-4728-b411-edf7e42d60b0",
"title": "IsRSIOverbought",
"checked": false
},
{
"id": "7917431d-9bc9-4514-8aea-7fae7c11b0de",
"title": "IsRSIOversold",
"checked": false
},
{
"id": "83d4b28b-fe6c-411c-a209-c57e3c8251d0",
"title": "IsRSISwitchedToOverSold",
"checked": false
},
{
"id": "96493d94-9db6-49de-a7f1-e3990b9469b8",
"title": "IsRSISwitchedFromOverSold",
"checked": false
},
{
"id": "02579268-284f-40f3-93c9-0cb3f70d103a",
"title": "IsRSISwitchedToOverbought",
"checked": false
},
{
"id": "6c473b2e-1b37-44b2-a08c-ce6217d0c00e",
"title": "IsRSISwitchedFromOverbought",
"checked": false
"checked": true
},
{
"id": "30177c7a-47df-4d90-8132-0f467ebc071c",
"title": "IsRSISwitchedToBullish",
"checked": false
"checked": true
},
{
"id": "ba39f76c-2257-48fe-94ca-addf2148ee23",
"title": "IsRSIBearish",
"checked": true
},
{
"id": "a3e07f9c-72da-49b4-8101-f742644a2b81",
"title": "IsRSISwitchedToBearish",
"checked": false
"checked": true
},
{
"id": "8b8675aa-a27d-4640-9a72-75d79ba3be31",
"title": "IsRSIRising",
"checked": true
},
{
"id": "83b917ce-6296-4fac-80e9-4bb60d5e7b0c",
"title": "IsRSISwitchedToRising",
"checked": true
},
{
"id": "d6321889-78ef-46b3-a68e-6fb3dc1bbb2b",
"title": "IsRSIFalling",
"checked": true
},
{
"id": "84ea179e-0d13-4481-8ffd-03400f89cacf",
"title": "IsRSISwitchedToFalling",
"checked": true
},
{
"id": "a2765ea8-3383-4c54-8d3a-2ede0c5dd204",
"title": "IsRSIOverLast",
"checked": true
},
{
"id": "87ffaa2a-9dd8-41b3-9f98-7d9cbc30c64d",
"title": "IsRSISwitchedOverLast",
"checked": true
},
{
"id": "b5f59e63-2841-413c-a2f9-1940db5fa3c1",
"title": "IsRSIUnderLast",
"checked": true
},
{
"id": "feedbb53-61ad-4717-bf2d-07daf9d51ec4",
"title": "IsRSISwitchedUnderLast",
"checked": true
},
{
"id": "91c098b3-56d8-4728-b411-edf7e42d60b0",
"title": "IsRSIOverbought",
"checked": true
},
{
"id": "02579268-284f-40f3-93c9-0cb3f70d103a",
"title": "IsRSISwitchedToOverbought",
"checked": true
},
{
"id": "6c473b2e-1b37-44b2-a08c-ce6217d0c00e",
"title": "IsRSISwitchedFromOverbought",
"checked": true
},
{
"id": "7917431d-9bc9-4514-8aea-7fae7c11b0de",
"title": "IsRSIOversold",
"checked": true
},
{
"id": "83d4b28b-fe6c-411c-a209-c57e3c8251d0",
"title": "IsRSISwitchedToOversold",
"checked": true
},
{
"id": "96493d94-9db6-49de-a7f1-e3990b9469b8",
"title": "IsRSISwitchedFromOversold",
"checked": true
}
],
"comments": []
}
]
},
{
"id": "c6b07a7f-d2e7-4f67-a5a9-0d93cd8bf981",
"title": "Test",
"cards": [
},
{
"id": "a59a73f4-1ab4-477b-893e-b2dfb71fe6ea",
"listId": "c6b07a7f-d2e7-4f67-a5a9-0d93cd8bf981",
"title": "Add Support for PV in XKI Indicator.",
"description": "",
"labels": [],
"checkboxes": [],
"comments": []
},
{
"id": "73b1de13-b615-4747-bd28-4f826a6a9239",
"listId": "c6b07a7f-d2e7-4f67-a5a9-0d93cd8bf981",
"title": "Adding Support for RSI Smoothing ...",
"description": "",
"labels": [],
"checkboxes": [],
"comments": []
},
{
"id": "128af636-5cd8-4311-a565-e822ba380d59",
"listId": "c6b07a7f-d2e7-4f67-a5a9-0d93cd8bf981",
+47
View File
@@ -204,6 +204,7 @@ enum ENUM_X121_XKI_BUFFERS
//
// RSI ...
X121_XKI_RSI_LINE = 19,
X121_XKI_RSI_SMOOTHED_LINE = 25,
};
// #endregion
@@ -224,6 +225,8 @@ struct X121XKIInputs
ENUM_APPLIED_PRICE rsiAppliedTo; // RSI Applied To
double rsiBullishConfirmation; // RSI Bullish Confirmation Level
double rsiBearishConfirmation; // RSI Bearish Confirmation Level
int rsiSmoothingLength; // RSI Smoothing Length
ENUM_X_MA_METHOD rsiSmoothingMode; // RSI Smoothing Method
int kiWaveSmoothingLength; // RSI KI Wave Smoothing Length
ENUM_X_MA_METHOD kiWaveSmoothingMode; // RSI KI Wave Smoothing Method
double rsiMultiplier; // RSI Multiplier
@@ -289,6 +292,8 @@ struct X121XKIInputs
rsiAppliedTo = PRICE_CLOSE;
rsiBullishConfirmation = 55;
rsiBearishConfirmation = 45;
rsiSmoothingLength = 14;
rsiSmoothingMode = X_MA_MODE_EMA;
kiWaveSmoothingLength = 14;
kiWaveSmoothingMode = X_MA_MODE_EMA;
rsiMultiplier = 0.5;
@@ -415,6 +420,7 @@ struct X121XKIConditions
double atrRawUpperBuffer[];
double atrRawLowerBuffer[];
double rsiBuffer[];
double rsiSmoothedBuffer[];
double kiWaveRawBuffer[];
double kiWaveStateBuffer[];
// #endregion
@@ -467,6 +473,7 @@ struct X121XKIConditions
XClean(atrRawUpperBuffer);
XClean(atrRawLowerBuffer);
XClean(rsiBuffer);
XClean(rsiSmoothedBuffer);
XClean(kiWaveRawBuffer);
XClean(kiWaveStateBuffer);
@@ -494,6 +501,7 @@ struct X121XKIConditions
ArraySetAsSeries(atrRawUpperBuffer, true);
ArraySetAsSeries(atrRawLowerBuffer, true);
ArraySetAsSeries(rsiBuffer, true);
ArraySetAsSeries(rsiSmoothedBuffer, true);
ArraySetAsSeries(kiWaveRawBuffer, true);
ArraySetAsSeries(kiWaveStateBuffer, true);
@@ -575,6 +583,8 @@ class XCX121XKIHelper : public XCBaseHelper
mInputs.rsiAppliedTo,
mInputs.rsiBullishConfirmation,
mInputs.rsiBearishConfirmation,
mInputs.rsiSmoothingLength,
mInputs.rsiSmoothingMode,
mInputs.kiWaveSmoothingLength,
mInputs.kiWaveSmoothingMode,
mInputs.rsiMultiplier,
@@ -787,6 +797,11 @@ class XCX121XKIHelper : public XCBaseHelper
loopback,
conditions.rsiBuffer //
);
CopyRSISmoothed(
zIndex,
loopback,
conditions.rsiSmoothedBuffer //
);
CopyATR(
zIndex,
loopback,
@@ -1487,6 +1502,38 @@ class XCX121XKIHelper : public XCBaseHelper
}
// #endregion
// #region RSI Smoothed ...
//
double GetRSISmoothed(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)X121_XKI_RSI_SMOOTHED_LINE,
barIndex //
);
}
//
int CopyRSISmoothed(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)X121_XKI_RSI_SMOOTHED_LINE,
start,
count,
asSeries //
);
}
// #endregion
// #region ATR ...
//
double GetATR(
+39 -2
View File
@@ -45,6 +45,8 @@ input int rsiLength = 14; // RSI Length
input ENUM_APPLIED_PRICE rsiAppliedTo = PRICE_CLOSE; // RSI Applied To
input double rsiBullishConfirmation = 55; // RSI Bullish Confirmation Level
input double rsiBearishConfirmation = 45; // RSI Bearish Confirmation Level
input int rsiSmoothingLength = 14; // RSI Smoothing Length
input ENUM_X_MA_METHOD rsiSmoothingMode = X_MA_MODE_EMA; // RSI Smoothing Method
input int kiWaveSmoothingLength = 14; // RSI KI Wave Smoothing Length
input ENUM_X_MA_METHOD kiWaveSmoothingMode = X_MA_MODE_EMA; // RSI KI Wave Smoothing Method
input double rsiMultiplier = 0.5; // RSI Multiplier
@@ -98,7 +100,7 @@ input int valeArrowCode = 159; // Vales Arrow Code
#property indicator_chart_window
//
#property indicator_buffers 25
#property indicator_buffers 26
#property indicator_plots 11
// #region Plot Buffers ...
@@ -318,6 +320,10 @@ double atrSmoothedBuffer[];
//
#define kiSuperSlowStateBufferIndex mLastBufferIndex + 10
double kiSuperSlowStateBuffer[];
//
#define rsiSmoothedBufferIndex mLastBufferIndex + 11
double rsiSmoothedBuffer[];
// #endregion
// #endregion
@@ -660,6 +666,10 @@ int ExtractMaxLengthOfInputs()
result = MathMax(result, kiSuperSlowLength);
//
if (rsiSmoothingLength > 0)
{
result = MathMax(result, rsiSmoothingLength);
}
if (atrSmoothingLength > 0)
{
result = MathMax(result, atrSmoothingLength);
@@ -779,6 +789,10 @@ void DefineBuffers()
ArraySetAsSeries(rsiBuffer, true);
SetIndexBuffer(rsiBufferIndex, rsiBuffer, INDICATOR_CALCULATIONS);
//
ArraySetAsSeries(rsiSmoothedBuffer, true);
SetIndexBuffer(rsiSmoothedBufferIndex, rsiSmoothedBuffer, INDICATOR_CALCULATIONS);
//
ArraySetAsSeries(kiWaveRawBuffer, true);
SetIndexBuffer(kiWaveRawBufferIndex, kiWaveRawBuffer, INDICATOR_CALCULATIONS);
@@ -1728,7 +1742,7 @@ void CalculateRSI(
kiWaveStateBuffer[barIndex] = iState;
//
// Check Can Smooth Atr ...
// Check Can Smooth KI Wave ...
if (IsXValid(kiWaveSmoothingMode) &&
kiWaveSmoothingLength > 0)
{
@@ -1749,5 +1763,28 @@ void CalculateRSI(
//
kiWaveBuffer[barIndex] = iValue;
}
//
// Check Can Smooth RSI ...
if (IsXValid(rsiSmoothingMode) &&
rsiSmoothingLength > 0)
{
//
// Ki Wave ...
iMAOnBuffer(
ratesTotal,
prevCalculated,
barIndex,
rsiSmoothingLength,
rsiBuffer,
rsiSmoothedBuffer,
rsiSmoothingMode //
);
}
else
{
//
rsiSmoothedBuffer[barIndex] = iRsi;
}
}
// #endregion
@@ -412,6 +412,14 @@ double NormalizeDouble(
//
return value;
}
double NormalizeXDouble(
double value,
double min = 0,
double max = DBL_MAX //
)
{
return NormalizeDouble(value, min, max);
}
/**
* Normalize Index based on Collection ...
@@ -5287,6 +5295,53 @@ void AddsIfNotExists(
// START Buffers ...
//
bool IsSame(
double current,
double previous,
double tolerance = 2 //
)
{
//
bool result =
NotEmptyZero(current) &&
NotEmptyZero(previous) &&
current <= previous + tolerance &&
current >= previous + tolerance;
//
return result;
}
bool IsOver(
double current,
double previous,
double tolerance = 2 //
) {
//
bool result =
NotEmptyZero(current) &&
NotEmptyZero(previous) &&
current >= previous + tolerance;
//
return result;
}
bool IsUnder(
double current,
double previous,
double tolerance = 2 //
) {
//
bool result =
NotEmptyZero(current) &&
NotEmptyZero(previous) &&
current <= previous - tolerance;
//
return result;
}
//
template <typename T>
bool IsSame(
@@ -486,4 +486,188 @@
// }
// #endregion
// #region ATR ...
//
// if (kiParser.IsATRBreakoutUp(barIndex, X_PRICE_CLOSE)) {
// DebugBreak();
// }
//
// if (kiParser.IsATRBreakoutDown(barIndex, X_PRICE_CLOSE)) {
// DebugBreak();
// }
//
// if (kiParser.IsATROverLast(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsATRSwitchedOverLast(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsATRUnderLast(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsATRSwitchedUnderLast(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsATRSmoothedOverLast(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsATRSmoothedSwitchedOverLast(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsATRSmoothedUnderLast(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsATRSmoothedSwitchedUnderLast(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsVolatilityHigh(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsVolatilitySwitchdToHigh(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsVolatilityLow(barIndex)) {
// DebugBreak();
// }
//
// if (kiParser.IsVolatilitySwitchdToLow(barIndex)) {
// DebugBreak();
// }
// #endregion
// #region RSI ...
//
// if (kiParser.IsRSIBullish(barIndex, 55))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedToBullish(barIndex, 55))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSIBearish(barIndex, 45))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedToBearish(barIndex, 45))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSIRising(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedToRising(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSIFalling(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedToFalling(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSIOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedOverLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSIUnderLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedUnderLast(barIndex))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSIOverbought(barIndex, 70))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedToOverbought(barIndex, 70))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedFromOverbought(barIndex, 70))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSIOversold(barIndex, 30))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedToOversold(barIndex, 30))
// {
// DebugBreak();
// }
//
// if (kiParser.IsRSISwitchedFromOversold(barIndex, 30))
// {
// DebugBreak();
// }
// #endregion
File diff suppressed because it is too large Load Diff
@@ -982,7 +982,6 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
//
// TEST ...
//
return false;