last ...
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user