add Cycles related Functions to XFima Parser ...

This commit is contained in:
2025-10-28 13:49:58 +03:30
parent d86a1b6428
commit 7960b76510
4 changed files with 5659 additions and 101 deletions
+584 -94
View File
@@ -61,32 +61,40 @@ enum ENUM_XFIMA_BUFFERS
XFIMA_PB_BAND_LOWER_LINE = 22,
XFIMA_ATR_BAND_UPPER_LINE = 23,
XFIMA_ATR_BAND_LOWER_LINE = 24,
XFIMA_SC_MA_LINE = 25,
XFIMA_MC_MA_LINE = 26,
XFIMA_LC_MA_LINE = 27,
XFIMA_HC_MA_LINE = 28,
//
// Data Buffers ...
XFIMA_MA_FAST_STATE_LINE = 25,
XFIMA_MA_SLOW_STATE_LINE = 26,
XFIMA_SAR_STATE_LINE = 27,
XFIMA_SC_HH_LINE = 28,
XFIMA_SC_LL_LINE = 29,
XFIMA_MC_HH_LINE = 30,
XFIMA_MC_LL_LINE = 31,
XFIMA_LC_HH_LINE = 32,
XFIMA_LC_LL_LINE = 33,
XFIMA_HC_HH_LINE = 34,
XFIMA_HC_LL_LINE = 35,
XFIMA_ZIGZAG_HIGHS_LINE = 36,
XFIMA_ZIGZAG_HIGHS_TIME_LINE = 37,
XFIMA_ZIGZAG_LOWS_LINE = 38,
XFIMA_ZIGZAG_LOWS_TIME_LINE = 39,
XFIMA_HK_RAW_OPEN_LINE = 40,
XFIMA_HK_RAW_HIGH_LINE = 41,
XFIMA_HK_RAW_LOW_LINE = 42,
XFIMA_HK_RAW_CLOSE_LINE = 43,
XFIMA_PB_BAND_RAW_UPPER_LINE = 44,
XFIMA_PB_BAND_RAW_LOWER_LINE = 45,
XFIMA_ATR_LINE = 46,
XFIMA_ATR_BAND_RAW_UPPER_LINE = 47,
XFIMA_ATR_BAND_RAW_LOWER_LINE = 48,
XFIMA_MA_FAST_STATE_LINE = 29,
XFIMA_MA_SLOW_STATE_LINE = 30,
XFIMA_SAR_STATE_LINE = 31,
XFIMA_SC_HH_LINE = 32,
XFIMA_SC_LL_LINE = 33,
XFIMA_MC_HH_LINE = 34,
XFIMA_MC_LL_LINE = 35,
XFIMA_LC_HH_LINE = 36,
XFIMA_LC_LL_LINE = 37,
XFIMA_HC_HH_LINE = 38,
XFIMA_HC_LL_LINE = 39,
XFIMA_ZIGZAG_HIGHS_LINE = 40,
XFIMA_ZIGZAG_HIGHS_TIME_LINE = 41,
XFIMA_ZIGZAG_LOWS_LINE = 42,
XFIMA_ZIGZAG_LOWS_TIME_LINE = 43,
XFIMA_HK_RAW_OPEN_LINE = 44,
XFIMA_HK_RAW_HIGH_LINE = 45,
XFIMA_HK_RAW_LOW_LINE = 46,
XFIMA_HK_RAW_CLOSE_LINE = 47,
XFIMA_PB_BAND_RAW_UPPER_LINE = 48,
XFIMA_PB_BAND_RAW_LOWER_LINE = 49,
XFIMA_ATR_LINE = 50,
XFIMA_ATR_BAND_RAW_UPPER_LINE = 51,
XFIMA_ATR_BAND_RAW_LOWER_LINE = 52,
XFIMA_SC_MA_STATE_LINE = 53,
XFIMA_MC_MA_STATE_LINE = 54,
XFIMA_LC_MA_STATE_LINE = 55,
XFIMA_HC_MA_STATE_LINE = 56,
};
//
@@ -144,6 +152,7 @@ struct XFIMAInputs
bool showHKBand; // Show HK Band
bool showATRBand; // Show ATR Band
bool showZigZag; // Show ZigZag
bool showCyclesMa; // Show Cycles MA
bool showFiboZone; // Show Fibo Zone
int startCalculationForLastBars; // Calculate Last n Bars
int sarArrowCode; // Parabolic SAR Arrow Code
@@ -219,6 +228,7 @@ struct XFIMAInputs
showHKBand = true; // Show HK Band
showATRBand = true; // Show ATR Band
showZigZag = true; // Show ZigZag
showCyclesMa = true; // Show Cycles MA
showFiboZone = true; // Show Fibo Zone
startCalculationForLastBars = 1500; // Calculate Last n Bars
sarArrowCode = 159; // Parabolic SAR Arrow Code
@@ -240,6 +250,7 @@ struct XFIMAInputs
showHKBand = false;
showATRBand = false;
showZigZag = false;
showCyclesMa = true;
showFiboZone = false;
}
@@ -312,22 +323,34 @@ struct XFIMAConditions
//
// Buffers ...
double maFastBuffer[];
double maFastColorBuffer[];
double maFastStateBuffer[];
double maSlowBuffer[];
double maSlowColorBuffer[];
double maSlowStateBuffer[];
double maBandUpperBuffer[];
double maBandLowerBuffer[];
double sarBuffer[];
double sarColorBuffer[];
double sarStateBuffer[];
double peakBuffer[];
double valeBuffer[];
double fiboUpperBuffer[];
double fiboMiddleBuffer[];
double fiboLowerBuffer[];
double zigzagBuffer[];
double maBandUpperBuffer[];
double maBandLowerBuffer[];
double hkOpenBuffer[];
double hkHighBuffer[];
double hkLowBuffer[];
double hkCloseBuffer[];
double hkColorBuffer[];
double hkBandUpperBuffer[];
double hkBandLowerBuffer[];
double pbBandUpperBuffer[];
double pbBandLowerBuffer[];
double atrBandUpperBuffer[];
double atrBandLowerBuffer[];
double scMaBuffer[];
double mcMaBuffer[];
double lcMaBuffer[];
double hcMaBuffer[];
double maFastStateBuffer[];
double maSlowStateBuffer[];
double sarStateBuffer[];
double sHHBuffer[];
double sLLBuffer[];
double mHHBuffer[];
@@ -336,15 +359,19 @@ struct XFIMAConditions
double lLLBuffer[];
double hHHBuffer[];
double hLLBuffer[];
double highsBuffer[];
double highsTimeBuffer[];
double lowsBuffer[];
double lowsTimeBuffer[];
double hkOpenBuffer[];
double hkHighBuffer[];
double hkLowBuffer[];
double hkCloseBuffer[];
double hkColorBuffer[];
double hkRawHighBuffer[];
double hkRawOpenBuffer[];
double hkRawLowBuffer[];
double hkRawCloseBuffer[];
double pbBandRawUpperBuffer[];
double pbBandRawLowerBuffer[];
double atrBuffer[];
double atrBandRawUpperBuffer[];
double atrBandRawLowerBuffer[];
double scMaStateBuffer[];
double mcMaStateBuffer[];
double lcMaStateBuffer[];
double hcMaStateBuffer[];
//
// Conditions ...
@@ -376,43 +403,59 @@ struct XFIMAConditions
// Buffers ...
//
SpecifiedClean(bars);
XClean(bars);
//
SpecifiedClean(maFastBuffer);
SpecifiedClean(maFastColorBuffer);
SpecifiedClean(maFastStateBuffer);
SpecifiedClean(maSlowBuffer);
SpecifiedClean(maSlowColorBuffer);
SpecifiedClean(maSlowStateBuffer);
SpecifiedClean(maBandUpperBuffer);
SpecifiedClean(maBandLowerBuffer);
SpecifiedClean(sarBuffer);
SpecifiedClean(sarColorBuffer);
SpecifiedClean(sarStateBuffer);
SpecifiedClean(peakBuffer);
SpecifiedClean(valeBuffer);
SpecifiedClean(fiboUpperBuffer);
SpecifiedClean(fiboMiddleBuffer);
SpecifiedClean(fiboLowerBuffer);
SpecifiedClean(zigzagBuffer);
SpecifiedClean(sHHBuffer);
SpecifiedClean(sLLBuffer);
SpecifiedClean(mHHBuffer);
SpecifiedClean(mLLBuffer);
SpecifiedClean(lHHBuffer);
SpecifiedClean(lLLBuffer);
SpecifiedClean(hHHBuffer);
SpecifiedClean(hLLBuffer);
SpecifiedClean(highsBuffer);
SpecifiedClean(highsTimeBuffer);
SpecifiedClean(lowsBuffer);
SpecifiedClean(lowsTimeBuffer);
SpecifiedClean(hkOpenBuffer);
SpecifiedClean(hkHighBuffer);
SpecifiedClean(hkLowBuffer);
SpecifiedClean(hkCloseBuffer);
SpecifiedClean(hkColorBuffer);
XClean(maFastBuffer);
XClean(maSlowBuffer);
XClean(sarBuffer);
XClean(peakBuffer);
XClean(valeBuffer);
XClean(fiboUpperBuffer);
XClean(fiboMiddleBuffer);
XClean(fiboLowerBuffer);
XClean(zigzagBuffer);
XClean(maBandUpperBuffer);
XClean(maBandLowerBuffer);
XClean(hkOpenBuffer);
XClean(hkHighBuffer);
XClean(hkLowBuffer);
XClean(hkCloseBuffer);
XClean(hkColorBuffer);
XClean(hkBandUpperBuffer);
XClean(hkBandLowerBuffer);
XClean(pbBandUpperBuffer);
XClean(pbBandLowerBuffer);
XClean(atrBandUpperBuffer);
XClean(atrBandLowerBuffer);
XClean(scMaBuffer);
XClean(mcMaBuffer);
XClean(lcMaBuffer);
XClean(hcMaBuffer);
XClean(maFastStateBuffer);
XClean(maSlowStateBuffer);
XClean(sarStateBuffer);
XClean(sHHBuffer);
XClean(sLLBuffer);
XClean(mHHBuffer);
XClean(mLLBuffer);
XClean(lHHBuffer);
XClean(lLLBuffer);
XClean(hHHBuffer);
XClean(hLLBuffer);
XClean(hkRawHighBuffer);
XClean(hkRawOpenBuffer);
XClean(hkRawLowBuffer);
XClean(hkRawCloseBuffer);
XClean(pbBandRawUpperBuffer);
XClean(pbBandRawLowerBuffer);
XClean(atrBuffer);
XClean(atrBandRawUpperBuffer);
XClean(atrBandRawLowerBuffer);
XClean(scMaStateBuffer);
XClean(mcMaStateBuffer);
XClean(lcMaStateBuffer);
XClean(hcMaStateBuffer);
//
// Conditions ...
@@ -422,22 +465,34 @@ struct XFIMAConditions
//
ArraySetAsSeries(maFastBuffer, true);
ArraySetAsSeries(maFastColorBuffer, true);
ArraySetAsSeries(maFastStateBuffer, true);
ArraySetAsSeries(maSlowBuffer, true);
ArraySetAsSeries(maSlowColorBuffer, true);
ArraySetAsSeries(maSlowStateBuffer, true);
ArraySetAsSeries(maBandUpperBuffer, true);
ArraySetAsSeries(maBandLowerBuffer, true);
ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(sarColorBuffer, true);
ArraySetAsSeries(sarStateBuffer, true);
ArraySetAsSeries(peakBuffer, true);
ArraySetAsSeries(valeBuffer, true);
ArraySetAsSeries(fiboUpperBuffer, true);
ArraySetAsSeries(fiboMiddleBuffer, true);
ArraySetAsSeries(fiboLowerBuffer, true);
ArraySetAsSeries(zigzagBuffer, false); // Fix this ...
ArraySetAsSeries(zigzagBuffer, true);
ArraySetAsSeries(maBandUpperBuffer, true);
ArraySetAsSeries(maBandLowerBuffer, true);
ArraySetAsSeries(hkOpenBuffer, true);
ArraySetAsSeries(hkHighBuffer, true);
ArraySetAsSeries(hkLowBuffer, true);
ArraySetAsSeries(hkCloseBuffer, true);
ArraySetAsSeries(hkColorBuffer, true);
ArraySetAsSeries(hkBandUpperBuffer, true);
ArraySetAsSeries(hkBandLowerBuffer, true);
ArraySetAsSeries(pbBandUpperBuffer, true);
ArraySetAsSeries(pbBandLowerBuffer, true);
ArraySetAsSeries(atrBandUpperBuffer, true);
ArraySetAsSeries(atrBandLowerBuffer, true);
ArraySetAsSeries(scMaBuffer, true);
ArraySetAsSeries(mcMaBuffer, true);
ArraySetAsSeries(lcMaBuffer, true);
ArraySetAsSeries(hcMaBuffer, true);
ArraySetAsSeries(maFastStateBuffer, true);
ArraySetAsSeries(maSlowStateBuffer, true);
ArraySetAsSeries(sarStateBuffer, true);
ArraySetAsSeries(sHHBuffer, true);
ArraySetAsSeries(sLLBuffer, true);
ArraySetAsSeries(mHHBuffer, true);
@@ -446,15 +501,19 @@ struct XFIMAConditions
ArraySetAsSeries(lLLBuffer, true);
ArraySetAsSeries(hHHBuffer, true);
ArraySetAsSeries(hLLBuffer, true);
ArraySetAsSeries(highsBuffer, true);
ArraySetAsSeries(highsTimeBuffer, true);
ArraySetAsSeries(lowsBuffer, true);
ArraySetAsSeries(lowsTimeBuffer, true);
ArraySetAsSeries(hkOpenBuffer, true);
ArraySetAsSeries(hkHighBuffer, true);
ArraySetAsSeries(hkLowBuffer, true);
ArraySetAsSeries(hkCloseBuffer, true);
ArraySetAsSeries(hkColorBuffer, true);
ArraySetAsSeries(hkRawHighBuffer, true);
ArraySetAsSeries(hkRawOpenBuffer, true);
ArraySetAsSeries(hkRawLowBuffer, true);
ArraySetAsSeries(hkRawCloseBuffer, true);
ArraySetAsSeries(pbBandRawUpperBuffer, true);
ArraySetAsSeries(pbBandRawLowerBuffer, true);
ArraySetAsSeries(atrBuffer, true);
ArraySetAsSeries(atrBandRawUpperBuffer, true);
ArraySetAsSeries(atrBandRawLowerBuffer, true);
ArraySetAsSeries(scMaStateBuffer, true);
ArraySetAsSeries(mcMaStateBuffer, true);
ArraySetAsSeries(lcMaStateBuffer, true);
ArraySetAsSeries(hcMaStateBuffer, true);
//
ZeroMemory(this);
@@ -743,6 +802,62 @@ class XCXFIMAHelper : public XCBaseHelper
conditions.maSlowStateBuffer //
);
//
CopySCMA(
zIndex,
loopback,
conditions.scMaBuffer //
);
//
CopySCMAState(
zIndex,
loopback,
conditions.scMaStateBuffer //
);
//
CopyMCMA(
zIndex,
loopback,
conditions.mcMaBuffer //
);
//
CopyMCMAState(
zIndex,
loopback,
conditions.mcMaStateBuffer //
);
//
CopyLCMA(
zIndex,
loopback,
conditions.lcMaBuffer //
);
//
CopyLCMAState(
zIndex,
loopback,
conditions.lcMaStateBuffer //
);
//
CopyHCMA(
zIndex,
loopback,
conditions.hcMaBuffer //
);
//
CopyHCMAState(
zIndex,
loopback,
conditions.hcMaStateBuffer //
);
//
CopyMABandUpper(
zIndex,
@@ -897,6 +1012,34 @@ class XCXFIMAHelper : public XCBaseHelper
conditions.hkCloseBuffer //
);
//
CopyHKRawOpen(
zIndex,
loopback,
conditions.hkRawOpenBuffer //
);
//
CopyHKRawHigh(
zIndex,
loopback,
conditions.hkRawHighBuffer //
);
//
CopyHKRawLow(
zIndex,
loopback,
conditions.hkRawLowBuffer //
);
//
CopyHKRawClose(
zIndex,
loopback,
conditions.hkRawCloseBuffer //
);
//
CopyHKColor(
zIndex,
@@ -904,6 +1047,86 @@ class XCXFIMAHelper : public XCBaseHelper
conditions.hkColorBuffer //
);
//
CopyHKBandUpper(
zIndex,
loopback,
conditions.hkBandUpperBuffer //
);
//
CopyHKBandLower(
zIndex,
loopback,
conditions.hkBandLowerBuffer //
);
//
CopyPBBandUpper(
zIndex,
loopback,
conditions.pbBandUpperBuffer //
);
//
CopyPBBandLower(
zIndex,
loopback,
conditions.pbBandLowerBuffer //
);
//
CopyPBRawBandUpper(
zIndex,
loopback,
conditions.pbBandRawUpperBuffer //
);
//
CopyPBRawBandLower(
zIndex,
loopback,
conditions.pbBandRawLowerBuffer //
);
//
CopyATRBandUpper(
zIndex,
loopback,
conditions.atrBandUpperBuffer //
);
//
CopyATRBandLower(
zIndex,
loopback,
conditions.atrBandLowerBuffer //
);
//
CopyATR(
zIndex,
loopback,
conditions.atrBuffer //
);
//
CopyATRRawBandUpper(
zIndex,
loopback,
conditions.atrBandRawUpperBuffer //
);
//
CopyATRRawBandLower(
zIndex,
loopback,
conditions.atrBandRawLowerBuffer //
);
//
//
// Conditions ...
@@ -1682,6 +1905,273 @@ class XCXFIMAHelper : public XCBaseHelper
//
// CYCLES Range ...
//
// MAs ...
//
// SC MA ...
//
double GetSCMA(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_SC_MA_LINE,
barIndex //
);
}
//
int CopySCMA(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_SC_MA_LINE,
start,
count,
asSeries //
);
}
//
// SC MA State ...
//
double GetSCMAState(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_SC_MA_STATE_LINE,
barIndex //
);
}
//
int CopySCMAState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_SC_MA_STATE_LINE,
start,
count,
asSeries //
);
}
//
// MC MA ...
//
double GetMCMA(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_MC_MA_LINE,
barIndex //
);
}
//
int CopyMCMA(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_MC_MA_LINE,
start,
count,
asSeries //
);
}
//
// MC MA State ...
//
double GetMCMAState(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_MC_MA_STATE_LINE,
barIndex //
);
}
//
int CopyMCMAState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_MC_MA_STATE_LINE,
start,
count,
asSeries //
);
}
//
// LC MA ...
//
double GetLCMA(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_LC_MA_LINE,
barIndex //
);
}
//
int CopyLCMA(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_LC_MA_LINE,
start,
count,
asSeries //
);
}
//
// LC MA State ...
//
double GetLCMAState(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_LC_MA_STATE_LINE,
barIndex //
);
}
//
int CopyLCMAState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_LC_MA_STATE_LINE,
start,
count,
asSeries //
);
}
//
// HC MA ...
//
double GetHCMA(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_HC_MA_LINE,
barIndex //
);
}
//
int CopyHCMA(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_HC_MA_LINE,
start,
count,
asSeries //
);
}
//
// HC MA State ...
//
double GetHCMAState(
int barIndex // Bar Index
)
{
//
return ReadValue(
(int)XFIMA_HC_MA_STATE_LINE,
barIndex //
);
}
//
int CopyHCMAState(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool asSeries = true // As Series Flag
)
{
//
return ReadValues(
buffer,
(int)XFIMA_HC_MA_STATE_LINE,
start,
count,
asSeries //
);
}
//
// SHORT ...