943 lines
19 KiB
Plaintext
943 lines
19 KiB
Plaintext
|
|
//
|
|
// Checking Conditions ...
|
|
|
|
//
|
|
// Retrieve Some Values ...
|
|
|
|
//
|
|
double peak = cXConditions.peaksBuffer[cIDX];
|
|
double peakZ = cXConditions.peaksBuffer[zIDX];
|
|
double peakP = cXConditions.peaksBuffer[pIDX];
|
|
double peakPP = cXConditions.peaksBuffer[ppIDX];
|
|
|
|
//
|
|
double vale = cXConditions.valesBuffer[cIDX];
|
|
double valeZ = cXConditions.valesBuffer[zIDX];
|
|
double valeP = cXConditions.valesBuffer[pIDX];
|
|
double valePP = cXConditions.valesBuffer[ppIDX];
|
|
|
|
//
|
|
double cSMHKOpen = cXConditions.xhkSMOpenBuffer[cIDX];
|
|
double cSMHKHigh = cXConditions.xhkSMHighBuffer[cIDX];
|
|
double cSMHKClose = cXConditions.xhkSMCloseBuffer[cIDX];
|
|
double cSMHKLow = cXConditions.xhkSMLowBuffer[cIDX];
|
|
double cSMHKMin = MathMin(cSMHKOpen, cSMHKClose);
|
|
double cSMHKMax = MathMax(cSMHKOpen, cSMHKClose);
|
|
|
|
//
|
|
double pSMHKOpen = cXConditions.xhkSMOpenBuffer[pIDX];
|
|
double pSMHKHigh = cXConditions.xhkSMHighBuffer[pIDX];
|
|
double pSMHKClose = cXConditions.xhkSMCloseBuffer[pIDX];
|
|
double pSMHKLow = cXConditions.xhkSMLowBuffer[pIDX];
|
|
double pSMHKMin = MathMin(pSMHKOpen, pSMHKClose);
|
|
double pSMHKMax = MathMax(pSMHKOpen, pSMHKClose);
|
|
|
|
//
|
|
double atrUpperSM = cXConditions.atrUpperSMBuffer[cIDX];
|
|
double atrLowerSM = cXConditions.atrLowerSMBuffer[cIDX];
|
|
|
|
//
|
|
double atrUpperSMZ = cXConditions.atrUpperSMBuffer[zIDX];
|
|
double atrLowerSMZ = cXConditions.atrLowerSMBuffer[zIDX];
|
|
|
|
//
|
|
double atrUpperSMP = cXConditions.atrUpperSMBuffer[pIDX];
|
|
double atrLowerSMP = cXConditions.atrLowerSMBuffer[pIDX];
|
|
|
|
//
|
|
double atrUpperSMPP = cXConditions.atrUpperSMBuffer[ppIDX];
|
|
double atrLowerSMPP = cXConditions.atrLowerSMBuffer[ppIDX];
|
|
|
|
//
|
|
double rsiChange = cXConditions.rsiChangeBuffer[cIDX];
|
|
double rsiChangeZ = cXConditions.rsiChangeBuffer[zIDX];
|
|
double rsiChangeP = cXConditions.rsiChangeBuffer[pIDX];
|
|
double rsiChangePP = cXConditions.rsiChangeBuffer[ppIDX];
|
|
|
|
//
|
|
double rsiChangeSM = cXConditions.rsiChangeSMBuffer[cIDX];
|
|
double rsiChangeSMZ = cXConditions.rsiChangeSMBuffer[zIDX];
|
|
double rsiChangeSMP = cXConditions.rsiChangeSMBuffer[pIDX];
|
|
double rsiChangeSMPP = cXConditions.rsiChangeSMBuffer[ppIDX];
|
|
|
|
//
|
|
double peaksGolden = cXConditions.peaksGoldenBuffer[cIDX];
|
|
double peaksGoldenZ = cXConditions.peaksGoldenBuffer[zIDX];
|
|
double peaksGoldenP = cXConditions.peaksGoldenBuffer[pIDX];
|
|
double peaksGoldenPP = cXConditions.peaksGoldenBuffer[ppIDX];
|
|
|
|
//
|
|
double valesGolden = cXConditions.valesGoldenBuffer[cIDX];
|
|
double valesGoldenZ = cXConditions.valesGoldenBuffer[zIDX];
|
|
double valesGoldenP = cXConditions.valesGoldenBuffer[pIDX];
|
|
double valesGoldenPP = cXConditions.valesGoldenBuffer[ppIDX];
|
|
|
|
//
|
|
double priceChange = cXConditions.priceChangeBuffer[cIDX];
|
|
double priceChangeZ = cXConditions.priceChangeBuffer[zIDX];
|
|
double priceChangeP = cXConditions.priceChangeBuffer[pIDX];
|
|
double priceChangePP = cXConditions.priceChangeBuffer[ppIDX];
|
|
|
|
//
|
|
double priceChangeSM = cXConditions.priceChangeSMBuffer[cIDX];
|
|
double priceChangeSMZ = cXConditions.priceChangeSMBuffer[zIDX];
|
|
double priceChangeSMP = cXConditions.priceChangeSMBuffer[pIDX];
|
|
double priceChangeSMPP = cXConditions.priceChangeSMBuffer[ppIDX];
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
// XHK ...
|
|
|
|
//
|
|
bool isPBarClosedOverSMHK =
|
|
//
|
|
pBar.IsBullish() &&
|
|
pBar.GetUp() > pSMHKMax &&
|
|
pBar.GetDown() < pSMHKMin
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isPBarClosedUnderSMHK =
|
|
//
|
|
pBar.IsBearish() &&
|
|
pBar.GetUp() > pSMHKMax &&
|
|
pBar.GetDown() < pSMHKMin
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isPBarBullishPriceChangeVPattern =
|
|
priceChangeP > priceChangePP &&
|
|
priceChangeP > priceChange;
|
|
|
|
//
|
|
bool isPBarBerishPriceChangeVPattern =
|
|
priceChangeP < priceChangePP &&
|
|
priceChangeP < priceChange;
|
|
|
|
//
|
|
bool isPBarPriceChangeOverPeak =
|
|
priceChangeP > peak &&
|
|
priceChangeP > peakP &&
|
|
priceChangeP > peakPP;
|
|
|
|
//
|
|
bool isPBarPriceChangeUnderVale =
|
|
priceChangeP < vale &&
|
|
priceChangeP < valeP &&
|
|
priceChangeP < valePP;
|
|
|
|
//
|
|
bool isPBarCloseOverPeaksGoldenZone =
|
|
pBar.close > peaksGoldenP;
|
|
|
|
//
|
|
bool isPBarCloseUnderValesGoldenZone =
|
|
pBar.close < valesGoldenP;
|
|
|
|
//
|
|
bool isPBarPriceChangeOverAtrUpper =
|
|
priceChangeP > atrUpperSMP;
|
|
|
|
//
|
|
bool isPBarPriceChangeUnderAtrLower =
|
|
priceChangeP < atrLowerSMP;
|
|
|
|
//
|
|
isBullish =
|
|
//
|
|
// false
|
|
//
|
|
hasSelectedBox &&
|
|
selectedBox.IsBullish() &&
|
|
cXConditions.isStrBullish
|
|
//
|
|
// cBar.IsBullish() &&
|
|
// isPBarPriceChangeUnderVale &&
|
|
// isPBarPriceChangeUnderAtrLower &&
|
|
// isPBarBerishPriceChangeVPattern &&
|
|
// isPBarCloseUnderValesGoldenZone
|
|
//
|
|
;
|
|
|
|
//
|
|
isBearish =
|
|
//
|
|
// false
|
|
//
|
|
hasSelectedBox &&
|
|
selectedBox.IsBearish() &&
|
|
cXConditions.isStrBearish
|
|
//
|
|
// cBar.IsBearish() &&
|
|
// isPBarPriceChangeOverPeak &&
|
|
// isPBarPriceChangeOverAtrUpper &&
|
|
// isPBarCloseOverPeaksGoldenZone &&
|
|
// isPBarBullishPriceChangeVPattern
|
|
//
|
|
;
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
//
|
|
double xhkSL;
|
|
ENUM_X_DIRECTION xhkDir;
|
|
bool isXHKPassed = IsHKConditionsPassed(
|
|
xhkSL,
|
|
xhkDir,
|
|
cHelper,
|
|
cXConditions,
|
|
barIndex //
|
|
);
|
|
bool isXHKBullish =
|
|
isXHKPassed &&
|
|
IsBullish(xhkDir);
|
|
bool isXHKBearish =
|
|
isXHKPassed &&
|
|
IsBearish(xhkDir);
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
//
|
|
bool IsRejectedBox(
|
|
XOHCL &bar, // CBar ...
|
|
XBoxZone &box,
|
|
X121Conditions &conditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
bar.IsValid() &&
|
|
box.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isBullish = box.IsBullish();
|
|
|
|
//
|
|
bool isBullishRejected =
|
|
isBullish &&
|
|
bar.IsRejected(
|
|
box.upper,
|
|
box.dir,
|
|
true, // Force Type ...
|
|
true // Force Pressure ...
|
|
);
|
|
|
|
//
|
|
bool isBearishRejected =
|
|
!isBullish &&
|
|
bar.IsRejected(
|
|
box.lower,
|
|
box.dir,
|
|
true, // Force Type ...
|
|
true // Force Pressure ...
|
|
);
|
|
|
|
//
|
|
result = isBullishRejected ||
|
|
isBearishRejected;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool IsPeaksOrValesPassedBox(
|
|
XBoxZone &box,
|
|
X121Conditions &conditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = box.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double peakZ = conditions.peaksBuffer[0];
|
|
double peakC = conditions.peaksBuffer[1];
|
|
double peakP = conditions.peaksBuffer[2];
|
|
double peakPP = conditions.peaksBuffer[3];
|
|
|
|
//
|
|
double valeZ = conditions.valesBuffer[0];
|
|
double valeC = conditions.valesBuffer[1];
|
|
double valeP = conditions.valesBuffer[2];
|
|
double valePP = conditions.valesBuffer[3];
|
|
|
|
//
|
|
double boxQ = ((box.upper - box.lower) / 100) * 25;
|
|
double upperQuarter = box.upper - boxQ;
|
|
double lowerQuarter = box.lower + boxQ;
|
|
|
|
//
|
|
bool isPPeakInsideUpperQ =
|
|
peakP < box.upper &&
|
|
peakP > upperQuarter;
|
|
|
|
//
|
|
bool isPValeInsideLowerQ =
|
|
valeP > box.lower &&
|
|
valeP < lowerQuarter;
|
|
|
|
//
|
|
bool isPPPeakInsideUpperQ =
|
|
peakPP < box.upper &&
|
|
peakPP > upperQuarter;
|
|
|
|
//
|
|
bool isPPValeInsideLowerQ =
|
|
valePP > box.lower &&
|
|
valePP < lowerQuarter;
|
|
|
|
//
|
|
result =
|
|
//
|
|
(box.IsBullish() &&
|
|
(isPValeInsideLowerQ ||
|
|
isPPValeInsideLowerQ) &&
|
|
(valeC == valeP ||
|
|
valeP == valePP))
|
|
//
|
|
||
|
|
//
|
|
(box.IsBearish() &&
|
|
(isPPeakInsideUpperQ ||
|
|
isPPPeakInsideUpperQ) &&
|
|
(peakC == peakP ||
|
|
peakP == peakPP))
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool IsX3MaPassedBox(
|
|
XOHCL &bar, // CBar ...
|
|
XBoxZone &box,
|
|
X121Conditions &conditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
bar.IsValid() &&
|
|
box.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
double x3maFast = conditions.x3maFastBuffer[1];
|
|
double x3maMid = conditions.x3maMidBuffer[1];
|
|
double x3maSlow = conditions.x3maSlowBuffer[1];
|
|
|
|
//
|
|
bool isx3MaInsideBox =
|
|
//
|
|
// Fast ...
|
|
x3maFast < box.upper &&
|
|
x3maFast > box.lower
|
|
//
|
|
&&
|
|
//
|
|
// Mid ...
|
|
x3maMid < box.upper &&
|
|
x3maMid > box.lower
|
|
//
|
|
&&
|
|
//
|
|
// Slow ...
|
|
x3maSlow < box.upper &&
|
|
x3maSlow > box.lower
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isX3maSwitchedToBullishOrdered =
|
|
bar.IsBullish() &&
|
|
box.IsBullish() &&
|
|
isx3MaInsideBox &&
|
|
bar.close > conditions.x3maFastBuffer[1] &&
|
|
conditions.isX3MaSwitchedToBullishOrdered;
|
|
|
|
//
|
|
bool isX3maSwitchedToBearishOrdered =
|
|
bar.IsBearish() &&
|
|
box.IsBearish() &&
|
|
isx3MaInsideBox &&
|
|
bar.close < conditions.x3maFastBuffer[1] &&
|
|
conditions.isX3MaSwitchedToBearishOrdered;
|
|
|
|
//
|
|
result = isX3maSwitchedToBullishOrdered ||
|
|
isX3maSwitchedToBearishOrdered;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// TODO: Complete this ...
|
|
bool IsActivatedBoxPassed(
|
|
XBoxZone &box,
|
|
X121Conditions &conditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = box.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
bool IsHKConditionsPassed(
|
|
double &sl,
|
|
ENUM_X_DIRECTION &dir,
|
|
XC121SMCCycleHelper *helper,
|
|
X121Conditions &conditions,
|
|
int barIndex = 0 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
sl = 0;
|
|
dir = X_DIRECTION_NONE;
|
|
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
int zIDX = 0;
|
|
int cIDX = zIDX + 1;
|
|
int pIDX = cIDX + 1;
|
|
int ppIDX = pIDX + 1;
|
|
|
|
//
|
|
XOHCL zBar;
|
|
XOHCL cBar;
|
|
XOHCL pBar;
|
|
XOHCL ppBar;
|
|
|
|
//
|
|
// Retrieve Bars ...
|
|
result = zBar.Init(
|
|
conditions.symbol,
|
|
conditions.period,
|
|
barIndex //
|
|
);
|
|
result =
|
|
result &&
|
|
zBar.GetPreviousBar(cBar);
|
|
result =
|
|
result &&
|
|
cBar.GetPreviousBar(pBar);
|
|
result =
|
|
result &&
|
|
pBar.GetPreviousBar(ppBar);
|
|
if (!result)
|
|
{
|
|
//
|
|
zBar.Clean();
|
|
cBar.Clean();
|
|
pBar.Clean();
|
|
ppBar.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check PBar Swing ...
|
|
ENUM_X_DIRECTION pBarSwingDir;
|
|
bool isPBarSwing = helper
|
|
.mBarAnalyser
|
|
.IsSwing(
|
|
pBar,
|
|
pBarSwingDir,
|
|
3 //
|
|
);
|
|
|
|
//
|
|
bool isPBarSwingLow =
|
|
isPBarSwing &&
|
|
IsBullish(pBarSwingDir);
|
|
|
|
//
|
|
bool isPBarSwingHigh =
|
|
isPBarSwing &&
|
|
IsBearish(pBarSwingDir);
|
|
|
|
//
|
|
// Check PBar Rejection ...
|
|
ENUM_X_DIRECTION pBarRejectionDir;
|
|
bool isPBarRejected = helper
|
|
.mBarAnalyser
|
|
.IsRejected(
|
|
pBar,
|
|
pBarRejectionDir,
|
|
false,
|
|
true //
|
|
);
|
|
|
|
//
|
|
bool isPBarBullishRejected =
|
|
isPBarRejected &&
|
|
IsBullish(pBarRejectionDir);
|
|
|
|
//
|
|
bool isPBarBearishRejected =
|
|
isPBarRejected &&
|
|
IsBearish(pBarRejectionDir);
|
|
|
|
//
|
|
// Checking Str Incresing/Decreasing ...
|
|
|
|
//
|
|
bool isStrIncresing =
|
|
//
|
|
(conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX] &&
|
|
conditions.strBuffer[zIDX] > conditions.strBuffer[pIDX] &&
|
|
conditions.strBuffer[zIDX] > conditions.strBuffer[ppIDX])
|
|
//
|
|
&&
|
|
//
|
|
(
|
|
//
|
|
(conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX] &&
|
|
conditions.strBuffer[cIDX] > conditions.strBuffer[pIDX])
|
|
//
|
|
||
|
|
//
|
|
(conditions.strBuffer[cIDX] > conditions.strBuffer[pIDX] &&
|
|
conditions.strBuffer[pIDX] > conditions.strBuffer[ppIDX])
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isStrDecreasing =
|
|
//
|
|
(conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX] &&
|
|
conditions.strBuffer[zIDX] < conditions.strBuffer[pIDX] &&
|
|
conditions.strBuffer[zIDX] < conditions.strBuffer[ppIDX])
|
|
//
|
|
&&
|
|
//
|
|
(
|
|
//
|
|
(conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX] &&
|
|
conditions.strBuffer[cIDX] < conditions.strBuffer[pIDX])
|
|
//
|
|
||
|
|
//
|
|
(conditions.strBuffer[cIDX] < conditions.strBuffer[pIDX] &&
|
|
conditions.strBuffer[pIDX] < conditions.strBuffer[ppIDX])
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isBullish =
|
|
//
|
|
isPBarSwingLow &&
|
|
isStrIncresing &&
|
|
cBar.IsBullish() &&
|
|
cBar.low > pBar.low &&
|
|
cBar.open > pBar.low &&
|
|
zBar.open > cBar.low &&
|
|
// isPBarBullishRejected &&
|
|
conditions.isSarBullish &&
|
|
conditions.isStrBullish &&
|
|
conditions.isSMHKBullish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isBearish =
|
|
//
|
|
isPBarSwingHigh &&
|
|
isStrDecreasing &&
|
|
cBar.IsBearish() &&
|
|
cBar.high < pBar.high &&
|
|
cBar.open < pBar.high &&
|
|
zBar.open < cBar.high &&
|
|
// isPBarBearishRejected &&
|
|
conditions.isSarBearish &&
|
|
conditions.isStrBearish &&
|
|
conditions.isSMHKBearish
|
|
//
|
|
;
|
|
|
|
//
|
|
result = isBullish ||
|
|
isBearish;
|
|
if (result)
|
|
{
|
|
//
|
|
dir = isBullish
|
|
? X_DIRECTION_BULLISH
|
|
: X_DIRECTION_BEARISH;
|
|
|
|
//
|
|
// Selecting SL ...
|
|
sl =
|
|
isBullish
|
|
? cBar.low
|
|
: cBar.high;
|
|
}
|
|
|
|
//
|
|
// Cleanup Resources ...
|
|
zBar.Clean();
|
|
cBar.Clean();
|
|
pBar.Clean();
|
|
ppBar.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool IsSARConditionsPassed(
|
|
double &sl,
|
|
ENUM_X_DIRECTION &dir,
|
|
XC121SMCCycleHelper *helper,
|
|
X121Conditions &conditions,
|
|
int barIndex = 0 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
sl = 0;
|
|
dir = X_DIRECTION_NONE;
|
|
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
int zIDX = 0;
|
|
int cIDX = zIDX + 1;
|
|
int pIDX = cIDX + 1;
|
|
int ppIDX = pIDX + 1;
|
|
|
|
//
|
|
XOHCL zBar;
|
|
XOHCL cBar;
|
|
XOHCL pBar;
|
|
XOHCL ppBar;
|
|
|
|
//
|
|
// Retrieve Bars ...
|
|
result = zBar.Init(
|
|
conditions.symbol,
|
|
conditions.period,
|
|
barIndex //
|
|
);
|
|
result =
|
|
result &&
|
|
zBar.GetPreviousBar(cBar);
|
|
result =
|
|
result &&
|
|
cBar.GetPreviousBar(pBar);
|
|
result =
|
|
result &&
|
|
pBar.GetPreviousBar(ppBar);
|
|
if (!result)
|
|
{
|
|
//
|
|
zBar.Clean();
|
|
cBar.Clean();
|
|
pBar.Clean();
|
|
ppBar.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check PBar Swing ...
|
|
ENUM_X_DIRECTION pBarSwingDir;
|
|
bool isPBarSwing = helper
|
|
.mBarAnalyser
|
|
.IsSwing(
|
|
pBar,
|
|
pBarSwingDir,
|
|
3 //
|
|
);
|
|
|
|
//
|
|
bool isPBarSwingLow =
|
|
isPBarSwing &&
|
|
IsBullish(pBarSwingDir);
|
|
|
|
//
|
|
bool isPBarSwingHigh =
|
|
isPBarSwing &&
|
|
IsBearish(pBarSwingDir);
|
|
|
|
//
|
|
bool isBullish =
|
|
//
|
|
isPBarSwingLow &&
|
|
cBar.IsBullish() &&
|
|
cBar.low > pBar.low &&
|
|
cBar.open > pBar.low &&
|
|
zBar.open > cBar.low &&
|
|
conditions.isSarSwitchedToBullish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isBearish =
|
|
//
|
|
isPBarSwingHigh &&
|
|
isStrDecreasing &&
|
|
cBar.IsBearish() &&
|
|
cBar.high < pBar.high &&
|
|
cBar.open < pBar.high &&
|
|
zBar.open < cBar.high &&
|
|
conditions.isSarSwitchedToBearish
|
|
//
|
|
;
|
|
|
|
//
|
|
result = isBullish ||
|
|
isBearish;
|
|
if (result)
|
|
{
|
|
//
|
|
dir = isBullish
|
|
? X_DIRECTION_BULLISH
|
|
: X_DIRECTION_BEARISH;
|
|
|
|
//
|
|
// Selecting SL ...
|
|
sl =
|
|
isBullish
|
|
? cBar.low
|
|
: cBar.high;
|
|
}
|
|
|
|
//
|
|
// Cleanup Resources ...
|
|
zBar.Clean();
|
|
cBar.Clean();
|
|
pBar.Clean();
|
|
ppBar.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
// //
|
|
// bool isPVPassed = IsPeaksOrValesPassedBox(
|
|
// iBox,
|
|
// cXConditions //
|
|
// );
|
|
// if (isPVPassed)
|
|
// {
|
|
// //
|
|
// selectedBox = iBox;
|
|
// iBox.Clean();
|
|
// break;
|
|
// }
|
|
|
|
//
|
|
// bool isx3MaPassed = IsX3MaPassedBox(
|
|
// cBar,
|
|
// iBox,
|
|
// cXConditions //
|
|
// );
|
|
// if (isx3MaPassed)
|
|
// {
|
|
// //
|
|
// selectedBox = iBox;
|
|
// iBox.Clean();
|
|
// break;
|
|
// }
|
|
|
|
//
|
|
// bool isRejected = IsRejectedBox(
|
|
// cBar,
|
|
// iBox,
|
|
// cXConditions //
|
|
// );
|
|
// if (isRejected)
|
|
// {
|
|
// //
|
|
// selectedBox = iBox;
|
|
// iBox.Clean();
|
|
// break;
|
|
// }
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
//
|
|
// Checking Bullish Fair Value Gaps ...
|
|
has = cState.HasBullishFairValueGaps();
|
|
if (has)
|
|
{
|
|
//
|
|
XBoxZone tmpBoxes[];
|
|
ToBox(
|
|
cState.bullishFairValueGaps,
|
|
tmpBoxes //
|
|
);
|
|
|
|
//
|
|
count = ArraySize(tmpBoxes);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XBoxZone iBox = tmpBoxes[i];
|
|
bool isValid = IsBoxValid(
|
|
iBox,
|
|
0,
|
|
iBox.period //
|
|
);
|
|
if (!isValid)
|
|
{
|
|
//
|
|
iBox.Clean();
|
|
continue;
|
|
}
|
|
|
|
//
|
|
has = IsBoxExists(iBox);
|
|
if (!has)
|
|
{
|
|
//
|
|
AddRef(
|
|
iBox,
|
|
mWaitingBoxes //
|
|
);
|
|
}
|
|
|
|
//
|
|
iBox.Clean();
|
|
}
|
|
}
|
|
|
|
//
|
|
Clean(tmpBoxes);
|
|
}
|
|
|
|
//
|
|
// Checking Bearish Fair Value Gaps ...
|
|
has = cState.HasBearishFairValueGaps();
|
|
if (has)
|
|
{
|
|
//
|
|
XBoxZone tmpBoxes[];
|
|
ToBox(
|
|
cState.bearishFairValueGaps,
|
|
tmpBoxes //
|
|
);
|
|
|
|
//
|
|
count = ArraySize(tmpBoxes);
|
|
has = IsValidSize(count);
|
|
if (has)
|
|
{
|
|
//
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XBoxZone iBox = tmpBoxes[i];
|
|
bool isValid = IsBoxValid(
|
|
iBox,
|
|
0,
|
|
iBox.period //
|
|
);
|
|
if (!isValid)
|
|
{
|
|
//
|
|
iBox.Clean();
|
|
continue;
|
|
;
|
|
}
|
|
|
|
//
|
|
has = IsBoxExists(iBox);
|
|
if (!has)
|
|
{
|
|
//
|
|
AddRef(
|
|
iBox,
|
|
mWaitingBoxes //
|
|
);
|
|
}
|
|
|
|
//
|
|
iBox.Clean();
|
|
}
|
|
}
|
|
|
|
//
|
|
Clean(tmpBoxes);
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////
|