last ...
This commit is contained in:
@@ -5595,7 +5595,7 @@ struct XBoxZone
|
||||
|
||||
/**
|
||||
* Extract Rejection Price based on Box Direction ...
|
||||
*
|
||||
*
|
||||
* @return ( double )
|
||||
*/
|
||||
double GetRejection()
|
||||
@@ -5654,6 +5654,42 @@ struct XBoxZone
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve To Bar ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool ToBar(XOHCL &bar)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bar.Clean();
|
||||
|
||||
//
|
||||
int idx = ToIndex();
|
||||
|
||||
//
|
||||
result =
|
||||
IsValid() &&
|
||||
IsValidIndex(idx);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = bar.Init(
|
||||
symbol,
|
||||
period,
|
||||
idx //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* From Bar Index ...
|
||||
*
|
||||
@@ -5689,6 +5725,42 @@ struct XBoxZone
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve From Bar ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool FromBar(XOHCL &bar)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bar.Clean();
|
||||
|
||||
//
|
||||
int idx = FromIndex();
|
||||
|
||||
//
|
||||
result =
|
||||
IsValid() &&
|
||||
IsValidIndex(idx);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = bar.Init(
|
||||
symbol,
|
||||
period,
|
||||
idx //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Unique Identifier ...
|
||||
*
|
||||
|
||||
@@ -255,6 +255,95 @@ int ExtractPivots(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsFakeBreakeout(
|
||||
XBoxZone &pivot,
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
barIndex = NormalizeInt(barIndex, 0);
|
||||
|
||||
//
|
||||
result = pivot.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int fromIDX = pivot.FromIndex();
|
||||
result = barIndex > fromIDX;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = pivot.IsBullish();
|
||||
|
||||
//
|
||||
// Retrieve Required Bars ...
|
||||
XOHCL cBar;
|
||||
XOHCL pBar;
|
||||
XOHCL p2Bar;
|
||||
XOHCL p3Bar;
|
||||
result = cBar.Init(
|
||||
pivot.symbol,
|
||||
pivot.period,
|
||||
barIndex //
|
||||
);
|
||||
result = result &&
|
||||
cBar.GetPreviousBar(pBar);
|
||||
result = result &&
|
||||
pBar.GetPreviousBar(p2Bar);
|
||||
result = result &&
|
||||
p2Bar.GetPreviousBar(p3Bar);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
p2Bar.Clean();
|
||||
p3Bar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double breakPrice =
|
||||
isBullish
|
||||
? pivot.lower
|
||||
: pivot.upper;
|
||||
|
||||
//
|
||||
bool isBarInside =
|
||||
cBar.GetDirection() == pivot.dir &&
|
||||
cBar.GetUp() > breakPrice &&
|
||||
cBar.GetDown() < breakPrice;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
// Bar Must Inside Pivot ...
|
||||
isBarInside
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
p2Bar.Clean();
|
||||
p3Bar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
struct XCAPivot
|
||||
{
|
||||
|
||||
@@ -1080,6 +1080,7 @@ bool DetectXCAEAConditions(
|
||||
XBoxZone rejectedPivot;
|
||||
XBoxZone insidePivots[];
|
||||
int insidePivotsCount = 0;
|
||||
XBoxZone fakeBreakedPivot;
|
||||
bool isRejectedOnMid = false;
|
||||
bool hasInsidePivots = false;
|
||||
bool hasPivots = HasChild(pivots);
|
||||
@@ -1123,6 +1124,28 @@ bool DetectXCAEAConditions(
|
||||
true //
|
||||
);
|
||||
Clean(allowedRejectedPivots);
|
||||
|
||||
//
|
||||
// Select Fake Breakout Box ...
|
||||
ENUM_XCA_PIVOTS allowedFakeBreakedPivots[] = {
|
||||
XCA_PEAK,
|
||||
XCA_VALE,
|
||||
};
|
||||
has = SelectFakeBreakedBox(
|
||||
allowedFakeBreakedPivots,
|
||||
fakeBreakedPivot,
|
||||
pivots,
|
||||
zBar,
|
||||
cBar,
|
||||
pBar,
|
||||
p2Bar //
|
||||
);
|
||||
Clean(allowedFakeBreakedPivots);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
Print("Faked Breaked Box Detected ...");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1413,6 +1436,7 @@ bool DetectXCAEAConditions(
|
||||
Clean(insidePivots);
|
||||
pConditions.Clean();
|
||||
rejectedPivot.Clean();
|
||||
fakeBreakedPivot.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -1673,6 +1697,109 @@ bool SelectRejectedBox(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool SelectFakeBreakedBox(
|
||||
ENUM_XCA_PIVOTS &allowedTypes[],
|
||||
XBoxZone &box,
|
||||
XBoxZone &boxes[],
|
||||
XOHCL &zBar,
|
||||
XOHCL &cBar,
|
||||
XOHCL &pBar,
|
||||
XOHCL &p2Bar //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result =
|
||||
zBar.IsValid() &&
|
||||
cBar.IsValid() &&
|
||||
pBar.IsValid() &&
|
||||
p2Bar.IsValid() &&
|
||||
HasChild(boxes);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XBoxZone tmp[];
|
||||
Copy(
|
||||
boxes,
|
||||
tmp //
|
||||
);
|
||||
|
||||
//
|
||||
int idx = -1;
|
||||
XBoxZone iBox;
|
||||
while (HasChild(tmp))
|
||||
{
|
||||
//
|
||||
idx = GetYoungest(tmp);
|
||||
result = IsValidIndex(idx);
|
||||
if (!result)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iBox = tmp[idx];
|
||||
ArrayRemove(
|
||||
tmp,
|
||||
idx,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
// Checking Box Type Allowed ...
|
||||
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
|
||||
result = IsValid(iType) &&
|
||||
(!HasChild(allowedTypes)
|
||||
? true
|
||||
: Contains(
|
||||
iType,
|
||||
allowedTypes //
|
||||
));
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Box Fake Breakeout ...
|
||||
result = IsFakeBreakeout(
|
||||
iBox,
|
||||
cBar.Index() //
|
||||
);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
box = iBox;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
Clean(tmp);
|
||||
iBox.Clean();
|
||||
|
||||
//
|
||||
result = box.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int ExtractValues(
|
||||
double &values[],
|
||||
|
||||
Reference in New Issue
Block a user