last ...
This commit is contained in:
@@ -665,76 +665,39 @@ bool DetectXCAEAConditions(
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
double zPeak = conditions.peakBuffer[zIDX];
|
||||
double cPeak = conditions.peakBuffer[cIDX];
|
||||
double pPeak = conditions.peakBuffer[pIDX];
|
||||
double p2Peak = conditions.peakBuffer[p2IDX];
|
||||
|
||||
//
|
||||
double zVale = conditions.valeBuffer[zIDX];
|
||||
double cVale = conditions.valeBuffer[cIDX];
|
||||
double pVale = conditions.valeBuffer[pIDX];
|
||||
double p2Vale = conditions.valeBuffer[p2IDX];
|
||||
|
||||
//
|
||||
// Parsing Pivots ...
|
||||
|
||||
|
||||
//
|
||||
// Detect Selected Pivot ...
|
||||
XBoxZone lastOSCPivot;
|
||||
XBoxZone rejectedPivot;
|
||||
double providedSL = 0;
|
||||
bool hasPivots = HasChild(pivots);
|
||||
if (hasPivots)
|
||||
{
|
||||
//
|
||||
// Detect Selected Pivots ...
|
||||
count = ArraySize(pivots);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iPivot = pivots[i];
|
||||
|
||||
//
|
||||
// Detect Selected Last OSC Pivots ...
|
||||
bool isOSC =
|
||||
Contains(
|
||||
"XCA_RSI",
|
||||
iPivot.type //
|
||||
) ||
|
||||
Contains(
|
||||
"XCA_CCI",
|
||||
iPivot.type //
|
||||
);
|
||||
bool canSetOSC =
|
||||
!isOSC
|
||||
? false
|
||||
: !lastOSCPivot.IsValid()
|
||||
? true
|
||||
: lastOSCPivot.from < iPivot.from;
|
||||
if (canSetOSC)
|
||||
{
|
||||
lastOSCPivot = iPivot;
|
||||
}
|
||||
|
||||
//
|
||||
iPivot.Clean();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Detect New OSC Pivot Happens ...
|
||||
bool hasNewOSC = lastOSCPivot.IsValid() &&
|
||||
cBar.time == lastOSCPivot.to;
|
||||
if (hasNewOSC)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper.poiDrawer.DrawBox(
|
||||
lastOSCPivot,
|
||||
iObj //
|
||||
has = SelectRejectedBox(
|
||||
rejectedPivot,
|
||||
pivots,
|
||||
zBar,
|
||||
cBar,
|
||||
pBar,
|
||||
p2Bar,
|
||||
true,
|
||||
true //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iObj.BoxWidth(2);
|
||||
|
||||
//
|
||||
Print("OSC Box Detected ...");
|
||||
}
|
||||
|
||||
//
|
||||
ZeroMemory(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -773,6 +736,8 @@ bool DetectXCAEAConditions(
|
||||
|
||||
//
|
||||
Print("Cond1");
|
||||
isCond1Bullish = false;
|
||||
isCond1Bearish = false;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -926,9 +891,6 @@ bool DetectXCAEAConditions(
|
||||
conditions.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
lastOSCPivot.Clean();
|
||||
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
@@ -937,6 +899,125 @@ bool DetectXCAEAConditions(
|
||||
p3Bar.Clean();
|
||||
p4Bar.Clean();
|
||||
pConditions.Clean();
|
||||
rejectedPivot.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool SelectRejectedBox(
|
||||
XBoxZone &box,
|
||||
XBoxZone &boxes[],
|
||||
XOHCL &zBar,
|
||||
XOHCL &cBar,
|
||||
XOHCL &pBar,
|
||||
XOHCL &p2Bar,
|
||||
bool forceBarType = false,
|
||||
bool forcePressure = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = HasChild(boxes) &&
|
||||
zBar.IsValid() &&
|
||||
cBar.IsValid() &&
|
||||
pBar.IsValid() &&
|
||||
p2Bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(boxes);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = boxes[i];
|
||||
|
||||
//
|
||||
bool isBullish = iBox.IsBullish();
|
||||
bool isBearish = iBox.IsBearish();
|
||||
|
||||
//
|
||||
double boundaryPrice =
|
||||
isBullish
|
||||
? iBox.upper
|
||||
: iBox.lower;
|
||||
|
||||
//
|
||||
double midPrice =
|
||||
iBox.lower +
|
||||
((iBox.upper - iBox.lower) / 2);
|
||||
|
||||
//
|
||||
bool isMidBullishRejected = cBar.IsRejected(
|
||||
midPrice,
|
||||
X_DIRECTION_BULLISH,
|
||||
forceBarType,
|
||||
forcePressure //
|
||||
);
|
||||
|
||||
//
|
||||
bool isBoundaryBullishRejected = cBar.IsRejected(
|
||||
boundaryPrice,
|
||||
X_DIRECTION_BULLISH,
|
||||
forceBarType,
|
||||
forcePressure //
|
||||
);
|
||||
|
||||
//
|
||||
bool isMidBearishRejected = cBar.IsRejected(
|
||||
midPrice,
|
||||
X_DIRECTION_BEARISH,
|
||||
forceBarType,
|
||||
forcePressure //
|
||||
);
|
||||
|
||||
//
|
||||
bool isBoundaryBearishRejected = cBar.IsRejected(
|
||||
boundaryPrice,
|
||||
X_DIRECTION_BEARISH,
|
||||
forceBarType,
|
||||
forcePressure //
|
||||
);
|
||||
|
||||
//
|
||||
bool isBullishRejected =
|
||||
isBullish &&
|
||||
(isMidBullishRejected ||
|
||||
isBoundaryBullishRejected);
|
||||
|
||||
//
|
||||
bool isBearishRejected =
|
||||
isBearish &&
|
||||
(isMidBearishRejected ||
|
||||
isBoundaryBearishRejected);
|
||||
|
||||
//
|
||||
bool isRejected =
|
||||
isBullishRejected ||
|
||||
isBearishRejected;
|
||||
if (isRejected)
|
||||
{
|
||||
//
|
||||
box = iBox;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = box.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user