last works on validating POI's ...
This commit is contained in:
@@ -524,6 +524,7 @@ bool IsBoxValid(
|
||||
for (int i = barIndex; i <= toIDX; i++)
|
||||
{
|
||||
//
|
||||
// Initialize Indexed Bar ...
|
||||
result = iBar.Init(
|
||||
box.symbol,
|
||||
box.period,
|
||||
@@ -531,11 +532,16 @@ bool IsBoxValid(
|
||||
);
|
||||
|
||||
//
|
||||
// Checking Price ...
|
||||
result =
|
||||
//
|
||||
// Checking Bar Validation ...
|
||||
result &&
|
||||
//
|
||||
// Checking Price Breaked or not ...
|
||||
(isBullish
|
||||
? iBar.close < appliedPrice
|
||||
: iBar.close > appliedPrice);
|
||||
? iBar.close < box.lower
|
||||
: iBar.close > box.upper);
|
||||
if (result)
|
||||
{
|
||||
edgeBreakes++;
|
||||
@@ -556,12 +562,15 @@ bool IsBoxValid(
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
// return true;
|
||||
|
||||
//
|
||||
result =
|
||||
edgeBreakes >= barsLength;
|
||||
edgeBreakes < barsLength;
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -907,4 +916,88 @@ bool IsBoxPlaceValidForBar(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
void ValidateBoxes(
|
||||
XBoxZone &boxes[],
|
||||
int barIndex = 0,
|
||||
int barsLength = 3,
|
||||
bool forceSorting = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
// Normalize Args ...
|
||||
barIndex = NormalizeInt(barIndex, 0);
|
||||
barsLength = NormalizeInt(barsLength, 3);
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
has = HasChild(boxes);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy Boxes to tmp ...
|
||||
XBoxZone tmp[];
|
||||
Copy(
|
||||
boxes,
|
||||
tmp //
|
||||
);
|
||||
Clean(boxes);
|
||||
|
||||
//
|
||||
// Looping Through Exists Boxes ...
|
||||
while (HasChild(tmp))
|
||||
{
|
||||
//
|
||||
// Select Indexed Box ...
|
||||
XBoxZone iBox = tmp[0];
|
||||
|
||||
//
|
||||
// Remove Indexed Box ...
|
||||
ArrayRemove(
|
||||
tmp,
|
||||
0,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Box Validating ...
|
||||
has = IsBoxValid(
|
||||
iBox,
|
||||
barIndex,
|
||||
barsLength //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
iBox,
|
||||
boxes //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Sorting ...
|
||||
if (forceSorting)
|
||||
{
|
||||
//
|
||||
// Check Has Result or not ...
|
||||
has = HasChild(boxes);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Sorting ...
|
||||
SortBoxes(boxes);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user