add POI Detector and Drawer for XCATB classes ...
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "../Classes/x-saherelm.x-trade.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-volume.class.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xcatb.helper.mq5"
|
||||
#include "../XCATBEA/Classes/xcatbea.signaller.class.mq5"
|
||||
#include "../XCATBEA/Classes/xcatbea.x-trade.manager.class.mq5"
|
||||
#include "../XCATBEA/Libraries/xcatbea.signaller.lib.mq5"
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -80,6 +80,7 @@ input ENUM_X_MARKET_CYCLES appliedCycle = X_MARKET_CYCLE_HIND; // Applied Cycle
|
||||
// Presentation ...
|
||||
input group "Presentation";
|
||||
input bool showBars = true; // Show Bars
|
||||
input bool showKI = false; // Show KI
|
||||
input bool showPV = false; // Show PV
|
||||
input bool showPVGolden = false; // Show PV Golden
|
||||
input bool showSar = false; // Show Sar
|
||||
@@ -98,6 +99,7 @@ double sarMax = 0.2; // Maximum
|
||||
double rsiOBLevel = 70.0; // RSI OB Level
|
||||
double rsiOSLevel = 30.0; // RSI OS Level
|
||||
double adxThreshold = 25.0; // ADX Threshold
|
||||
int kiLength = 144; // KI Length
|
||||
int sarArrowCode = 159; // Parabolic Sar Arrow Code
|
||||
int peakArrowCode = 159; // Peaks Arrow Code
|
||||
int valeArrowCode = 159; // Vales Arrow Code
|
||||
@@ -144,8 +146,8 @@ ENUM_X_MA_METHOD volumeSignalMethod = X_MA_MODE_EMA; // Volume Signalling Method
|
||||
// Color: 4
|
||||
// Bar: 8
|
||||
// Data Buffer: 19
|
||||
#property indicator_buffers 49
|
||||
#property indicator_plots 18
|
||||
#property indicator_buffers 52
|
||||
#property indicator_plots 19
|
||||
|
||||
//
|
||||
// Plot Buffers ...
|
||||
@@ -447,11 +449,30 @@ double hLLBuffer[];
|
||||
#property indicator_style18 STYLE_DOT
|
||||
#property indicator_width18 1
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
#define kiBufferIndex 28
|
||||
#define kiBufferPlotIndex 18
|
||||
double kiBuffer[];
|
||||
|
||||
//
|
||||
#define kiColorBufferIndex 29
|
||||
double kiColorBuffer[];
|
||||
|
||||
//
|
||||
#property indicator_label19 "KI"
|
||||
#property indicator_type19 DRAW_COLOR_LINE
|
||||
#property indicator_color19 CLR_NONE, clrGreen, clrRed, clrGray
|
||||
#property indicator_style19 STYLE_DASHDOTDOT
|
||||
#property indicator_width19 2
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
//
|
||||
#define mLastBufferIndex 27
|
||||
#define mLastBufferIndex 29
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
@@ -553,6 +574,13 @@ double lowHKBuffer[];
|
||||
#define closeHKBufferIndex mLastBufferIndex + 19
|
||||
double closeHKBuffer[];
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
#define kiStateBufferIndex mLastBufferIndex + 20
|
||||
double kiStateBuffer[];
|
||||
|
||||
//
|
||||
// Variables, Properties and etc ...
|
||||
|
||||
@@ -1288,6 +1316,21 @@ void DefineBuffers()
|
||||
PlotIndexSetInteger(hLLBufferPlotIndex, PLOT_DRAW_TYPE, hDrawType);
|
||||
PlotIndexSetDouble(hLLBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
ArraySetAsSeries(kiBuffer, true);
|
||||
SetIndexBuffer(kiBufferIndex, kiBuffer, INDICATOR_DATA);
|
||||
|
||||
//
|
||||
PlotIndexSetInteger(kiBufferPlotIndex, PLOT_SHOW_DATA, showKI);
|
||||
PlotIndexSetDouble(kiBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(kiColorBuffer, true);
|
||||
SetIndexBuffer(kiColorBufferIndex, kiColorBuffer, INDICATOR_COLOR_INDEX);
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
@@ -1374,6 +1417,13 @@ void DefineBuffers()
|
||||
ArraySetAsSeries(closeHKBuffer, true);
|
||||
SetIndexBuffer(closeHKBufferIndex, closeHKBuffer, INDICATOR_CALCULATIONS);
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
ArraySetAsSeries(kiStateBuffer, true);
|
||||
SetIndexBuffer(kiStateBufferIndex, kiStateBuffer, INDICATOR_DATA);
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
@@ -1684,6 +1734,7 @@ void CalculateBuffers(
|
||||
void FillBuffersZero(int barIndex)
|
||||
{
|
||||
//
|
||||
kiColorBuffer[barIndex] = hideColorIDX;
|
||||
sarColorBuffer[barIndex] = hideColorIDX;
|
||||
trendColorBuffer[barIndex] = hideColorIDX;
|
||||
|
||||
@@ -1741,6 +1792,19 @@ void CalculateValues(
|
||||
tickVolume //
|
||||
);
|
||||
|
||||
//
|
||||
// KI ...
|
||||
CalculateKI(
|
||||
barIndex,
|
||||
prevCalculated,
|
||||
ratesTotal,
|
||||
open,
|
||||
high,
|
||||
close,
|
||||
low,
|
||||
tickVolume //
|
||||
);
|
||||
|
||||
//
|
||||
// PV ...
|
||||
CalculatePV(
|
||||
@@ -1895,6 +1959,90 @@ void CalculateCycleRanges(
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
void CalculateKI(
|
||||
int barIndex,
|
||||
const int prevCalculated,
|
||||
const int ratesTotal,
|
||||
const double &open[],
|
||||
const double &high[],
|
||||
const double &close[],
|
||||
const double &low[],
|
||||
const long &tickVolume[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
int lastBarIndex = barIndex + 1;
|
||||
bool isFirstBar =
|
||||
startCalculationForLastBars > 0
|
||||
? barIndex == startCalculationForLastBars
|
||||
: barIndex == firstBarIndex;
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isInited = iBar.Init(
|
||||
_Symbol,
|
||||
_Period,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
double iClose = close[barIndex];
|
||||
|
||||
//
|
||||
// Calculate KI / Color ...
|
||||
double lastKI =
|
||||
isFirstBar
|
||||
? emptyValue
|
||||
: kiBuffer[lastBarIndex];
|
||||
double iKI = lastKI;
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
double iLLKI = iBar.FindLowest(kiLength, MODE_LOW);
|
||||
double iHHKI = iBar.FindHighest(kiLength, MODE_HIGH);
|
||||
|
||||
//
|
||||
iKI = (iHHKI + iLLKI) / 2;
|
||||
if (iLLKI == 0 || iHHKI == 0)
|
||||
{
|
||||
iKI = lastKI;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iKI = lastKI;
|
||||
}
|
||||
kiBuffer[barIndex] = iKI;
|
||||
|
||||
//
|
||||
double iKIState = neuturalState;
|
||||
double iKIColor = neuturalColorIDX;
|
||||
if (iClose > iKI)
|
||||
{
|
||||
//
|
||||
iKIState = bullishState;
|
||||
iKIColor =
|
||||
!showKI
|
||||
? hideColorIDX
|
||||
: bullishColorIDX;
|
||||
}
|
||||
else if (iClose < iKI)
|
||||
{
|
||||
//
|
||||
iKIState = bearishState;
|
||||
iKIColor =
|
||||
!showKI
|
||||
? hideColorIDX
|
||||
: bearishColorIDX;
|
||||
}
|
||||
kiStateBuffer[barIndex] = iKIState;
|
||||
kiColorBuffer[barIndex] = iKIColor;
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
void CalculatePV(
|
||||
int barIndex,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Indicator
|
||||
// SaherElm IT Center MQL5 Class
|
||||
// -------------------------------------------------
|
||||
// Name: XCXCATBEASignaller ...
|
||||
// Description: Class for XCATBEA Signaller ...
|
||||
@@ -17,16 +17,22 @@
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property description "SaherElm Class for XCATBEA Signaller"
|
||||
#property description "SaherElm XCXCATBEASignaller Class"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../../Classes/x-saherelm.x-alert.class.mq5"
|
||||
#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5"
|
||||
#include "../../Helpers/x-saherelm.x121.xcatb.helper.mq5";
|
||||
#include "../Classes/xcatbea.x-poi.detector.class.mq5";
|
||||
#include "../Classes/xcatbea.x-poi.drawer.class.mq5";
|
||||
#include "../Libraries/xcatbea.lib.mq5";
|
||||
#include "../Libraries/xcatbea.signaller.lib.mq5";
|
||||
#include "../Libraries/xcatbea.x-poi.extensions.lib.mq5";
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
class XCXCATBEASignaller : XCBase
|
||||
class XCXCATBEASignaller : XCBaseAlert
|
||||
{
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,604 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Class
|
||||
// -------------------------------------------------
|
||||
// Name: XCXCATBEAPOIDrawer ...
|
||||
// Description: XCATBEA POI Drawer Class
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property description "SaherElm XCATBEA POI Drawer Class"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
||||
#include "../Classes/xcatbea.x-poi.detector.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
struct XCAPivotStyle
|
||||
{
|
||||
//
|
||||
// Properties ...
|
||||
int width;
|
||||
color clr;
|
||||
ENUM_LINE_STYLE style;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XCAPivotStyle()
|
||||
{
|
||||
Default();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
//
|
||||
// Cleanup Model ...
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
width = 1;
|
||||
clr = CLR_NONE;
|
||||
style = STYLE_SOLID;
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
//
|
||||
// Default Props ...
|
||||
void Default()
|
||||
{
|
||||
//
|
||||
width = 1;
|
||||
clr = CLR_NONE;
|
||||
style = STYLE_SOLID;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Implementations ...
|
||||
class XCXCATBEAPOIDrawer : public XCBase
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
XCPOIDrawer *drawer;
|
||||
|
||||
//
|
||||
// Drawers ...
|
||||
bool drawPeakPivots;
|
||||
bool drawValePivots;
|
||||
|
||||
//
|
||||
// Styling ...
|
||||
|
||||
//
|
||||
XCAPivotStyle defaultBullishStyle;
|
||||
XCAPivotStyle defaultBearishStyle;
|
||||
|
||||
//
|
||||
XCAPivotStyle peakPivotStyle;
|
||||
XCAPivotStyle valePivotStyle;
|
||||
|
||||
//
|
||||
// Constructors ...
|
||||
XCXCATBEAPOIDrawer(
|
||||
XCXCATBEAPOIDetector *_detector //
|
||||
)
|
||||
{
|
||||
//
|
||||
detector = _detector;
|
||||
drawer = new XCPOIDrawer();
|
||||
|
||||
//
|
||||
Default();
|
||||
}
|
||||
|
||||
//
|
||||
// De Constructors ...
|
||||
~XCXCATBEAPOIDrawer()
|
||||
{
|
||||
//
|
||||
Clear();
|
||||
|
||||
//
|
||||
delete drawer;
|
||||
ZeroMemory(drawer);
|
||||
|
||||
//
|
||||
ZeroMemory(detector);
|
||||
}
|
||||
|
||||
//
|
||||
// Properties ...
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
//
|
||||
virtual void Default()
|
||||
{
|
||||
//
|
||||
// Drawing ...
|
||||
drawPeakPivots = false;
|
||||
drawValePivots = false;
|
||||
|
||||
//
|
||||
// Styling ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
defaultBullishStyle.width = 1;
|
||||
defaultBullishStyle.clr = clrLime;
|
||||
defaultBullishStyle.style = STYLE_SOLID;
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
defaultBearishStyle.width = 1;
|
||||
defaultBearishStyle.clr = clrRed;
|
||||
defaultBearishStyle.style = STYLE_SOLID;
|
||||
|
||||
//
|
||||
// Pivots ...
|
||||
|
||||
//
|
||||
// PV ...
|
||||
peakPivotStyle = defaultBearishStyle;
|
||||
valePivotStyle = defaultBullishStyle;
|
||||
}
|
||||
|
||||
//
|
||||
void Draw(datetime to = NULL)
|
||||
{
|
||||
//
|
||||
// PV ...
|
||||
DrawPeakPivots(to);
|
||||
DrawValePivots(to);
|
||||
}
|
||||
|
||||
//
|
||||
void DrawPivot(
|
||||
XBoxZone &pivot,
|
||||
datetime to = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
DrawBox(
|
||||
pivot,
|
||||
to,
|
||||
false,
|
||||
false //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
void DrawBox(
|
||||
XBoxZone &box,
|
||||
datetime to = NULL,
|
||||
bool drawMiddle = false,
|
||||
bool ignoreType = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool has = box.IsValid();
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool canUpdateTo = IsValid(to);
|
||||
if (canUpdateTo)
|
||||
{
|
||||
box.to = to;
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Box as POI ...
|
||||
if (!ignoreType)
|
||||
{
|
||||
//
|
||||
// Detect Pivot Type ...
|
||||
ENUM_XCATB_PIVOTS iType = GetPivotType(box);
|
||||
has = IsValid(iType);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
switch (iType)
|
||||
{
|
||||
//
|
||||
case XCA_PEAK:
|
||||
//
|
||||
DrawPeakPivot(
|
||||
box,
|
||||
to //
|
||||
);
|
||||
break;
|
||||
|
||||
//
|
||||
case XCA_VALE:
|
||||
//
|
||||
DrawValePivot(
|
||||
box,
|
||||
to //
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Draw Regular Box ...
|
||||
else
|
||||
{
|
||||
//
|
||||
// Select Styling Config ...
|
||||
XCAPivotStyle style;
|
||||
|
||||
//
|
||||
if (box.IsBullish())
|
||||
{
|
||||
style = defaultBullishStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
style = defaultBearishStyle;
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Box itself ...
|
||||
XCBoxObject *iBoxObj;
|
||||
has = drawer.DrawBox(
|
||||
box,
|
||||
iBoxObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Style Object ...
|
||||
ApplyPivotStyle(
|
||||
iBoxObj,
|
||||
style //
|
||||
);
|
||||
|
||||
//
|
||||
// Store Object ...
|
||||
mObjects.Add(iBoxObj);
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Box Middle Range ...
|
||||
if (drawMiddle)
|
||||
{
|
||||
//
|
||||
double middle = box.GetMid();
|
||||
string middleName = box.GetMiddleTag();
|
||||
|
||||
//
|
||||
CChartObjectTrend *iMidObj;
|
||||
iMidObj = new CChartObjectTrend();
|
||||
has = iMidObj.Create(
|
||||
drawer.ChartIdentification(),
|
||||
middleName,
|
||||
drawer.SubWindowIdentification(),
|
||||
box.from,
|
||||
middle,
|
||||
box.to,
|
||||
middle //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Styling Object ...
|
||||
iMidObj.Color(style.clr);
|
||||
iMidObj.Width(style.width);
|
||||
iMidObj.Style(style.style);
|
||||
|
||||
//
|
||||
// Store Object ...
|
||||
mObjects.Add(iMidObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
style.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void DrawBoxes(
|
||||
XBoxZone &boxes[],
|
||||
datetime to = NULL,
|
||||
bool drawMiddle = false,
|
||||
bool ignoreType = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool has = HasChild(boxes);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(boxes);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = boxes[i];
|
||||
|
||||
//
|
||||
// Detect Pivot Type ...
|
||||
DrawBox(
|
||||
iBox,
|
||||
to,
|
||||
drawMiddle,
|
||||
ignoreType //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void Clear()
|
||||
{
|
||||
//
|
||||
// Cleanup Models ...
|
||||
defaultBullishStyle.Clean();
|
||||
defaultBearishStyle.Clean();
|
||||
|
||||
//
|
||||
// Cleanup Styles ...
|
||||
peakPivotStyle.Clean();
|
||||
valePivotStyle.Clean();
|
||||
|
||||
//
|
||||
// Cleanup Pivot Objects Holder ...
|
||||
mObjects.Clear();
|
||||
mPeakPivotObjects.Clear();
|
||||
mValePivotObjects.Clear();
|
||||
}
|
||||
|
||||
//
|
||||
// Collection Drawers ...
|
||||
|
||||
//
|
||||
void DrawPeakPivots(datetime to = NULL)
|
||||
{
|
||||
//
|
||||
bool has = drawPeakPivots;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
has = detector.HasPeakPivots();
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int count = detector.CountPeakPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = detector.peakPivots[i];
|
||||
|
||||
//
|
||||
DrawPeakPivot(
|
||||
iBox,
|
||||
to //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void DrawValePivots(datetime to = NULL)
|
||||
{
|
||||
//
|
||||
bool has = drawValePivots;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
has = detector.HasValePivots();
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int count = detector.CountValePivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = detector.valePivots[i];
|
||||
|
||||
//
|
||||
DrawValePivot(
|
||||
iBox,
|
||||
to //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// One Item Drawers ...
|
||||
|
||||
//
|
||||
void DrawPeakPivot(
|
||||
XBoxZone &item,
|
||||
datetime to = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool has = drawPeakPivots;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
has = item.IsValid() &&
|
||||
item.type == GetBoxType(XCA_PEAK) &&
|
||||
item.dir == GetDirection(XCA_PEAK);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool canUpdateTo = IsValid(to);
|
||||
if (canUpdateTo)
|
||||
{
|
||||
item.to = to;
|
||||
}
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = drawer.DrawBox(
|
||||
item,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Style Object ...
|
||||
ApplyPivotStyle(
|
||||
iObj,
|
||||
peakPivotStyle //
|
||||
);
|
||||
|
||||
//
|
||||
// Store Object ...
|
||||
mPeakPivotObjects.Add(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
ZeroMemory(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
void DrawValePivot(
|
||||
XBoxZone &item,
|
||||
datetime to = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool has = drawValePivots;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
has = item.IsValid() &&
|
||||
item.type == GetBoxType(XCA_VALE) &&
|
||||
item.dir == GetDirection(XCA_VALE);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool canUpdateTo = IsValid(to);
|
||||
if (canUpdateTo)
|
||||
{
|
||||
item.to = to;
|
||||
}
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = drawer.DrawBox(
|
||||
item,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Style Object ...
|
||||
ApplyPivotStyle(
|
||||
iObj,
|
||||
valePivotStyle //
|
||||
);
|
||||
|
||||
//
|
||||
// Store Object ...
|
||||
mValePivotObjects.Add(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
ZeroMemory(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
void ApplyPivotStyle(
|
||||
XCBoxObject *&object,
|
||||
XCAPivotStyle &style //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (object == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
object.BoxColor(style.clr);
|
||||
object.BoxWidth(style.width);
|
||||
object.BoxStyle(style.style);
|
||||
}
|
||||
|
||||
//
|
||||
// Prrivate ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
XCXCATBEAPOIDetector *detector;
|
||||
|
||||
//
|
||||
CArrayObj mObjects;
|
||||
|
||||
//
|
||||
CArrayObj mPeakPivotObjects;
|
||||
CArrayObj mValePivotObjects;
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
@@ -0,0 +1,83 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Library
|
||||
// -------------------------------------------------
|
||||
// Name: XCATBEAPOIExtension Lib
|
||||
// Description: Library for Adding Extensions on
|
||||
// XCATBEA POI(s) ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property description "SaherElm Extensions Library for XCATBEA POI(s)"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../Classes/xcatbea.x-poi.detector.class.mq5";
|
||||
|
||||
//
|
||||
// Extensions ...
|
||||
|
||||
//
|
||||
int ExtractPivots(
|
||||
XBoxZone &extracted[],
|
||||
ENUM_XCATB_PIVOTS type,
|
||||
XBoxZone &source[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
Clean(extracted);
|
||||
|
||||
//
|
||||
bool has =
|
||||
IsValid(type) &&
|
||||
HasChild(source);
|
||||
if (!has)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(source);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = source[i];
|
||||
|
||||
//
|
||||
ENUM_XCATB_PIVOTS iType = GetPivotType(iBox);
|
||||
|
||||
//
|
||||
has = iType == type;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
iBox,
|
||||
extracted //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(extracted);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user