last works on xcatb ...
This commit is contained in:
@@ -646,12 +646,45 @@ XCBarAnalyser *mBarAnalyser;
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Temparory ...
|
// Temparory ...
|
||||||
|
bool mHas = false;
|
||||||
ENUM_X_DIRECTION mDir;
|
ENUM_X_DIRECTION mDir;
|
||||||
bool mHasSignal = false;
|
bool mHasSignal = false;
|
||||||
bool mIsBullish = false;
|
bool mIsBullish = false;
|
||||||
bool mIsBearish = false;
|
bool mIsBearish = false;
|
||||||
|
XDirectionShift mDirShift;
|
||||||
string mTriggerBarConditions;
|
string mTriggerBarConditions;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Direction Shift ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XDirectionShift mBullishKIChanges[];
|
||||||
|
XDirectionShift mBearishKIChanges[];
|
||||||
|
|
||||||
|
//
|
||||||
|
XDirectionShift mBullishSBChanges[];
|
||||||
|
XDirectionShift mBearishSBChanges[];
|
||||||
|
|
||||||
|
//
|
||||||
|
XDirectionShift mBullishHKSChanges[];
|
||||||
|
XDirectionShift mBearishHKSChanges[];
|
||||||
|
|
||||||
|
//
|
||||||
|
XDirectionShift mBullishSarChanges[];
|
||||||
|
XDirectionShift mBearishSarChanges[];
|
||||||
|
|
||||||
|
//
|
||||||
|
XDirectionShift mBullishTrendChanges[];
|
||||||
|
XDirectionShift mBearishTrendChanges[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Liquidities ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLiquidity = false;
|
||||||
|
bool isBullishLiquidity = false;
|
||||||
|
bool isBearishLiquidity = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Trigger Bars Conditions ...
|
// Trigger Bars Conditions ...
|
||||||
|
|
||||||
@@ -715,6 +748,14 @@ bool isPeakUnderLast = false;
|
|||||||
bool isValeOverLast = false;
|
bool isValeOverLast = false;
|
||||||
bool isValeUnderLast = false;
|
bool isValeUnderLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSamePeakOverLast = false;
|
||||||
|
bool isSamePeakUnderLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSameValeOverLast = false;
|
||||||
|
bool isSameValeUnderLast = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSamePeakGolden = false;
|
bool isSamePeakGolden = false;
|
||||||
bool isSamePeakGoldenP = false;
|
bool isSamePeakGoldenP = false;
|
||||||
@@ -731,6 +772,14 @@ bool isPeakGoldenUnderLast = false;
|
|||||||
bool isValeGoldenOverLast = false;
|
bool isValeGoldenOverLast = false;
|
||||||
bool isValeGoldenUnderLast = false;
|
bool isValeGoldenUnderLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSamePeakGoldenOverLast = false;
|
||||||
|
bool isSamePeakGoldenUnderLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSameValeGoldenOverLast = false;
|
||||||
|
bool isSameValeGoldenUnderLast = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSAR ...
|
// XSAR ...
|
||||||
|
|
||||||
@@ -753,6 +802,14 @@ bool isBearishSarBreakedLast = false;
|
|||||||
//
|
//
|
||||||
// XSB ...
|
// XSB ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double mSBMax = 0;
|
||||||
|
double mSBMin = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
double mSBPMax = 0;
|
||||||
|
double mSBPMin = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSBBullish = false;
|
bool isSBBullish = false;
|
||||||
bool isSBBullishP = false;
|
bool isSBBullishP = false;
|
||||||
@@ -772,6 +829,14 @@ bool isBearishSBBreakedLast = false;
|
|||||||
//
|
//
|
||||||
// XHKS ...
|
// XHKS ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double mHKSMax = 0;
|
||||||
|
double mHKSMin = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
double mHKSPMax = 0;
|
||||||
|
double mHKSPMin = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isHKSBullish = false;
|
bool isHKSBullish = false;
|
||||||
bool isHKSBullishP = false;
|
bool isHKSBullishP = false;
|
||||||
@@ -812,6 +877,25 @@ bool isKISwitchedToBearish = false;
|
|||||||
bool isBullishKIBreakedLast = false;
|
bool isBullishKIBreakedLast = false;
|
||||||
bool isBearishKIBreakedLast = false;
|
bool isBearishKIBreakedLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTREND ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isTrendBullish = false;
|
||||||
|
bool isTrendBullishP = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isTrendBearish = false;
|
||||||
|
bool isTrendBearishP = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isTrendSwitchedToBullish = false;
|
||||||
|
bool isTrendSwitchedToBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullishTrendBreakedLast = false;
|
||||||
|
bool isBearishTrendBreakedLast = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Event Handlers ...
|
// Event Handlers ...
|
||||||
|
|
||||||
@@ -3166,6 +3250,25 @@ void PrepareMarketConditions(
|
|||||||
//
|
//
|
||||||
// Start Preparing Conditions ...
|
// Start Preparing Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Liquidities ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isLiquidity =
|
||||||
|
mBarAnalyser
|
||||||
|
.IsRejected(
|
||||||
|
iBar,
|
||||||
|
mDir,
|
||||||
|
true,
|
||||||
|
true //
|
||||||
|
);
|
||||||
|
isBullishLiquidity =
|
||||||
|
isLiquidity &&
|
||||||
|
IsBullish(mDir);
|
||||||
|
isBearishLiquidity =
|
||||||
|
isLiquidity &&
|
||||||
|
IsBearish(mDir);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Trigger Bars Conditions ...
|
// Trigger Bars Conditions ...
|
||||||
|
|
||||||
@@ -3175,7 +3278,7 @@ void PrepareMarketConditions(
|
|||||||
mBarAnalyser
|
mBarAnalyser
|
||||||
.IsValidForTrigger(
|
.IsValidForTrigger(
|
||||||
iPBar,
|
iPBar,
|
||||||
triggerDir,
|
mDir,
|
||||||
true, // Cond 1 ...
|
true, // Cond 1 ...
|
||||||
false, // Cond 2 ...
|
false, // Cond 2 ...
|
||||||
false, // Cond 3 ...
|
false, // Cond 3 ...
|
||||||
@@ -3190,6 +3293,10 @@ void PrepareMarketConditions(
|
|||||||
isTriggerBarCond1Bearish =
|
isTriggerBarCond1Bearish =
|
||||||
isTriggerBarCond1 &&
|
isTriggerBarCond1 &&
|
||||||
IsBearish(mDir);
|
IsBearish(mDir);
|
||||||
|
if (isTriggerBarCond1)
|
||||||
|
{
|
||||||
|
mTriggerBarConditions += "1";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cond 2 ...
|
// Cond 2 ...
|
||||||
@@ -3197,7 +3304,7 @@ void PrepareMarketConditions(
|
|||||||
mBarAnalyser
|
mBarAnalyser
|
||||||
.IsValidForTrigger(
|
.IsValidForTrigger(
|
||||||
iPBar,
|
iPBar,
|
||||||
triggerDir,
|
mDir,
|
||||||
false, // Cond 1 ...
|
false, // Cond 1 ...
|
||||||
true, // Cond 2 ...
|
true, // Cond 2 ...
|
||||||
false, // Cond 3 ...
|
false, // Cond 3 ...
|
||||||
@@ -3212,6 +3319,10 @@ void PrepareMarketConditions(
|
|||||||
isTriggerBarCond2Bearish =
|
isTriggerBarCond2Bearish =
|
||||||
isTriggerBarCond2 &&
|
isTriggerBarCond2 &&
|
||||||
IsBearish(mDir);
|
IsBearish(mDir);
|
||||||
|
if (isTriggerBarCond2)
|
||||||
|
{
|
||||||
|
mTriggerBarConditions += ",2";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cond 3 ...
|
// Cond 3 ...
|
||||||
@@ -3219,7 +3330,7 @@ void PrepareMarketConditions(
|
|||||||
mBarAnalyser
|
mBarAnalyser
|
||||||
.IsValidForTrigger(
|
.IsValidForTrigger(
|
||||||
iPBar,
|
iPBar,
|
||||||
triggerDir,
|
mDir,
|
||||||
false, // Cond 1 ...
|
false, // Cond 1 ...
|
||||||
false, // Cond 2 ...
|
false, // Cond 2 ...
|
||||||
true, // Cond 3 ...
|
true, // Cond 3 ...
|
||||||
@@ -3234,6 +3345,10 @@ void PrepareMarketConditions(
|
|||||||
isTriggerBarCond3Bearish =
|
isTriggerBarCond3Bearish =
|
||||||
isTriggerBarCond3 &&
|
isTriggerBarCond3 &&
|
||||||
IsBearish(mDir);
|
IsBearish(mDir);
|
||||||
|
if (isTriggerBarCond3)
|
||||||
|
{
|
||||||
|
mTriggerBarConditions += ",3";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cond 4 ...
|
// Cond 4 ...
|
||||||
@@ -3241,7 +3356,7 @@ void PrepareMarketConditions(
|
|||||||
mBarAnalyser
|
mBarAnalyser
|
||||||
.IsValidForTrigger(
|
.IsValidForTrigger(
|
||||||
iPBar,
|
iPBar,
|
||||||
triggerDir,
|
mDir,
|
||||||
false, // Cond 1 ...
|
false, // Cond 1 ...
|
||||||
false, // Cond 2 ...
|
false, // Cond 2 ...
|
||||||
false, // Cond 3 ...
|
false, // Cond 3 ...
|
||||||
@@ -3256,6 +3371,10 @@ void PrepareMarketConditions(
|
|||||||
isTriggerBarCond4Bearish =
|
isTriggerBarCond4Bearish =
|
||||||
isTriggerBarCond4 &&
|
isTriggerBarCond4 &&
|
||||||
IsBearish(mDir);
|
IsBearish(mDir);
|
||||||
|
if (isTriggerBarCond4)
|
||||||
|
{
|
||||||
|
mTriggerBarConditions += ",4";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cond 5 ...
|
// Cond 5 ...
|
||||||
@@ -3263,7 +3382,7 @@ void PrepareMarketConditions(
|
|||||||
mBarAnalyser
|
mBarAnalyser
|
||||||
.IsValidForTrigger(
|
.IsValidForTrigger(
|
||||||
iPBar,
|
iPBar,
|
||||||
triggerDir,
|
mDir,
|
||||||
false, // Cond 1 ...
|
false, // Cond 1 ...
|
||||||
false, // Cond 2 ...
|
false, // Cond 2 ...
|
||||||
false, // Cond 3 ...
|
false, // Cond 3 ...
|
||||||
@@ -3278,6 +3397,10 @@ void PrepareMarketConditions(
|
|||||||
isTriggerBarCond5Bearish =
|
isTriggerBarCond5Bearish =
|
||||||
isTriggerBarCond5 &&
|
isTriggerBarCond5 &&
|
||||||
IsBearish(mDir);
|
IsBearish(mDir);
|
||||||
|
if (isTriggerBarCond5)
|
||||||
|
{
|
||||||
|
mTriggerBarConditions += ",5";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cond 6 ...
|
// Cond 6 ...
|
||||||
@@ -3285,7 +3408,7 @@ void PrepareMarketConditions(
|
|||||||
mBarAnalyser
|
mBarAnalyser
|
||||||
.IsValidForTrigger(
|
.IsValidForTrigger(
|
||||||
iPBar,
|
iPBar,
|
||||||
triggerDir,
|
mDir,
|
||||||
false, // Cond 1 ...
|
false, // Cond 1 ...
|
||||||
false, // Cond 2 ...
|
false, // Cond 2 ...
|
||||||
false, // Cond 3 ...
|
false, // Cond 3 ...
|
||||||
@@ -3300,6 +3423,10 @@ void PrepareMarketConditions(
|
|||||||
isTriggerBarCond6Bearish =
|
isTriggerBarCond6Bearish =
|
||||||
isTriggerBarCond6 &&
|
isTriggerBarCond6 &&
|
||||||
IsBearish(mDir);
|
IsBearish(mDir);
|
||||||
|
if (isTriggerBarCond6)
|
||||||
|
{
|
||||||
|
mTriggerBarConditions += ",6";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cond 7 ...
|
// Cond 7 ...
|
||||||
@@ -3307,7 +3434,7 @@ void PrepareMarketConditions(
|
|||||||
mBarAnalyser
|
mBarAnalyser
|
||||||
.IsValidForTrigger(
|
.IsValidForTrigger(
|
||||||
iPBar,
|
iPBar,
|
||||||
triggerDir,
|
mDir,
|
||||||
false, // Cond 1 ...
|
false, // Cond 1 ...
|
||||||
false, // Cond 2 ...
|
false, // Cond 2 ...
|
||||||
false, // Cond 3 ...
|
false, // Cond 3 ...
|
||||||
@@ -3322,6 +3449,10 @@ void PrepareMarketConditions(
|
|||||||
isTriggerBarCond7Bearish =
|
isTriggerBarCond7Bearish =
|
||||||
isTriggerBarCond7 &&
|
isTriggerBarCond7 &&
|
||||||
IsBearish(mDir);
|
IsBearish(mDir);
|
||||||
|
if (isTriggerBarCond7)
|
||||||
|
{
|
||||||
|
mTriggerBarConditions += ",7";
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Summarizing Trigger Bar ...
|
// Summarizing Trigger Bar ...
|
||||||
@@ -3360,51 +3491,87 @@ void PrepareMarketConditions(
|
|||||||
// XPV ...
|
// XPV ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isSamePeak = false;
|
isSamePeak = peakBuffer[pIndex] == peakBuffer[p2Index];
|
||||||
isSamePeakP = false;
|
isSamePeakP = peakBuffer[p2Index] == peakBuffer[p3Index];
|
||||||
|
|
||||||
//
|
//
|
||||||
isSameVale = false;
|
isSameVale = valeBuffer[pIndex] == valeBuffer[p2Index];
|
||||||
isSameValeP = false;
|
isSameValeP = valeBuffer[p2Index] == valeBuffer[p3Index];
|
||||||
|
|
||||||
//
|
//
|
||||||
isPeakOverLast = false;
|
isPeakOverLast = peakBuffer[pIndex] > peakBuffer[p2Index];
|
||||||
isPeakUnderLast = false;
|
isPeakUnderLast = peakBuffer[pIndex] < peakBuffer[p2Index];
|
||||||
|
|
||||||
//
|
//
|
||||||
isValeOverLast = false;
|
isValeOverLast = valeBuffer[pIndex] > valeBuffer[p2Index];
|
||||||
isValeUnderLast = false;
|
isValeUnderLast = valeBuffer[pIndex] < valeBuffer[p2Index];
|
||||||
|
|
||||||
//
|
//
|
||||||
isSamePeakGolden = false;
|
isSamePeakOverLast =
|
||||||
isSamePeakGoldenP = false;
|
isSamePeakP &&
|
||||||
|
isPeakOverLast;
|
||||||
|
isSamePeakUnderLast =
|
||||||
|
isSamePeakP &&
|
||||||
|
isPeakUnderLast;
|
||||||
|
|
||||||
//
|
//
|
||||||
isSameValeGolden = false;
|
isSameValeOverLast =
|
||||||
isSameValeGoldenP = false;
|
isSameValeP &&
|
||||||
|
isValeOverLast;
|
||||||
|
isSameValeUnderLast =
|
||||||
|
isSameValeP &&
|
||||||
|
isValeUnderLast;
|
||||||
|
|
||||||
//
|
//
|
||||||
isPeakGoldenOverLast = false;
|
isSamePeakGolden = peakGoldenBuffer[pIndex] == peakGoldenBuffer[p2Index];
|
||||||
isPeakGoldenUnderLast = false;
|
isSamePeakGoldenP = peakGoldenBuffer[p2Index] == peakGoldenBuffer[p3Index];
|
||||||
|
|
||||||
//
|
//
|
||||||
isValeGoldenOverLast = false;
|
isSameValeGolden = valeGoldenBuffer[pIndex] == valeGoldenBuffer[p2Index];
|
||||||
isValeGoldenUnderLast = false;
|
isSameValeGoldenP = valeGoldenBuffer[p2Index] == valeGoldenBuffer[p3Index];
|
||||||
|
|
||||||
|
//
|
||||||
|
isPeakGoldenOverLast = peakGoldenBuffer[pIndex] > peakGoldenBuffer[p2Index];
|
||||||
|
isPeakGoldenUnderLast = peakGoldenBuffer[pIndex] < peakGoldenBuffer[p2Index];
|
||||||
|
|
||||||
|
//
|
||||||
|
isValeGoldenOverLast = valeGoldenBuffer[pIndex] > valeGoldenBuffer[p2Index];
|
||||||
|
isValeGoldenUnderLast = valeGoldenBuffer[pIndex] < valeGoldenBuffer[p2Index];
|
||||||
|
|
||||||
|
//
|
||||||
|
isSamePeakGoldenOverLast =
|
||||||
|
isSamePeakGoldenP &&
|
||||||
|
isPeakGoldenOverLast;
|
||||||
|
isSamePeakGoldenUnderLast =
|
||||||
|
isSamePeakGoldenP &&
|
||||||
|
isPeakGoldenUnderLast;
|
||||||
|
|
||||||
|
//
|
||||||
|
isSameValeGoldenOverLast =
|
||||||
|
isSameValeGoldenP &&
|
||||||
|
isValeGoldenOverLast;
|
||||||
|
isSameValeGoldenUnderLast =
|
||||||
|
isSameValeGoldenP &&
|
||||||
|
isSameValeGoldenUnderLast;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSAR ...
|
// XSAR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isSarBullish = false;
|
isSarBullish = sarStateBuffer[pIndex] > 0;
|
||||||
isSarBullishP = false;
|
isSarBullishP = sarStateBuffer[p2Index] > 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
isSarBearish = false;
|
isSarBearish = sarStateBuffer[pIndex] < 0;
|
||||||
isSarBearishP = false;
|
isSarBearishP = sarStateBuffer[p2Index] < 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
isSarSwitchedToBullish = false;
|
isSarSwitchedToBullish =
|
||||||
isSarSwitchedToBearish = false;
|
isSarBullish &&
|
||||||
|
!isSarBullishP;
|
||||||
|
isSarSwitchedToBearish =
|
||||||
|
isSarBearish &&
|
||||||
|
!isSarBearishP;
|
||||||
|
|
||||||
//
|
//
|
||||||
isBullishSarBreakedLast = false;
|
isBullishSarBreakedLast = false;
|
||||||
@@ -3414,70 +3581,516 @@ void PrepareMarketConditions(
|
|||||||
// XSB ...
|
// XSB ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isSBBullish = false;
|
isSBBullish = sBarCloseBuffer[pIndex] > sBarOpenBuffer[pIndex];
|
||||||
isSBBullishP = false;
|
isSBBullishP = sBarCloseBuffer[p2Index] > sBarOpenBuffer[p2Index];
|
||||||
|
|
||||||
//
|
//
|
||||||
isSBBearish = false;
|
isSBBearish = sBarCloseBuffer[pIndex] < sBarOpenBuffer[pIndex];
|
||||||
isSBBearishP = false;
|
isSBBearishP = sBarCloseBuffer[p2Index] < sBarOpenBuffer[p2Index];
|
||||||
|
|
||||||
//
|
//
|
||||||
isSBSwitchedToBullish = false;
|
isSBSwitchedToBullish =
|
||||||
isSBSwitchedToBearish = false;
|
isSBBullish &&
|
||||||
|
!isSBBullishP;
|
||||||
|
isSBSwitchedToBearish =
|
||||||
|
isSBBearish &&
|
||||||
|
!isSBBearishP;
|
||||||
|
|
||||||
//
|
//
|
||||||
isBullishSBBreakedLast = false;
|
isBullishSBBreakedLast = false;
|
||||||
isBearishSBBreakedLast = false;
|
isBearishSBBreakedLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
mSBMin = MathMin(sBarCloseBuffer[pIndex], sBarOpenBuffer[pIndex]);
|
||||||
|
mSBMax = MathMax(sBarCloseBuffer[pIndex], sBarOpenBuffer[pIndex]);
|
||||||
|
|
||||||
|
//
|
||||||
|
mSBPMin = MathMin(sBarCloseBuffer[p2Index], sBarOpenBuffer[p2Index]);
|
||||||
|
mSBPMax = MathMax(sBarCloseBuffer[p2Index], sBarOpenBuffer[p2Index]);
|
||||||
|
|
||||||
//
|
//
|
||||||
// XHKS ...
|
// XHKS ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isHKSBullish = false;
|
isHKSBullish = hkSBarCloseBuffer[pIndex] > hkSBarOpenBuffer[pIndex];
|
||||||
isHKSBullishP = false;
|
isHKSBullishP = hkSBarCloseBuffer[p2Index] > hkSBarOpenBuffer[p2Index];
|
||||||
|
|
||||||
//
|
//
|
||||||
isHKSBearish = false;
|
isHKSBearish = hkSBarCloseBuffer[pIndex] < hkSBarOpenBuffer[pIndex];
|
||||||
isHKSBearishP = false;
|
isHKSBearishP = hkSBarCloseBuffer[p2Index] < hkSBarOpenBuffer[p2Index];
|
||||||
|
|
||||||
//
|
//
|
||||||
isHKSSwitchedToBullish = false;
|
isHKSSwitchedToBullish =
|
||||||
isHKSSwitchedToBearish = false;
|
isHKSBullish &&
|
||||||
|
!isHKSBullishP;
|
||||||
|
isHKSSwitchedToBearish =
|
||||||
|
isHKSBearish &&
|
||||||
|
!isHKSBearishP;
|
||||||
|
|
||||||
//
|
//
|
||||||
isBullishHKSBreakedLast = false;
|
isBullishHKSBreakedLast = false;
|
||||||
isBearishHKSBreakedLast = false;
|
isBearishHKSBreakedLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
mHKSMin = MathMin(hkSBarCloseBuffer[pIndex], hkSBarOpenBuffer[pIndex]);
|
||||||
|
mHKSMax = MathMax(hkSBarCloseBuffer[pIndex], hkSBarOpenBuffer[pIndex]);
|
||||||
|
|
||||||
|
//
|
||||||
|
mHKSPMin = MathMin(hkSBarCloseBuffer[p2Index], hkSBarOpenBuffer[p2Index]);
|
||||||
|
mHKSPMax = MathMax(hkSBarCloseBuffer[p2Index], hkSBarOpenBuffer[p2Index]);
|
||||||
|
|
||||||
//
|
//
|
||||||
// XKI ...
|
// XKI ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isKIBullish = false;
|
isKIBullish = kiStateBuffer[pIndex] > 0;
|
||||||
isKIBullishP = false;
|
isKIBullishP = kiStateBuffer[p2Index] > 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
isKIBearish = false;
|
isKIBearish = kiStateBuffer[pIndex] < 0;
|
||||||
isKIBearishP = false;
|
isKIBearishP = kiStateBuffer[p2Index] < 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
isKISame = false;
|
isKISame = kiBuffer[pIndex] == kiBuffer[p2Index];
|
||||||
isBullishKISame = false;
|
isBullishKISame =
|
||||||
isBearishKISame = false;
|
isKISame &&
|
||||||
|
isKIBullish;
|
||||||
|
isBearishKISame =
|
||||||
|
isKISame &&
|
||||||
|
isKIBearish;
|
||||||
|
|
||||||
//
|
//
|
||||||
isKISwitchedToBullish = false;
|
isKISwitchedToBullish =
|
||||||
isKISwitchedToBearish = false;
|
isKIBullish &&
|
||||||
|
!isKIBullishP;
|
||||||
|
isKISwitchedToBearish =
|
||||||
|
isKIBearish &&
|
||||||
|
!isKIBearishP;
|
||||||
|
|
||||||
//
|
//
|
||||||
isBullishKIBreakedLast = false;
|
isBullishKIBreakedLast = false;
|
||||||
isBearishKIBreakedLast = false;
|
isBearishKIBreakedLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTREND ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isTrendBullish = trendStateBuffer[pIndex] > 0;
|
||||||
|
isTrendBullishP = trendStateBuffer[p2Index] > 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
isTrendBearish = trendStateBuffer[pIndex] < 0;
|
||||||
|
isTrendBearishP = trendStateBuffer[p2Index] < 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
isTrendSwitchedToBullish =
|
||||||
|
isTrendBullish &&
|
||||||
|
!isTrendBullishP;
|
||||||
|
isTrendSwitchedToBearish =
|
||||||
|
isTrendBearish &&
|
||||||
|
!isTrendBearishP;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullishTrendBreakedLast = false;
|
||||||
|
isBearishTrendBreakedLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Creating Direction Shifts and it's related Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// XSB Shifts ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detection ...
|
||||||
|
if (isSBSwitchedToBullish ||
|
||||||
|
isSBSwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.at = iPBar.time;
|
||||||
|
mDirShift.symbol = _Symbol;
|
||||||
|
mDirShift.period = _Period;
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.type = "XSBSHFT";
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.after = 0;
|
||||||
|
mDirShift.before = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isSBSwitchedToBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.after = mSBMax;
|
||||||
|
mDirShift.before = mSBPMax;
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BULLISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBullishSBChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isSBSwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.after = mSBMin;
|
||||||
|
mDirShift.before = mSBPMin;
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBearishSBChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parsers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isSBBullish &&
|
||||||
|
HasChild(mBearishSBChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isSBBearish &&
|
||||||
|
HasChild(mBullishSBChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XSAR Shifts ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detection ...
|
||||||
|
if (isSarSwitchedToBullish ||
|
||||||
|
isSarSwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.at = iPBar.time;
|
||||||
|
mDirShift.symbol = _Symbol;
|
||||||
|
mDirShift.period = _Period;
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.type = "XSARSHFT";
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.after = sarBuffer[pIndex];
|
||||||
|
mDirShift.before = sarBuffer[p2Index];
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isSarSwitchedToBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BULLISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBullishSarChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isSarSwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBearishSarChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parsers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isSarBullish &&
|
||||||
|
HasChild(mBearishSarChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isSarBearish &&
|
||||||
|
HasChild(mBullishSarChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XHKS Shifts ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detection ...
|
||||||
|
if (isHKSSwitchedToBullish ||
|
||||||
|
isHKSSwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.at = iPBar.time;
|
||||||
|
mDirShift.symbol = _Symbol;
|
||||||
|
mDirShift.period = _Period;
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.type = "XHKSSHFT";
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.after = 0;
|
||||||
|
mDirShift.before = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isHKSSwitchedToBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.after = mHKSMax;
|
||||||
|
mDirShift.before = mHKSPMax;
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BULLISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBullishHKSChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isHKSSwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.after = mHKSMin;
|
||||||
|
mDirShift.before = mHKSPMin;
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBearishHKSChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parsers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isHKSBullish &&
|
||||||
|
HasChild(mBearishHKSChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isHKSBearish &&
|
||||||
|
HasChild(mBullishHKSChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XKI Shifts ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detection ...
|
||||||
|
if (isKISwitchedToBullish ||
|
||||||
|
isKISwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.at = iPBar.time;
|
||||||
|
mDirShift.symbol = _Symbol;
|
||||||
|
mDirShift.period = _Period;
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.type = "XKISHFT";
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.after = kiBuffer[pIndex];
|
||||||
|
mDirShift.before = kiBuffer[p2Index];
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isKISwitchedToBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BULLISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBullishKIChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isKISwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBearishKIChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parsers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isKIBullish &&
|
||||||
|
HasChild(mBearishKIChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isKIBearish &&
|
||||||
|
HasChild(mBullishKIChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTREND Shifts ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detection ...
|
||||||
|
if (isTrendSwitchedToBullish ||
|
||||||
|
isTrendSwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.at = iPBar.time;
|
||||||
|
mDirShift.symbol = _Symbol;
|
||||||
|
mDirShift.period = _Period;
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.type = "XTRENDSHFT";
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.after = trendBuffer[pIndex];
|
||||||
|
mDirShift.before = trendBuffer[p2Index];
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isTrendSwitchedToBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BULLISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBullishTrendChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isTrendSwitchedToBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mDirShift.shiftTo = X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mDirShift.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddIfNotExists(
|
||||||
|
mDirShift,
|
||||||
|
mBearishTrendChanges //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mDirShift.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parsers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isTrendBullish &&
|
||||||
|
HasChild(mBearishTrendChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mHas = isTrendBearish &&
|
||||||
|
HasChild(mBullishTrendChanges);
|
||||||
|
if (mHas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup Resources ...
|
// Cleanup Resources ...
|
||||||
|
|
||||||
//
|
//
|
||||||
iBar.Clean();
|
iBar.Clean();
|
||||||
iPBar.Clean();
|
iPBar.Clean();
|
||||||
|
mDirShift.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -584,10 +584,10 @@ bool IsBoxValid(
|
|||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
bool FindBoxIndex(
|
bool FindIndex(
|
||||||
int &index,
|
int &index,
|
||||||
XBoxZone &box,
|
XBoxZone &item,
|
||||||
XBoxZone &boxes[] //
|
XBoxZone &items[] //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -597,8 +597,8 @@ bool FindBoxIndex(
|
|||||||
index = -1;
|
index = -1;
|
||||||
|
|
||||||
//
|
//
|
||||||
int count = ArraySize(boxes);
|
int count = ArraySize(items);
|
||||||
result = box.IsValid() &&
|
result = item.IsValid() &&
|
||||||
IsValidSize(count);
|
IsValidSize(count);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -609,10 +609,53 @@ bool FindBoxIndex(
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XBoxZone iBox = boxes[i];
|
XBoxZone iBox = items[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSame = box.IsSameAs(iBox);
|
bool isSame = item.IsSameAs(iBox);
|
||||||
|
if (isSame)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValidIndex(index);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
bool FindIndex(
|
||||||
|
int &index,
|
||||||
|
XDirectionShift &item,
|
||||||
|
XDirectionShift &items[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
index = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(items);
|
||||||
|
result = item.IsValid() &&
|
||||||
|
IsValidSize(count);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XDirectionShift iItem = items[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSame = item.IsSameAs(iItem);
|
||||||
if (isSame)
|
if (isSame)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -631,9 +674,9 @@ bool FindBoxIndex(
|
|||||||
/**
|
/**
|
||||||
* Remove Specified Box from Collection ...
|
* Remove Specified Box from Collection ...
|
||||||
*/
|
*/
|
||||||
bool RemoveBox(
|
bool Remove(
|
||||||
XBoxZone &box,
|
XBoxZone &item,
|
||||||
XBoxZone &boxes[] //
|
XBoxZone &items[] //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -641,8 +684,8 @@ bool RemoveBox(
|
|||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
box.IsValid() &&
|
item.IsValid() &&
|
||||||
HasChild(boxes);
|
HasChild(items);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
@@ -650,10 +693,10 @@ bool RemoveBox(
|
|||||||
|
|
||||||
//
|
//
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
result = FindBoxIndex(
|
result = FindIndex(
|
||||||
idx,
|
idx,
|
||||||
box,
|
item,
|
||||||
boxes //
|
items //
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -662,7 +705,46 @@ bool RemoveBox(
|
|||||||
|
|
||||||
//
|
//
|
||||||
result = ArrayRemove(
|
result = ArrayRemove(
|
||||||
boxes,
|
items,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
bool Remove(
|
||||||
|
XDirectionShift &item,
|
||||||
|
XDirectionShift &items[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
item.IsValid() &&
|
||||||
|
HasChild(items);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = -1;
|
||||||
|
result = FindIndex(
|
||||||
|
idx,
|
||||||
|
item,
|
||||||
|
items //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArrayRemove(
|
||||||
|
items,
|
||||||
idx,
|
idx,
|
||||||
1 //
|
1 //
|
||||||
);
|
);
|
||||||
@@ -674,7 +756,7 @@ bool RemoveBox(
|
|||||||
/**
|
/**
|
||||||
* Remove Specified Box from Collection ...
|
* Remove Specified Box from Collection ...
|
||||||
*/
|
*/
|
||||||
int RemoveBoxes(
|
int Removes(
|
||||||
XBoxZone &items[],
|
XBoxZone &items[],
|
||||||
XBoxZone &sources[] //
|
XBoxZone &sources[] //
|
||||||
)
|
)
|
||||||
@@ -696,7 +778,54 @@ int RemoveBoxes(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
has = FindBoxIndex(
|
has = FindIndex(
|
||||||
|
idx,
|
||||||
|
items[i],
|
||||||
|
sources //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = ArrayRemove(
|
||||||
|
sources,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
result++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
int Removes(
|
||||||
|
XDirectionShift &items[],
|
||||||
|
XDirectionShift &sources[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool has = HasChild(items) &&
|
||||||
|
HasChild(sources);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(items);
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int idx = -1;
|
||||||
|
has = FindIndex(
|
||||||
idx,
|
idx,
|
||||||
items[i],
|
items[i],
|
||||||
sources //
|
sources //
|
||||||
@@ -730,7 +859,7 @@ int RemoveBoxes(
|
|||||||
*
|
*
|
||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool AddBoxIfNotExists(
|
bool AddIfNotExists(
|
||||||
XBoxZone &item,
|
XBoxZone &item,
|
||||||
XBoxZone &sources[] //
|
XBoxZone &sources[] //
|
||||||
)
|
)
|
||||||
@@ -749,7 +878,46 @@ bool AddBoxIfNotExists(
|
|||||||
//
|
//
|
||||||
// Check Item Exists or not ...
|
// Check Item Exists or not ...
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
bool isExists = FindBoxIndex(
|
bool isExists = FindIndex(
|
||||||
|
idx,
|
||||||
|
item,
|
||||||
|
sources //
|
||||||
|
);
|
||||||
|
result = !isExists;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
item,
|
||||||
|
sources //;
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
bool AddIfNotExists(
|
||||||
|
XDirectionShift &item,
|
||||||
|
XDirectionShift &sources[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
result = item.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Item Exists or not ...
|
||||||
|
int idx = -1;
|
||||||
|
bool isExists = FindIndex(
|
||||||
idx,
|
idx,
|
||||||
item,
|
item,
|
||||||
sources //
|
sources //
|
||||||
@@ -778,7 +946,7 @@ bool AddBoxIfNotExists(
|
|||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
int AddBoxIfNotExists(
|
int AddIfNotExists(
|
||||||
XBoxZone &items[],
|
XBoxZone &items[],
|
||||||
XBoxZone &sources[] //
|
XBoxZone &sources[] //
|
||||||
)
|
)
|
||||||
@@ -801,7 +969,7 @@ int AddBoxIfNotExists(
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
has = AddBoxIfNotExists(
|
has = AddIfNotExists(
|
||||||
items[i],
|
items[i],
|
||||||
sources //
|
sources //
|
||||||
);
|
);
|
||||||
@@ -816,6 +984,48 @@ int AddBoxIfNotExists(
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
int AddIfNotExists(
|
||||||
|
XDirectionShift &items[],
|
||||||
|
XDirectionShift &sources[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool has = HasChild(items);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int before = ArraySize(sources);
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(items);
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = AddIfNotExists(
|
||||||
|
items[i],
|
||||||
|
sources //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int after = ArraySize(sources);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = after > before;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
void SortBoxes(
|
void SortBoxes(
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ struct XBoxZone
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve Box Applied Price ...
|
* Retrieve Box Applied Price ...
|
||||||
*
|
*
|
||||||
* @return ( double )
|
* @return ( double )
|
||||||
*/
|
*/
|
||||||
double GetDirectionalPrice()
|
double GetDirectionalPrice()
|
||||||
@@ -336,7 +336,7 @@ struct XBoxZone
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve Box Breaked Price ...
|
* Retrieve Box Breaked Price ...
|
||||||
*
|
*
|
||||||
* @return ( double )
|
* @return ( double )
|
||||||
*/
|
*/
|
||||||
double GetInDirectionalPrice()
|
double GetInDirectionalPrice()
|
||||||
@@ -722,4 +722,4 @@ struct XDirectionShift
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2064,7 +2064,7 @@ class XCXCATBEASignaller : XCBase
|
|||||||
//
|
//
|
||||||
// Check Box Added Before or not ...
|
// Check Box Added Before or not ...
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
has = FindBoxIndex(
|
has = FindIndex(
|
||||||
idx,
|
idx,
|
||||||
box,
|
box,
|
||||||
unavailableZones //
|
unavailableZones //
|
||||||
|
|||||||
@@ -2222,7 +2222,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
bool isExists = FindBoxIndex(
|
bool isExists = FindIndex(
|
||||||
idx,
|
idx,
|
||||||
box,
|
box,
|
||||||
boxes //
|
boxes //
|
||||||
@@ -2281,7 +2281,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
bool isUnAvailable = FindBoxIndex(
|
bool isUnAvailable = FindIndex(
|
||||||
idx,
|
idx,
|
||||||
box,
|
box,
|
||||||
unavailables //
|
unavailables //
|
||||||
@@ -2420,7 +2420,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
bool isExists = FindBoxIndex(
|
bool isExists = FindIndex(
|
||||||
idx,
|
idx,
|
||||||
box,
|
box,
|
||||||
invalidPivots //
|
invalidPivots //
|
||||||
@@ -2639,7 +2639,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
bool isExists = FindBoxIndex(
|
bool isExists = FindIndex(
|
||||||
idx,
|
idx,
|
||||||
iBox,
|
iBox,
|
||||||
invalidPivots //
|
invalidPivots //
|
||||||
|
|||||||
Reference in New Issue
Block a user