last ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -29,129 +29,3 @@
|
|||||||
// Models ...
|
// Models ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Consolidation Zone ...
|
|
||||||
struct XConsolidationZone
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
string symbol; // Symbol ...
|
|
||||||
ENUM_TIMEFRAMES period; // Period ...
|
|
||||||
|
|
||||||
//
|
|
||||||
double upper; // Upper ...
|
|
||||||
double lower; // Lower ...
|
|
||||||
|
|
||||||
//
|
|
||||||
datetime from; // Start Date
|
|
||||||
datetime to; // Breake Date
|
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_X_DIRECTION dir; // Break Direction ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor ...
|
|
||||||
XConsolidationZone()
|
|
||||||
{
|
|
||||||
Clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Tools ...
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cleanup ...
|
|
||||||
*/
|
|
||||||
void Clean()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
upper = 0;
|
|
||||||
lower = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
to = NULL;
|
|
||||||
from = NULL;
|
|
||||||
symbol = NULL;
|
|
||||||
period = NULL;
|
|
||||||
dir = X_DIRECTION_NONE;
|
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsValid()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
upper > 0 &&
|
|
||||||
lower > 0 &&
|
|
||||||
IsValid(to) &&
|
|
||||||
IsValid(from) &&
|
|
||||||
IsValid(symbol) &&
|
|
||||||
IsValid(period) &&
|
|
||||||
HasDirection(dir)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsSameAs(
|
|
||||||
XConsolidationZone &item //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = IsValid() &&
|
|
||||||
item.IsValid() &&
|
|
||||||
dir == item.dir &&
|
|
||||||
from == item.from &&
|
|
||||||
upper == item.upper &&
|
|
||||||
lower == item.lower &&
|
|
||||||
symbol == item.symbol &&
|
|
||||||
period == item.period;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve Unique Identifier ...
|
|
||||||
*
|
|
||||||
* @return ( string )
|
|
||||||
*/
|
|
||||||
string GetTag()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
string result =
|
|
||||||
//
|
|
||||||
"XCZONE" + "_" +
|
|
||||||
ToString(dir) + "_" +
|
|
||||||
symbol + "_" +
|
|
||||||
ToString(period) + "_" +
|
|
||||||
ToString(upper) + "_" +
|
|
||||||
ToString(lower)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -309,11 +309,11 @@ struct XBoxZone
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract Rejection Price based on Box Direction ...
|
* Retrieve Box Applied Price ...
|
||||||
*
|
*
|
||||||
* @return ( double )
|
* @return ( double )
|
||||||
*/
|
*/
|
||||||
double GetRejection()
|
double GetDirectionalPrice()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
double result = 0;
|
double result = 0;
|
||||||
@@ -334,6 +334,32 @@ struct XBoxZone
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Box Breaked Price ...
|
||||||
|
*
|
||||||
|
* @return ( double )
|
||||||
|
*/
|
||||||
|
double GetInDirectionalPrice()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
IsBullish()
|
||||||
|
? lower
|
||||||
|
: upper;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To Bar Index ...
|
* To Bar Index ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2458,7 +2458,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
has = HasInvalidPivots();
|
has = HasInvalidPivots();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
ApplySortOnBoxes(invalidPivots);
|
SortBoxes(invalidPivots);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2469,7 +2469,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
has = HasPeakPivots();
|
has = HasPeakPivots();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
ApplySortOnBoxes(peakPivots);
|
SortBoxes(peakPivots);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2477,7 +2477,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
has = HasValePivots();
|
has = HasValePivots();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
ApplySortOnBoxes(valePivots);
|
SortBoxes(valePivots);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2485,7 +2485,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
has = HasMTBullishPivots();
|
has = HasMTBullishPivots();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
ApplySortOnBoxes(mtBullishPivots);
|
SortBoxes(mtBullishPivots);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2493,7 +2493,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
has = HasMTBearishPivots();
|
has = HasMTBearishPivots();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
ApplySortOnBoxes(mtBearishPivots);
|
SortBoxes(mtBearishPivots);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2501,7 +2501,7 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
has = HasOBBullishPivots();
|
has = HasOBBullishPivots();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
ApplySortOnBoxes(obBullishPivots);
|
SortBoxes(obBullishPivots);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2509,70 +2509,10 @@ class XCXCATBEAPOIDetector : public XCBase
|
|||||||
has = HasOBBearishPivots();
|
has = HasOBBearishPivots();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
ApplySortOnBoxes(obBearishPivots);
|
SortBoxes(obBearishPivots);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
void ApplySortOnBoxes(
|
|
||||||
XBoxZone &items[] //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int idx = -1;
|
|
||||||
bool has = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
has = HasChild(items);
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XBoxZone tmp[];
|
|
||||||
Copy(
|
|
||||||
items,
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
Clean(items);
|
|
||||||
|
|
||||||
//
|
|
||||||
while (HasChild(tmp))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
idx = GetOldest(tmp);
|
|
||||||
has = IsValidIndex(idx);
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XBoxZone iBox = tmp[idx];
|
|
||||||
ArrayRemove(
|
|
||||||
tmp,
|
|
||||||
idx,
|
|
||||||
1 //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
iBox,
|
|
||||||
items //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
items,
|
|
||||||
maxAllowedPivots //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
void ApplyValidationOnBoxes(
|
void ApplyValidationOnBoxes(
|
||||||
XBoxZone &items[],
|
XBoxZone &items[],
|
||||||
|
|||||||
Reference in New Issue
Block a user