This commit is contained in:
2025-04-04 13:10:31 +03:30
parent 72610213e7
commit 9e8d830707
5 changed files with 1535 additions and 527 deletions
+92 -6
View File
@@ -1340,12 +1340,12 @@ bool IsBoxValid(
}
//
int fromIndex = iBarShift(
int toIndex = iBarShift(
box.symbol,
forPeriod,
box.from //
box.to //
);
result = IsValidIndex(fromIndex);
result = IsValidIndex(toIndex);
if (!result)
{
return result;
@@ -1354,7 +1354,7 @@ bool IsBoxValid(
//
XOHCL iBar;
bool isBullish = box.IsBullish();
for (int i = barIndex; i < fromIndex; i++)
for (int i = barIndex; i < toIndex; i++)
{
//
result = iBar.Init(
@@ -1370,8 +1370,94 @@ bool IsBoxValid(
//
result =
isBullish
? iBar.GetDown() > box.lower
: iBar.GetUp() < box.upper;
? iBar.low > box.upper
: iBar.high < box.lower;
if (!result)
{
break;
}
//
iBar.Clean();
}
//
iBar.Clean();
//
return result;
}
/**
* Check Box Breaked ...
*
* @param box: XBoxZone instance ...
* @param barIndex: int, Current Bar Index ...
* @param forPeriod: Testing Period ...
*
* @return ( bool )
*/
bool IsBoxBreaked(
XBoxZone &box,
int barIndex = 0,
ENUM_TIMEFRAMES forPeriod = NULL //
)
{
//
bool result = false;
//
result = box.IsValid();
if (!result)
{
return result;
}
//
if (barIndex < 0)
{
barIndex = 0;
}
//
if (!IsValid(forPeriod))
{
forPeriod = box.period;
}
//
int toIndex = iBarShift(
box.symbol,
forPeriod,
box.to //
);
result = IsValidIndex(toIndex);
if (!result)
{
return result;
}
//
XOHCL iBar;
bool isBullish = box.IsBullish();
for (int i = barIndex; i < toIndex; i++)
{
//
result = iBar.Init(
box.symbol,
forPeriod,
i //
);
if (!result)
{
break;
}
//
result =
isBullish
? iBar.high < box.lower
: iBar.low > box.upper;
if (!result)
{
break;