add POI Detector and Drawer for XCATB classes ...
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
enum ENUM_X121_XCATB_BUFFERS
|
||||
{
|
||||
X121_XCATB_SAR_LINE = 0,
|
||||
X121_XCATB_SAR_STATE_LINE = 28,
|
||||
X121_XCATB_SAR_STATE_LINE = 30,
|
||||
X121_XCATB_PEAK_LINE = 2,
|
||||
X121_XCATB_VALE_LINE = 3,
|
||||
X121_XCATB_PEAK_GOLDEN_LINE = 4,
|
||||
@@ -41,7 +41,7 @@ enum ENUM_X121_XCATB_BUFFERS
|
||||
X121_XCATB_ATR_BAND_UPPER_LINE = 6,
|
||||
X121_XCATB_ATR_BAND_LOWER_LINE = 7,
|
||||
X121_XCATB_TREND_LINE = 8,
|
||||
X121_XCATB_TREND_STATE_LINE = 29,
|
||||
X121_XCATB_TREND_STATE_LINE = 31,
|
||||
X121_XCATB_SBAR_O_LINE = 10,
|
||||
X121_XCATB_SBAR_H_LINE = 11,
|
||||
X121_XCATB_SBAR_L_LINE = 12,
|
||||
@@ -58,23 +58,25 @@ enum ENUM_X121_XCATB_BUFFERS
|
||||
X121_XCATB_L_LL_LINE = 25,
|
||||
X121_XCATB_H_HH_LINE = 26,
|
||||
X121_XCATB_H_LL_LINE = 27,
|
||||
X121_XCATB_RSI_LINE = 30,
|
||||
X121_XCATB_ADX_LINE = 31,
|
||||
X121_XCATB_ADXP_LINE = 32,
|
||||
X121_XCATB_ADXN_LINE = 33,
|
||||
X121_XCATB_DELTA_LINE = 34,
|
||||
X121_XCATB_DELTA_SIGNAL_LINE = 35,
|
||||
X121_XCATB_VOLUME_BULLISH_LINE = 36,
|
||||
X121_XCATB_VOLUME_BEARISH_LINE = 37,
|
||||
X121_XCATB_VOLUME_VOLUME_BULLISH_SIGNAL_LINE = 38,
|
||||
X121_XCATB_VOLUME_VOLUME_BEARISH_SIGNAL_LINE = 39,
|
||||
X121_XCATB_ATR_LINE = 40,
|
||||
X121_XCATB_ATR_BAND_RAW_UPPER_LINE = 41,
|
||||
X121_XCATB_ATR_BAND_RAW_LOWER_LINE = 42,
|
||||
X121_XCATB_HK_BAR_O_LINE = 43,
|
||||
X121_XCATB_HK_BAR_H_LINE = 44,
|
||||
X121_XCATB_HK_BAR_L_LINE = 45,
|
||||
X121_XCATB_HK_BAR_C_LINE = 46,
|
||||
X121_XCATB_KI_LINE = 28,
|
||||
X121_XCATB_KI_STATE_LINE = 50,
|
||||
X121_XCATB_RSI_LINE = 32,
|
||||
X121_XCATB_ADX_LINE = 33,
|
||||
X121_XCATB_ADXP_LINE = 34,
|
||||
X121_XCATB_ADXN_LINE = 35,
|
||||
X121_XCATB_DELTA_LINE = 36,
|
||||
X121_XCATB_DELTA_SIGNAL_LINE = 37,
|
||||
X121_XCATB_VOLUME_BULLISH_LINE = 38,
|
||||
X121_XCATB_VOLUME_BEARISH_LINE = 39,
|
||||
X121_XCATB_VOLUME_VOLUME_BULLISH_SIGNAL_LINE = 40,
|
||||
X121_XCATB_VOLUME_VOLUME_BEARISH_SIGNAL_LINE = 41,
|
||||
X121_XCATB_ATR_LINE = 42,
|
||||
X121_XCATB_ATR_BAND_RAW_UPPER_LINE = 43,
|
||||
X121_XCATB_ATR_BAND_RAW_LOWER_LINE = 44,
|
||||
X121_XCATB_HK_BAR_O_LINE = 45,
|
||||
X121_XCATB_HK_BAR_H_LINE = 46,
|
||||
X121_XCATB_HK_BAR_L_LINE = 47,
|
||||
X121_XCATB_HK_BAR_C_LINE = 48,
|
||||
};
|
||||
|
||||
//
|
||||
@@ -99,6 +101,7 @@ struct X121XCatbInputs
|
||||
//
|
||||
// Presentation ...
|
||||
bool showBars; // Show Bars
|
||||
bool showKI; // Show KI
|
||||
bool showPV; // Show PV
|
||||
bool showPVGolden; // Show PV Golden
|
||||
bool showSar; // Show Sar
|
||||
@@ -144,6 +147,7 @@ struct X121XCatbInputs
|
||||
//
|
||||
// Presentation ...
|
||||
showBars = false; // Show Bars
|
||||
showKI = false; // Show KI
|
||||
showPV = false; // Show PV
|
||||
showPVGolden = false; // Show PV Golden
|
||||
showSar = false; // Show Sar
|
||||
@@ -183,6 +187,7 @@ struct X121XCatbInputs
|
||||
//
|
||||
// Presentation ...
|
||||
showBars = true; // Show Bars
|
||||
showKI = false; // Show KI
|
||||
showPV = false; // Show PV
|
||||
showPVGolden = false; // Show PV Golden
|
||||
showSar = false; // Show Sar
|
||||
@@ -205,6 +210,7 @@ struct X121XCatbInputs
|
||||
void Hide()
|
||||
{
|
||||
//
|
||||
showKI = false;
|
||||
showPV = false;
|
||||
showSar = false;
|
||||
showTrend = false;
|
||||
@@ -273,6 +279,7 @@ struct X121XCatbConditions
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
double kiBuffer[];
|
||||
double sarBuffer[];
|
||||
double atrBuffer[];
|
||||
double rsiBuffer[];
|
||||
@@ -295,6 +302,7 @@ struct X121XCatbConditions
|
||||
double hkOpenBuffer[];
|
||||
double hkHighBuffer[];
|
||||
double hkCloseBuffer[];
|
||||
double kiStateBuffer[];
|
||||
double sarStateBuffer[];
|
||||
double atrUpperBuffer[];
|
||||
double atrLowerBuffer[];
|
||||
@@ -341,6 +349,20 @@ struct X121XCatbConditions
|
||||
bool isSarSwitchedToBullish;
|
||||
bool isSarSwitchedToBearish;
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
bool isKIBullish;
|
||||
bool isKIBearish;
|
||||
|
||||
//
|
||||
bool isKISameAsLast;
|
||||
|
||||
//
|
||||
bool isKISwitchedToBullish;
|
||||
bool isKISwitchedToBearish;
|
||||
|
||||
//
|
||||
// ADX ...
|
||||
|
||||
@@ -494,6 +516,7 @@ struct X121XCatbConditions
|
||||
|
||||
//
|
||||
Clean(bars);
|
||||
Clean(kiBuffer);
|
||||
Clean(sarBuffer);
|
||||
Clean(atrBuffer);
|
||||
Clean(rsiBuffer);
|
||||
@@ -516,6 +539,7 @@ struct X121XCatbConditions
|
||||
Clean(hkOpenBuffer);
|
||||
Clean(hkHighBuffer);
|
||||
Clean(hkCloseBuffer);
|
||||
Clean(kiStateBuffer);
|
||||
Clean(sarStateBuffer);
|
||||
Clean(atrUpperBuffer);
|
||||
Clean(atrLowerBuffer);
|
||||
@@ -534,6 +558,7 @@ struct X121XCatbConditions
|
||||
|
||||
//
|
||||
ArraySetAsSeries(bars, true);
|
||||
ArraySetAsSeries(kiBuffer, true);
|
||||
ArraySetAsSeries(sarBuffer, true);
|
||||
ArraySetAsSeries(atrBuffer, true);
|
||||
ArraySetAsSeries(rsiBuffer, true);
|
||||
@@ -556,6 +581,7 @@ struct X121XCatbConditions
|
||||
ArraySetAsSeries(hkOpenBuffer, true);
|
||||
ArraySetAsSeries(hkHighBuffer, true);
|
||||
ArraySetAsSeries(hkCloseBuffer, true);
|
||||
ArraySetAsSeries(kiStateBuffer, true);
|
||||
ArraySetAsSeries(sarStateBuffer, true);
|
||||
ArraySetAsSeries(atrUpperBuffer, true);
|
||||
ArraySetAsSeries(atrLowerBuffer, true);
|
||||
@@ -605,6 +631,20 @@ struct X121XCatbConditions
|
||||
isSarSwitchedToBullish = false;
|
||||
isSarSwitchedToBearish = false;
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
isKIBullish = false;
|
||||
isKIBearish = false;
|
||||
|
||||
//
|
||||
isKISameAsLast = false;
|
||||
|
||||
//
|
||||
isKISwitchedToBullish = false;
|
||||
isKISwitchedToBearish = false;
|
||||
|
||||
//
|
||||
// ADX ...
|
||||
|
||||
@@ -799,6 +839,29 @@ struct X121XCatbConditions
|
||||
bearishScore += score;
|
||||
}
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
if (isKIBullish)
|
||||
{
|
||||
bullishScore += score;
|
||||
}
|
||||
if (isKISwitchedToBullish)
|
||||
{
|
||||
bullishScore += score;
|
||||
}
|
||||
|
||||
//
|
||||
if (isKIBearish)
|
||||
{
|
||||
bearishScore += score;
|
||||
}
|
||||
if (isKISwitchedToBearish)
|
||||
{
|
||||
bearishScore += score;
|
||||
}
|
||||
|
||||
//
|
||||
// ADX ...
|
||||
|
||||
@@ -1121,6 +1184,15 @@ struct X121XCatbConditions
|
||||
ToString("isClosedUnderATRLower", isClosedUnderATRLower, ignoreFalseConditions, separator) +
|
||||
//
|
||||
"-----------------------" + separator +
|
||||
"KI: " + separator +
|
||||
"-----------------------" + separator +
|
||||
ToString("isKIBullish", isKIBullish, ignoreFalseConditions, separator) +
|
||||
ToString("isKIBearish", isKIBearish, ignoreFalseConditions, separator) +
|
||||
ToString("isKISameAsLast", isKISameAsLast, ignoreFalseConditions, separator) +
|
||||
ToString("isKISwitchedToBullish", isKISwitchedToBullish, ignoreFalseConditions, separator) +
|
||||
ToString("isKISwitchedToBearish", isKISwitchedToBearish, ignoreFalseConditions, separator) +
|
||||
//
|
||||
"-----------------------" + separator +
|
||||
"SAR: " + separator +
|
||||
"-----------------------" + separator +
|
||||
ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) +
|
||||
@@ -1264,6 +1336,7 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
double kiBuffer[];
|
||||
double sarBuffer[];
|
||||
double atrBuffer[];
|
||||
double rsiBuffer[];
|
||||
@@ -1286,6 +1359,7 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
double hkOpenBuffer[];
|
||||
double hkHighBuffer[];
|
||||
double hkCloseBuffer[];
|
||||
double kiStateBuffer[];
|
||||
double sarStateBuffer[];
|
||||
double atrUpperBuffer[];
|
||||
double atrLowerBuffer[];
|
||||
@@ -1412,6 +1486,7 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
}
|
||||
|
||||
//
|
||||
ArraySetAsSeries(kiBuffer, true);
|
||||
ArraySetAsSeries(sarBuffer, true);
|
||||
ArraySetAsSeries(atrBuffer, true);
|
||||
ArraySetAsSeries(rsiBuffer, true);
|
||||
@@ -1434,6 +1509,7 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
ArraySetAsSeries(hkOpenBuffer, true);
|
||||
ArraySetAsSeries(hkHighBuffer, true);
|
||||
ArraySetAsSeries(hkCloseBuffer, true);
|
||||
ArraySetAsSeries(kiStateBuffer, true);
|
||||
ArraySetAsSeries(sarStateBuffer, true);
|
||||
ArraySetAsSeries(atrUpperBuffer, true);
|
||||
ArraySetAsSeries(atrLowerBuffer, true);
|
||||
@@ -1470,6 +1546,7 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
mInputs.appliedCycle,
|
||||
"", // Presentation ...
|
||||
mInputs.showBars,
|
||||
mInputs.showKI,
|
||||
mInputs.showPV,
|
||||
mInputs.showPVGolden,
|
||||
mInputs.showSar,
|
||||
@@ -1963,6 +2040,113 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
//
|
||||
// Readers ...
|
||||
|
||||
//
|
||||
// Readers ...
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
|
||||
//
|
||||
double GetKI(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(kiBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return kiBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyKI(
|
||||
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,
|
||||
kiBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// KI State ...
|
||||
|
||||
//
|
||||
double GetKIState(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(kiStateBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return kiStateBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyKIState(
|
||||
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,
|
||||
kiStateBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
|
||||
@@ -3996,6 +4180,19 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
CopyKI(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.kiBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyKIState(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.kiStateBuffer //
|
||||
);
|
||||
|
||||
CopySar(
|
||||
zIndex,
|
||||
loopback,
|
||||
@@ -4281,6 +4478,23 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
double p2ATRLower = conditions.atrLowerBuffer[p2IDX];
|
||||
double p3ATRLower = conditions.atrLowerBuffer[p3IDX];
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
double zKI = conditions.kiBuffer[zIDX];
|
||||
double cKI = conditions.kiBuffer[cIDX];
|
||||
double pKI = conditions.kiBuffer[pIDX];
|
||||
double p2KI = conditions.kiBuffer[p2IDX];
|
||||
double p3KI = conditions.kiBuffer[p3IDX];
|
||||
|
||||
//
|
||||
double zKIState = conditions.kiStateBuffer[zIDX];
|
||||
double cKIState = conditions.kiStateBuffer[cIDX];
|
||||
double pKIState = conditions.kiStateBuffer[pIDX];
|
||||
double p2KIState = conditions.kiStateBuffer[p2IDX];
|
||||
double p3KIState = conditions.kiStateBuffer[p3IDX];
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
|
||||
@@ -4471,6 +4685,26 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
bool isClosedUnderATRLower =
|
||||
conditions.bars[cIDX].close < cATRLower;
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
bool isKIBullish = cKIState > 0;
|
||||
bool isKIBearish = cKIState < 0;
|
||||
|
||||
//
|
||||
bool isKISameAsLast = cKI == pKI;
|
||||
|
||||
//
|
||||
bool isKISwitchedToBullish =
|
||||
cKIState > 0 &&
|
||||
pKIState <= 0;
|
||||
|
||||
//
|
||||
bool isKISwitchedToBearish =
|
||||
cKIState < 0 &&
|
||||
pKIState >= 0;
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
|
||||
@@ -4747,6 +4981,8 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
conditions.rsiOSLevel = _rsiOSLevel;
|
||||
conditions.isDeltaDown = isDeltaDown;
|
||||
conditions.isTrendDown = isTrendDown;
|
||||
conditions.isKIBullish = isKIBullish;
|
||||
conditions.isKIBearish = isKIBearish;
|
||||
conditions.adxThreshold = _adxThreshold;
|
||||
conditions.isSarBullish = isSarBullish;
|
||||
conditions.isSarBearish = isSarBearish;
|
||||
@@ -4756,6 +4992,7 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
conditions.isRSIBearish = isRSIBearish;
|
||||
conditions.isSBarBullish = isSBarBullish;
|
||||
conditions.isSBarBearish = isSBarBearish;
|
||||
conditions.isKISameAsLast = isKISameAsLast;
|
||||
conditions.isDeltaBullish = isDeltaBullish;
|
||||
conditions.isDeltaBearish = isDeltaBearish;
|
||||
conditions.isTrendBullish = isTrendBullish;
|
||||
@@ -4781,6 +5018,8 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
conditions.isRSICrossedUnderOS = isRSICrossedUnderOS;
|
||||
conditions.isADXUnderThreshold = isADXUnderThreshold;
|
||||
conditions.isClosedOverATRUpper = isClosedOverATRUpper;
|
||||
conditions.isKISwitchedToBullish = isKISwitchedToBullish;
|
||||
conditions.isKISwitchedToBearish = isKISwitchedToBearish;
|
||||
conditions.isClosedUnderATRLower = isClosedUnderATRLower;
|
||||
conditions.isSarSwitchedToBullish = isSarSwitchedToBullish;
|
||||
conditions.isSarSwitchedToBearish = isSarSwitchedToBearish;
|
||||
@@ -4836,6 +5075,24 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XCATB_KI_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
kiBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XCATB_KI_STATE_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
kiStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
@@ -5175,6 +5432,18 @@ class XCX121XCatbHelper : public XCBaseHelper
|
||||
int maxAllowed = 100 //
|
||||
)
|
||||
{
|
||||
//
|
||||
CleanupArray(
|
||||
kiBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
kiStateBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
sarBuffer,
|
||||
|
||||
Reference in New Issue
Block a user