Adding Support of XHK to XFIMA ...

This commit is contained in:
2025-09-29 17:23:48 +03:30
parent fd82d07995
commit 7b27a4ad2f
4 changed files with 601 additions and 25 deletions
+430 -22
View File
@@ -35,13 +35,13 @@ enum ENUM_XFIMA_BUFFERS
{
XFIMA_MA_FAST_LINE = 0,
XFIMA_MA_FAST_COLOR_LINE = 1,
XFIMA_MA_FAST_STATE_LINE = 12,
XFIMA_MA_FAST_STATE_LINE = 19,
XFIMA_MA_SLOW_LINE = 2,
XFIMA_MA_SLOW_COLOR_LINE = 3,
XFIMA_MA_SLOW_STATE_LINE = 13,
XFIMA_MA_SLOW_STATE_LINE = 20,
XFIMA_SAR_LINE = 4,
XFIMA_SAR_COLOR_LINE = 5,
XFIMA_SAR_STATE_LINE = 14,
XFIMA_SAR_STATE_LINE = 21,
XFIMA_PEAK_LINE = 6,
XFIMA_VALE_LINE = 7,
XFIMA_FIBO_UPPER_LINE = 8,
@@ -50,25 +50,31 @@ enum ENUM_XFIMA_BUFFERS
XFIMA_ZIGZAG_LINE = 11,
XFIMA_MA_BAND_UPPER_LINE = 12,
XFIMA_MA_BAND_LOWER_LINE = 13,
XFIMA_ZIGZAG_HIGHS_LINE = 25,
XFIMA_ZIGZAG_HIGHS_TIME_LINE = 26,
XFIMA_ZIGZAG_LOWS_LINE = 27,
XFIMA_ZIGZAG_LOWS_TIME_LINE = 28,
// 14 Ma Fast State
// 15 Ma Slow State
// 16 Sar State
XFIMA_SC_HH_LINE = 17,
XFIMA_SC_LL_LINE = 18,
XFIMA_MC_HH_LINE = 19,
XFIMA_MC_LL_LINE = 20,
XFIMA_LC_HH_LINE = 21,
XFIMA_LC_LL_LINE = 22,
XFIMA_HC_HH_LINE = 23,
XFIMA_HC_LL_LINE = 24,
// 25 ZigZag Highs
// 26 ZigZag Highs Time
// 27 ZigZag Lows
// 28 ZigZag Lows Time
XFIMA_ZIGZAG_HIGHS_LINE = 30,
XFIMA_ZIGZAG_HIGHS_TIME_LINE = 31,
XFIMA_ZIGZAG_LOWS_LINE = 32,
XFIMA_ZIGZAG_LOWS_TIME_LINE = 33,
//
XFIMA_HK_OPEN_LINE = 14,
XFIMA_HK_HIGH_LINE = 15,
XFIMA_HK_LOW_LINE = 16,
XFIMA_HK_CLOSE_LINE = 17,
XFIMA_HK_COLOR_LINE = 18,
// 19 Ma Fast State
// 20 Ma Slow State
// 21 Sar State
XFIMA_SC_HH_LINE = 22,
XFIMA_SC_LL_LINE = 23,
XFIMA_MC_HH_LINE = 24,
XFIMA_MC_LL_LINE = 25,
XFIMA_LC_HH_LINE = 26,
XFIMA_LC_LL_LINE = 27,
XFIMA_HC_HH_LINE = 28,
XFIMA_HC_LL_LINE = 29,
// 30 ZigZag Highs
// 31 ZigZag Highs Time
// 32 ZigZag Lows
// 33 ZigZag Lows Time
};
//
@@ -109,6 +115,7 @@ struct XFIMAInputs
//
// Presentation ...
bool showPV; // Show PV
bool showHK; // Show HK
bool showSAR; // Show Sar
bool showMAFast; // Show MA Fast
bool showMASlow; // Show MA Slow
@@ -172,6 +179,7 @@ struct XFIMAInputs
//
// Presentation ...
showPV = true; // Show PV
showHK = true; // Show HK
showSAR = true; // Show Sar
showMAFast = true; // Show MA Fast
showMASlow = true; // Show MA Slow
@@ -190,6 +198,7 @@ struct XFIMAInputs
{
//
showPV = false;
showHK = false;
showSAR = false;
showMAFast = false;
showMASlow = false;
@@ -289,6 +298,11 @@ struct XFIMAConditions
double highsTimeBuffer[];
double lowsBuffer[];
double lowsTimeBuffer[];
double hkOpenBuffer[];
double hkHighBuffer[];
double hkLowBuffer[];
double hkCloseBuffer[];
double hkColorBuffer[];
//
// Conditions ...
@@ -352,6 +366,11 @@ struct XFIMAConditions
SpecifiedClean(highsTimeBuffer);
SpecifiedClean(lowsBuffer);
SpecifiedClean(lowsTimeBuffer);
SpecifiedClean(hkOpenBuffer);
SpecifiedClean(hkHighBuffer);
SpecifiedClean(hkLowBuffer);
SpecifiedClean(hkCloseBuffer);
SpecifiedClean(hkColorBuffer);
//
// Conditions ...
@@ -389,6 +408,11 @@ struct XFIMAConditions
ArraySetAsSeries(highsTimeBuffer, true);
ArraySetAsSeries(lowsBuffer, true);
ArraySetAsSeries(lowsTimeBuffer, true);
ArraySetAsSeries(hkOpenBuffer, true);
ArraySetAsSeries(hkHighBuffer, true);
ArraySetAsSeries(hkLowBuffer, true);
ArraySetAsSeries(hkCloseBuffer, true);
ArraySetAsSeries(hkColorBuffer, true);
//
ZeroMemory(this);
@@ -481,6 +505,11 @@ class XCXFIMAHelper : public XCBaseHelper
double highsTimeBuffer[];
double lowsBuffer[];
double lowsTimeBuffer[];
double hkOpenBuffer[];
double hkHighBuffer[];
double hkLowBuffer[];
double hkCloseBuffer[];
double hkColorBuffer[];
//
// Constructors ...
@@ -550,6 +579,11 @@ class XCXFIMAHelper : public XCBaseHelper
ArraySetAsSeries(highsTimeBuffer, true);
ArraySetAsSeries(lowsBuffer, true);
ArraySetAsSeries(lowsTimeBuffer, true);
ArraySetAsSeries(hkOpenBuffer, true);
ArraySetAsSeries(hkHighBuffer, true);
ArraySetAsSeries(hkLowBuffer, true);
ArraySetAsSeries(hkCloseBuffer, true);
ArraySetAsSeries(hkColorBuffer, true);
//
mInputs = inputs;
@@ -587,6 +621,7 @@ class XCXFIMAHelper : public XCBaseHelper
mInputs.zigzagLowersMode,
"", // Presentation ...
mInputs.showPV,
mInputs.showHK,
mInputs.showSAR,
mInputs.showMAFast,
mInputs.showMASlow,
@@ -863,6 +898,41 @@ class XCXFIMAHelper : public XCBaseHelper
conditions.hLLBuffer //
);
//
CopyHKOpen(
zIndex,
loopback,
conditions.hkOpenBuffer //
);
//
CopyHKHigh(
zIndex,
loopback,
conditions.hkHighBuffer //
);
//
CopyHKLow(
zIndex,
loopback,
conditions.hkLowBuffer //
);
//
CopyHKClose(
zIndex,
loopback,
conditions.hkCloseBuffer //
);
//
CopyHKColor(
zIndex,
loopback,
conditions.hkColorBuffer //
);
//
// Conditions ...
@@ -3081,6 +3151,269 @@ class XCXFIMAHelper : public XCBaseHelper
);
}
//
// XHK ...
//
// XHK Open ...
//
double GetHKOpen(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(hkOpenBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return hkOpenBuffer[barIndex];
}
//
int CopyHKOpen(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
hkOpenBuffer,
buffer,
forceClean
//
);
}
//
// XHK High ...
//
double GetHKHigh(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(hkHighBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return hkHighBuffer[barIndex];
}
//
int CopyHKHigh(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
hkHighBuffer,
buffer,
forceClean
//
);
}
//
// XHK Low ...
//
double GetHKLow(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(hkLowBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return hkLowBuffer[barIndex];
}
//
int CopyHKLow(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
hkLowBuffer,
buffer,
forceClean
//
);
}
//
// XHK Close ...
//
double GetHKClose(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(hkCloseBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return hkCloseBuffer[barIndex];
}
//
int CopyHKClose(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
hkCloseBuffer,
buffer,
forceClean
//
);
}
//
// XHK Color ...
//
double GetHKColor(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate(barIndex);
//
int count = ArraySize(hkColorBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return hkColorBuffer[barIndex];
}
//
int CopyHKColor(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate(start);
//
// Copy Items ...
return Copy(
0,
count,
hkColorBuffer,
buffer,
forceClean
//
);
}
//
// Protected ...
protected:
@@ -3368,6 +3701,51 @@ class XCXFIMAHelper : public XCBaseHelper
maxRequiredBars,
lowsTimeBuffer //
);
//
CopyBuffer(
mHandler,
XFIMA_HK_OPEN_LINE,
barIndex,
maxRequiredBars,
hkOpenBuffer //
);
//
CopyBuffer(
mHandler,
XFIMA_HK_HIGH_LINE,
barIndex,
maxRequiredBars,
hkHighBuffer //
);
//
CopyBuffer(
mHandler,
XFIMA_HK_LOW_LINE,
barIndex,
maxRequiredBars,
hkLowBuffer //
);
//
CopyBuffer(
mHandler,
XFIMA_HK_CLOSE_LINE,
barIndex,
maxRequiredBars,
hkCloseBuffer //
);
//
CopyBuffer(
mHandler,
XFIMA_HK_COLOR_LINE,
barIndex,
maxRequiredBars,
hkColorBuffer //
);
}
//
@@ -3548,6 +3926,36 @@ class XCXFIMAHelper : public XCBaseHelper
lowsTimeBuffer,
maxAllowed //
);
//
CleanupArray(
hkOpenBuffer,
maxAllowed //
);
//
CleanupArray(
hkHighBuffer,
maxAllowed //
);
//
CleanupArray(
hkLowBuffer,
maxAllowed //
);
//
CleanupArray(
hkCloseBuffer,
maxAllowed //
);
//
CleanupArray(
hkColorBuffer,
maxAllowed //
);
}
};