last ...
This commit is contained in:
@@ -346,7 +346,7 @@ void OnTick()
|
||||
// Execute Signal ...
|
||||
|
||||
//
|
||||
has =eaTradeManager.Execute(
|
||||
has = eaTradeManager.Execute(
|
||||
eaSignal,
|
||||
eaConditions //
|
||||
);
|
||||
|
||||
@@ -51,13 +51,13 @@ enum ENUM_X121_XCA_BUFFERS
|
||||
X121_XCA_FIBO_L3_LINE = 16,
|
||||
X121_XCA_SAR_LINE = 17,
|
||||
X121_XCA_TREND_LINE = 18,
|
||||
X121_XCA_TREND_STATE_LINE = 24,
|
||||
X121_XCA_KI_LINE = 20,
|
||||
X121_XCA_KI_STATE_LINE = 25,
|
||||
X121_XCA_SWING_LOW_LINE = 22,
|
||||
X121_XCA_SWING_HIGH_LINE = 23,
|
||||
X121_XCA_TKI_LINE = 24,
|
||||
X121_XCA_TKI_STATE_LINE = 30,
|
||||
X121_XCA_TREND_STATE_LINE = 26,
|
||||
X121_XCA_KI_STATE_LINE = 27,
|
||||
X121_XCA_TKI_STATE_LINE = 28,
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
@@ -479,17 +479,17 @@ double trendStateBuffer[];
|
||||
double kiStateBuffer[];
|
||||
|
||||
//
|
||||
#define supBufferIndex mLastBufferIndex + 3
|
||||
#define tkiStateBufferIndex mLastBufferIndex + 3
|
||||
double tkiStateBuffer[];
|
||||
|
||||
//
|
||||
#define supBufferIndex mLastBufferIndex + 4
|
||||
double supBuffer[];
|
||||
|
||||
//
|
||||
#define resBufferIndex mLastBufferIndex + 4
|
||||
#define resBufferIndex mLastBufferIndex + 5
|
||||
double resBuffer[];
|
||||
|
||||
//
|
||||
#define tkiStateBufferIndex mLastBufferIndex + 5
|
||||
double tkiStateBuffer[];
|
||||
|
||||
//
|
||||
// Variables, Properties and etc ...
|
||||
|
||||
|
||||
@@ -5458,6 +5458,11 @@ struct XBoxZone
|
||||
*/
|
||||
string GetTag()
|
||||
{
|
||||
//
|
||||
int digits = GetDigits(symbol);
|
||||
double nUpper = NormalizeDouble(NormalizePrice(upper, symbol), digits);
|
||||
double nLower = NormalizeDouble(NormalizePrice(lower, symbol), digits);
|
||||
|
||||
//
|
||||
string typeStr = IsValid(type)
|
||||
? type + "_"
|
||||
@@ -5468,8 +5473,8 @@ struct XBoxZone
|
||||
ToString(dir) + "_" +
|
||||
symbol + "_" +
|
||||
ToString(period) + "_" +
|
||||
ToString(upper) + "_" +
|
||||
ToString(lower)
|
||||
ToString(nUpper) + "_" +
|
||||
ToString(nLower)
|
||||
//
|
||||
;
|
||||
|
||||
|
||||
@@ -36,8 +36,14 @@ enum ENUM_XCA_PIVOTS
|
||||
XCA_SWH, // SWH
|
||||
XCA_VALE, // VALE
|
||||
XCA_PEAK, // PEAK
|
||||
XCA_KI_BULL, // KIBull
|
||||
XCA_KI_BEAR, // KIBear
|
||||
XCA_TKI_BULL, // TKIBull
|
||||
XCA_TKI_BEAR, // TKIBear
|
||||
XCA_PEAKSWHRES, // PeakSWHRes
|
||||
XCA_VALESWLSUP, // ValeSWLSup
|
||||
XCA_TREND_BULL, // Trend Bullish
|
||||
XCA_TREND_BEAR, // Trend Bearish
|
||||
};
|
||||
|
||||
//
|
||||
@@ -79,6 +85,9 @@ struct XCAPivot
|
||||
ENUM_XCA_PIVOTS type;
|
||||
ENUM_TIMEFRAMES period;
|
||||
|
||||
//
|
||||
double values[];
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XCAPivot()
|
||||
@@ -102,6 +111,9 @@ struct XCAPivot
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
type = XCA_NONE;
|
||||
|
||||
//
|
||||
Clean(values);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,6 +316,9 @@ struct XCAPivot
|
||||
//
|
||||
case XCA_SWL:
|
||||
case XCA_VALE:
|
||||
case XCA_KI_BULL:
|
||||
case XCA_TKI_BULL:
|
||||
case XCA_TREND_BULL:
|
||||
case XCA_VALESWLSUP:
|
||||
iDir = X_DIRECTION_BULLISH;
|
||||
break;
|
||||
@@ -311,6 +326,9 @@ struct XCAPivot
|
||||
//
|
||||
case XCA_SWH:
|
||||
case XCA_PEAK:
|
||||
case XCA_KI_BEAR:
|
||||
case XCA_TKI_BEAR:
|
||||
case XCA_TREND_BEAR:
|
||||
case XCA_PEAKSWHRES:
|
||||
iDir = X_DIRECTION_BEARISH;
|
||||
break;
|
||||
@@ -347,7 +365,28 @@ struct XCAPivot
|
||||
box.from = from;
|
||||
box.symbol = symbol;
|
||||
box.period = period;
|
||||
box.type = ToString(type);
|
||||
|
||||
//
|
||||
string typeStr = ToString(type);
|
||||
if (type == XCA_KI_BULL ||
|
||||
type == XCA_KI_BEAR)
|
||||
{
|
||||
//
|
||||
typeStr = "XCA_KI";
|
||||
}
|
||||
else if (type == XCA_TKI_BULL ||
|
||||
type == XCA_TKI_BEAR)
|
||||
{
|
||||
//
|
||||
typeStr = "XCA_TKI";
|
||||
}
|
||||
else if (type == XCA_TREND_BULL ||
|
||||
type == XCA_TREND_BEAR)
|
||||
{
|
||||
//
|
||||
typeStr = "XCA_TREND";
|
||||
}
|
||||
box.type = typeStr;
|
||||
|
||||
//
|
||||
box.upper =
|
||||
@@ -438,8 +477,14 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
XCAPivot swlPivots[];
|
||||
XCAPivot peakPivots[];
|
||||
XCAPivot valePivots[];
|
||||
XCAPivot kiBullishPivots[];
|
||||
XCAPivot kiBearishPivots[];
|
||||
XCAPivot tkiBullishPivots[];
|
||||
XCAPivot tkiBearishPivots[];
|
||||
XCAPivot peakSWHResPivots[];
|
||||
XCAPivot valeSWLSupPivots[];
|
||||
XCAPivot trendBullishPivots[];
|
||||
XCAPivot trendBearishPivots[];
|
||||
|
||||
//
|
||||
// Constructors ...
|
||||
@@ -491,6 +536,7 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
virtual void Default()
|
||||
{
|
||||
//
|
||||
maxAllowedPivots = 50;
|
||||
pivotVerifications = 5;
|
||||
}
|
||||
|
||||
@@ -571,8 +617,23 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
// Checking Pivots ...
|
||||
|
||||
//
|
||||
// Peak Pivot ...
|
||||
bool detectSWHPivot = false;
|
||||
bool detectSWLPivot = false;
|
||||
bool detectPeakPivot = false;
|
||||
bool detectValePivot = false;
|
||||
bool detectKIBullishPivot = false;
|
||||
bool detectKIBearishPivot = false;
|
||||
bool detectTKIBullishPivot = false;
|
||||
bool detectTKIBearishPivot = false;
|
||||
bool detectPeakSWHResPivot = false;
|
||||
bool detectValeSWLSupPivot = false;
|
||||
bool detectTrendBullishPivot = true;
|
||||
bool detectTrendBearishPivot = true;
|
||||
|
||||
//
|
||||
// Peak Pivot ...
|
||||
if (detectPeakPivot)
|
||||
{
|
||||
//
|
||||
if (!peakPivot.IsValid())
|
||||
{
|
||||
@@ -621,10 +682,12 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
peakPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Peak SWH Res Pivot ...
|
||||
|
||||
if (detectPeakSWHResPivot)
|
||||
{
|
||||
//
|
||||
if (!peakSWHResPivot.IsValid())
|
||||
{
|
||||
@@ -672,10 +735,12 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
peakSWHResPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Vale Pivot ...
|
||||
|
||||
if (detectValePivot)
|
||||
{
|
||||
//
|
||||
if (!valePivot.IsValid())
|
||||
{
|
||||
@@ -723,10 +788,12 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
valePivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Vale SWL Sup Pivot ...
|
||||
|
||||
if (detectValeSWLSupPivot)
|
||||
{
|
||||
//
|
||||
if (!valeSWLSupPivot.IsValid())
|
||||
{
|
||||
@@ -774,10 +841,12 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
valeSWLSupPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// SWH Pivot ...
|
||||
|
||||
if (detectSWHPivot)
|
||||
{
|
||||
//
|
||||
if (!swhPivot.IsValid())
|
||||
{
|
||||
@@ -799,7 +868,6 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
if (iConditions.isSwingHighSameLast)
|
||||
{
|
||||
//
|
||||
swhPivot.from = pBar.time;
|
||||
}
|
||||
|
||||
@@ -827,10 +895,12 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
swhPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// SWL Pivot ...
|
||||
|
||||
if (detectSWLPivot)
|
||||
{
|
||||
//
|
||||
if (!swlPivot.IsValid())
|
||||
{
|
||||
@@ -852,7 +922,6 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
if (iConditions.isSwingLowSameLast)
|
||||
{
|
||||
//
|
||||
swlPivot.from = pBar.time;
|
||||
}
|
||||
|
||||
@@ -880,6 +949,389 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
swlPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// KI Bullish ...
|
||||
if (detectKIBullishPivot)
|
||||
{
|
||||
//
|
||||
if (!kiBullishPivot.IsValid())
|
||||
{
|
||||
//
|
||||
kiBullishPivot.type = XCA_KI_BULL;
|
||||
kiBullishPivot.symbol = iConditions.symbol;
|
||||
kiBullishPivot.period = iConditions.period;
|
||||
|
||||
//
|
||||
if (iConditions.isKIBullish)
|
||||
{
|
||||
//
|
||||
kiBullishPivot.to = cBar.time;
|
||||
kiBullishPivot.from = pBar.time;
|
||||
kiBullishPivot.value = iConditions.kiBuffer[cIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isKIBullish)
|
||||
{
|
||||
//
|
||||
kiBullishPivot.from = pBar.time;
|
||||
kiBullishPivot.value =
|
||||
kiBullishPivot.value == 0
|
||||
? iConditions.kiBuffer[cIDX]
|
||||
: MathMin(iConditions.kiBuffer[cIDX], kiBullishPivot.value);
|
||||
kiBullishPivot.reserve =
|
||||
kiBullishPivot.reserve == 0
|
||||
? iConditions.kiBuffer[cIDX]
|
||||
: MathMax(iConditions.kiBuffer[cIDX], kiBullishPivot.reserve);
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isKISwitchedToBullish)
|
||||
{
|
||||
//
|
||||
has =
|
||||
kiBullishPivot.IsValid() &&
|
||||
kiBullishPivot.GetAge() >= pivotVerifications;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddPivot(
|
||||
kiBullishPivot,
|
||||
kiBullishPivots //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
kiBullishPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// KI Bearish ...
|
||||
if (detectKIBearishPivot)
|
||||
{
|
||||
//
|
||||
if (!kiBearishPivot.IsValid())
|
||||
{
|
||||
//
|
||||
kiBearishPivot.type = XCA_KI_BEAR;
|
||||
kiBearishPivot.symbol = iConditions.symbol;
|
||||
kiBearishPivot.period = iConditions.period;
|
||||
|
||||
//
|
||||
if (iConditions.isKIBearish)
|
||||
{
|
||||
//
|
||||
kiBearishPivot.to = cBar.time;
|
||||
kiBearishPivot.from = pBar.time;
|
||||
kiBearishPivot.value = iConditions.kiBuffer[cIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isKIBearish)
|
||||
{
|
||||
//
|
||||
kiBearishPivot.from = pBar.time;
|
||||
kiBearishPivot.value =
|
||||
kiBearishPivot.value == 0
|
||||
? iConditions.kiBuffer[cIDX]
|
||||
: MathMax(iConditions.kiBuffer[cIDX], kiBearishPivot.value);
|
||||
kiBearishPivot.reserve =
|
||||
kiBearishPivot.reserve == 0
|
||||
? iConditions.kiBuffer[cIDX]
|
||||
: MathMin(iConditions.kiBuffer[cIDX], kiBearishPivot.reserve);
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isKISwitchedToBearish)
|
||||
{
|
||||
//
|
||||
has =
|
||||
kiBearishPivot.IsValid() &&
|
||||
kiBearishPivot.GetAge() >= pivotVerifications;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddPivot(
|
||||
kiBearishPivot,
|
||||
kiBearishPivots //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
kiBearishPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TKI Bullish ...
|
||||
if (detectTKIBullishPivot)
|
||||
{
|
||||
//
|
||||
if (!tkiBullishPivot.IsValid())
|
||||
{
|
||||
//
|
||||
tkiBullishPivot.type = XCA_TKI_BULL;
|
||||
tkiBullishPivot.symbol = iConditions.symbol;
|
||||
tkiBullishPivot.period = iConditions.period;
|
||||
|
||||
//
|
||||
if (iConditions.isTKIBullish)
|
||||
{
|
||||
//
|
||||
tkiBullishPivot.to = cBar.time;
|
||||
tkiBullishPivot.from = pBar.time;
|
||||
tkiBullishPivot.value = iConditions.tkiBuffer[cIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isTKIBullish)
|
||||
{
|
||||
//
|
||||
tkiBullishPivot.from = pBar.time;
|
||||
tkiBullishPivot.value =
|
||||
tkiBullishPivot.value == 0
|
||||
? iConditions.tkiBuffer[cIDX]
|
||||
: MathMin(iConditions.tkiBuffer[cIDX], tkiBullishPivot.value);
|
||||
tkiBullishPivot.reserve =
|
||||
tkiBullishPivot.reserve == 0
|
||||
? iConditions.tkiBuffer[cIDX]
|
||||
: MathMax(iConditions.tkiBuffer[cIDX], tkiBullishPivot.reserve);
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isTKISwitchedToBullish)
|
||||
{
|
||||
//
|
||||
has =
|
||||
tkiBullishPivot.IsValid() &&
|
||||
tkiBullishPivot.GetAge() >= pivotVerifications;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddPivot(
|
||||
tkiBullishPivot,
|
||||
tkiBullishPivots //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
tkiBullishPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TKI Bearish ...
|
||||
if (detectTKIBearishPivot)
|
||||
{
|
||||
//
|
||||
if (!tkiBearishPivot.IsValid())
|
||||
{
|
||||
//
|
||||
tkiBearishPivot.type = XCA_TKI_BEAR;
|
||||
tkiBearishPivot.symbol = iConditions.symbol;
|
||||
tkiBearishPivot.period = iConditions.period;
|
||||
|
||||
//
|
||||
if (iConditions.isTKIBearish)
|
||||
{
|
||||
//
|
||||
tkiBearishPivot.to = cBar.time;
|
||||
tkiBearishPivot.from = pBar.time;
|
||||
tkiBearishPivot.value = iConditions.tkiBuffer[cIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isTKIBearish)
|
||||
{
|
||||
//
|
||||
tkiBearishPivot.from = pBar.time;
|
||||
tkiBearishPivot.value =
|
||||
tkiBearishPivot.value == 0
|
||||
? iConditions.kiBuffer[cIDX]
|
||||
: MathMax(iConditions.kiBuffer[cIDX], tkiBearishPivot.value);
|
||||
tkiBearishPivot.reserve =
|
||||
tkiBearishPivot.reserve == 0
|
||||
? iConditions.kiBuffer[cIDX]
|
||||
: MathMin(iConditions.kiBuffer[cIDX], tkiBearishPivot.reserve);
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isTKISwitchedToBearish)
|
||||
{
|
||||
//
|
||||
has =
|
||||
tkiBearishPivot.IsValid() &&
|
||||
tkiBearishPivot.GetAge() >= pivotVerifications;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddPivot(
|
||||
tkiBearishPivot,
|
||||
tkiBearishPivots //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
tkiBearishPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TREND Bullish ...
|
||||
if (detectTrendBullishPivot)
|
||||
{
|
||||
//
|
||||
if (!trendBullishPivot.IsValid())
|
||||
{
|
||||
//
|
||||
trendBullishPivot.type = XCA_TREND_BULL;
|
||||
trendBullishPivot.symbol = iConditions.symbol;
|
||||
trendBullishPivot.period = iConditions.period;
|
||||
|
||||
//
|
||||
if (iConditions.isTrendBullish)
|
||||
{
|
||||
//
|
||||
trendBullishPivot.to = cBar.time;
|
||||
trendBullishPivot.from = pBar.time;
|
||||
trendBullishPivot.value = iConditions.trendBuffer[cIDX];
|
||||
trendBullishPivot.reserve = iConditions.trendBuffer[cIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isTrendBullish)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iConditions.trendBuffer[cIDX],
|
||||
trendBullishPivot.values //
|
||||
);
|
||||
|
||||
//
|
||||
trendBullishPivot.from = pBar.time;
|
||||
|
||||
//
|
||||
trendBullishPivot.value =
|
||||
trendBullishPivot.value == 0
|
||||
? iConditions.trendBuffer[cIDX]
|
||||
: MathMin(iConditions.trendBuffer[cIDX], trendBullishPivot.value);
|
||||
trendBullishPivot.reserve =
|
||||
trendBullishPivot.reserve == 0
|
||||
? iConditions.trendBuffer[cIDX]
|
||||
: MathMax(iConditions.trendBuffer[cIDX], trendBullishPivot.reserve);
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isTrendSwitchedToBullish)
|
||||
{
|
||||
//
|
||||
has =
|
||||
trendBullishPivot.IsValid() &&
|
||||
trendBullishPivot.GetAge() >= pivotVerifications;
|
||||
if (has)
|
||||
{
|
||||
// //
|
||||
// double ivMin = GetMin(trendBullishPivot.values);
|
||||
// double ivMax = GetMax(trendBullishPivot.values);
|
||||
|
||||
// //
|
||||
// trendBullishPivot.value = ivMin;
|
||||
// trendBullishPivot.reserve = ivMax;
|
||||
|
||||
//
|
||||
AddPivot(
|
||||
trendBullishPivot,
|
||||
trendBullishPivots //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
trendBullishPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TREND Bearish ...
|
||||
if (detectTrendBearishPivot)
|
||||
{
|
||||
//
|
||||
if (!trendBearishPivot.IsValid())
|
||||
{
|
||||
//
|
||||
trendBearishPivot.type = XCA_TREND_BEAR;
|
||||
trendBearishPivot.symbol = iConditions.symbol;
|
||||
trendBearishPivot.period = iConditions.period;
|
||||
|
||||
//
|
||||
if (iConditions.isTrendBearish)
|
||||
{
|
||||
//
|
||||
trendBearishPivot.to = cBar.time;
|
||||
trendBearishPivot.from = pBar.time;
|
||||
trendBearishPivot.value = iConditions.trendBuffer[cIDX];
|
||||
trendBearishPivot.reserve = iConditions.trendBuffer[cIDX];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isTrendBearish)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iConditions.trendBuffer[cIDX],
|
||||
trendBearishPivot.values //
|
||||
);
|
||||
|
||||
//
|
||||
trendBearishPivot.from = pBar.time;
|
||||
|
||||
//
|
||||
trendBearishPivot.value =
|
||||
trendBearishPivot.value == 0
|
||||
? iConditions.trendBuffer[cIDX]
|
||||
: MathMax(iConditions.trendBuffer[cIDX], trendBearishPivot.value);
|
||||
trendBearishPivot.reserve =
|
||||
trendBearishPivot.reserve == 0
|
||||
? iConditions.trendBuffer[cIDX]
|
||||
: MathMin(iConditions.trendBuffer[cIDX], trendBearishPivot.reserve);
|
||||
}
|
||||
|
||||
//
|
||||
if (iConditions.isTrendSwitchedToBearish)
|
||||
{
|
||||
//
|
||||
has =
|
||||
trendBearishPivot.IsValid() &&
|
||||
trendBearishPivot.GetAge() >= pivotVerifications;
|
||||
if (has)
|
||||
{
|
||||
// //
|
||||
// double ivMin = GetMin(trendBearishPivot.values);
|
||||
// double ivMax = GetMax(trendBearishPivot.values);
|
||||
|
||||
// //
|
||||
// trendBearishPivot.value = ivMax;
|
||||
// trendBearishPivot.reserve = ivMin;
|
||||
|
||||
//
|
||||
AddPivot(
|
||||
trendBearishPivot,
|
||||
trendBearishPivots //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
trendBearishPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
start++;
|
||||
@@ -899,7 +1351,11 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
// POI Handlers ...
|
||||
|
||||
//
|
||||
bool HasPeakPivots()
|
||||
// Peaks ...
|
||||
|
||||
//
|
||||
bool
|
||||
HasPeakPivots()
|
||||
{
|
||||
return HasChild(peakPivots);
|
||||
}
|
||||
@@ -910,6 +1366,9 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
return ArraySize(peakPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// Peak SWH Res ...
|
||||
|
||||
//
|
||||
bool HasPeakSWHResPivots()
|
||||
{
|
||||
@@ -922,6 +1381,9 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
return ArraySize(peakSWHResPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// Vale ...
|
||||
|
||||
//
|
||||
bool HasValePivots()
|
||||
{
|
||||
@@ -934,6 +1396,9 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
return ArraySize(valePivots);
|
||||
}
|
||||
|
||||
//
|
||||
// ValeSWLSup ...
|
||||
|
||||
//
|
||||
bool HasValeSWLSupPivots()
|
||||
{
|
||||
@@ -946,6 +1411,9 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
return ArraySize(valeSWLSupPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// Swing High ...
|
||||
|
||||
//
|
||||
bool HasSWHPivots()
|
||||
{
|
||||
@@ -958,6 +1426,9 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
return ArraySize(swhPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// Swing Low ...
|
||||
|
||||
//
|
||||
bool HasSWLPivots()
|
||||
{
|
||||
@@ -970,6 +1441,87 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
return ArraySize(swlPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// KI ...
|
||||
|
||||
//
|
||||
bool HasKIBullishPivots()
|
||||
{
|
||||
return HasChild(kiBullishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
int CountKIBullishPivots()
|
||||
{
|
||||
return ArraySize(kiBullishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasKIBearishPivots()
|
||||
{
|
||||
return HasChild(kiBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
int CountKIBearishPivots()
|
||||
{
|
||||
return ArraySize(kiBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// TKI ...
|
||||
|
||||
//
|
||||
bool HasTKIBullishPivots()
|
||||
{
|
||||
return HasChild(tkiBullishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
int CountTKIBullishPivots()
|
||||
{
|
||||
return ArraySize(tkiBullishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasTKIBearishPivots()
|
||||
{
|
||||
return HasChild(tkiBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
int CountTKIBearishPivots()
|
||||
{
|
||||
return ArraySize(tkiBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
|
||||
//
|
||||
bool HasTrendBullishPivots()
|
||||
{
|
||||
return HasChild(trendBullishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
int CountTrendBullishPivots()
|
||||
{
|
||||
return ArraySize(trendBullishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasTrendBearishPivots()
|
||||
{
|
||||
return HasChild(trendBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
int CountTrendBearishPivots()
|
||||
{
|
||||
return ArraySize(trendBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
@@ -982,14 +1534,21 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
// Props ...
|
||||
int pivotVerifications; // Pivots Verifications ...
|
||||
int maxAllowedPivots; // Max Allowed Holding Pibots ...
|
||||
|
||||
//
|
||||
XCAPivot swhPivot;
|
||||
XCAPivot swlPivot;
|
||||
XCAPivot peakPivot;
|
||||
XCAPivot valePivot;
|
||||
XCAPivot kiBullishPivot;
|
||||
XCAPivot kiBearishPivot;
|
||||
XCAPivot tkiBullishPivot;
|
||||
XCAPivot tkiBearishPivot;
|
||||
XCAPivot peakSWHResPivot;
|
||||
XCAPivot valeSWLSupPivot;
|
||||
XCAPivot trendBullishPivot;
|
||||
XCAPivot trendBearishPivot;
|
||||
|
||||
//
|
||||
XCPOIDrawer *drawer;
|
||||
@@ -1091,6 +1650,13 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
pivots[updateIDX].to = pivot.to;
|
||||
}
|
||||
|
||||
//
|
||||
// Apply Max Allowed ...
|
||||
CleanupArray(
|
||||
pivots,
|
||||
maxAllowedPivots //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -752,13 +752,21 @@ bool DetectXCAEAConditions(
|
||||
|
||||
//
|
||||
bool isCond1Bullish =
|
||||
conditions.isValeIsPivot &&
|
||||
isTKITRNDSwitchedToBullish;
|
||||
// conditions.isRSIOS &&
|
||||
// conditions.isValeIsPivot &&
|
||||
// isTKITRNDSwitchedToBullish
|
||||
conditions.isKISwitchedToBullish
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isCond1Bearish =
|
||||
conditions.isPeakIsPivot &&
|
||||
isTKITRNDSwitchedToBearish;
|
||||
// conditions.isRSIOB &&
|
||||
// conditions.isPeakIsPivot &&
|
||||
// isTKITRNDSwitchedToBearish
|
||||
conditions.isKISwitchedToBearish
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (isCond1Bullish ||
|
||||
|
||||
@@ -172,174 +172,11 @@ class XCXCAEASignaller : XCBase
|
||||
);
|
||||
|
||||
//
|
||||
bool drawSWHPivots = true;
|
||||
bool drawSWLPivots = true;
|
||||
bool drawPeakPivots = false;
|
||||
bool drawValePivots = false;
|
||||
DrawPivots();
|
||||
|
||||
//
|
||||
// Draw Peak SWH Res Pivots ...
|
||||
if (drawPeakPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasPeakSWHResPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountPeakSWHResPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.peakSWHResPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper.poiDrawer.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
Print("Draw Peak SWH Res Pivots ...");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Vale SWL Sup Pivots ...
|
||||
if (drawValePivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasValeSWLSupPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountValeSWLSupPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.valeSWLSupPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper.poiDrawer.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
Print("Draw Vale SWL Sup Pivots ...");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw SWH Pvots ...
|
||||
if (drawSWHPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasSWHPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountSWHPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.swhPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw SWL Pvots ...
|
||||
if (drawSWLPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasSWLPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountSWLPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.swlPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
XCAEAConditions conditions;
|
||||
@@ -678,6 +515,419 @@ class XCXCAEASignaller : XCBase
|
||||
protected:
|
||||
//
|
||||
|
||||
//
|
||||
void DrawPivots()
|
||||
{
|
||||
//
|
||||
int count = 0;
|
||||
bool has = false;
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
bool drawSWHPivots = false;
|
||||
bool drawSWLPivots = false;
|
||||
bool drawPeakPivots = false;
|
||||
bool drawValePivots = false;
|
||||
bool drawKIBullishPivots = false;
|
||||
bool drawKIBearishPivots = false;
|
||||
bool drawTKIBullishPivots = false;
|
||||
bool drawTKIBearishPivots = false;
|
||||
bool drawTrendBullishPivots = true;
|
||||
bool drawTrendBearishPivots = true;
|
||||
|
||||
//
|
||||
// Draw Peak SWH Res Pivots ...
|
||||
if (drawPeakPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasPeakSWHResPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountPeakSWHResPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.peakSWHResPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper.poiDrawer.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Vale SWL Sup Pivots ...
|
||||
if (drawValePivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasValeSWLSupPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountValeSWLSupPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.valeSWLSupPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper.poiDrawer.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw SWH Pvots ...
|
||||
if (drawSWHPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasSWHPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountSWHPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.swhPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw SWL Pvots ...
|
||||
if (drawSWLPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasSWLPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountSWLPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.swlPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw KI Bullish Pivots ...
|
||||
if (drawKIBullishPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasKIBullishPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountKIBullishPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.kiBullishPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw KI Bearish Pivots ...
|
||||
if (drawKIBearishPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasKIBullishPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountKIBearishPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.kiBearishPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw TKI Bullish Pivots ...
|
||||
if (drawTKIBullishPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasTKIBullishPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountTKIBullishPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.tkiBullishPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw TKI Bearish Pivots ...
|
||||
if (drawTKIBearishPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasTKIBullishPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountTKIBearishPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.tkiBearishPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Trend Bullish Pivots ...
|
||||
if (drawTrendBullishPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasTrendBullishPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountTrendBullishPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.trendBullishPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Trend Bearish Pivots ...
|
||||
if (drawTrendBearishPivots)
|
||||
{
|
||||
//
|
||||
has = detector.HasTrendBullishPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = detector.CountTrendBearishPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = detector
|
||||
.trendBearishPivots[i]
|
||||
.AsBox(iBox);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// iBox.to = cTime;
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper
|
||||
.poiDrawer
|
||||
.DrawBox(
|
||||
iBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user