last ...
This commit is contained in:
@@ -3725,6 +3725,7 @@ struct XConsolidationZone
|
||||
double lower; // Lower ...
|
||||
|
||||
//
|
||||
datetime initTime;
|
||||
int loopback; // Loopback ...
|
||||
|
||||
//
|
||||
@@ -3775,6 +3776,10 @@ struct XConsolidationZone
|
||||
_loopback > 0
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
upper = _upper;
|
||||
@@ -3785,22 +3790,87 @@ struct XConsolidationZone
|
||||
|
||||
//
|
||||
result = IsValid();
|
||||
if (result)
|
||||
{
|
||||
initTime = TimeCurrent();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Breaked State ...
|
||||
*/
|
||||
void Update()
|
||||
{
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
if (IsBreaked())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
bool isInited = cBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
0 //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
isInited = cBar.GetPreviousBar(pBar);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Consolidation Breaks ...
|
||||
// Update Zone ...
|
||||
// Add it ...
|
||||
bool isBOSTop = cBar.high > upper;
|
||||
bool isBOSBottom = cBar.low < lower;
|
||||
bool hasBOS = isBOSTop ||
|
||||
isBOSBottom;
|
||||
if (!hasBOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate Break Direction ...
|
||||
breakerBar = cBar;
|
||||
breakDirection = isBOSTop
|
||||
? X_DIRECTION_BULLISH
|
||||
: isBOSBottom
|
||||
? X_DIRECTION_BEARISH
|
||||
: X_DIRECTION_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
upper = 0;
|
||||
lower = 0;
|
||||
loopback = 0;
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
initTime = NULL;
|
||||
breakerBar.Clean();
|
||||
breakDirection = X_DIRECTION_NONE;
|
||||
}
|
||||
@@ -3966,6 +4036,62 @@ struct XConsolidationZone
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Start Time ...
|
||||
*
|
||||
* @return ( datetime )
|
||||
*/
|
||||
datetime From()
|
||||
{
|
||||
//
|
||||
datetime result = NULL;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int startIndex = iBarShift(
|
||||
symbol,
|
||||
period,
|
||||
initTime //
|
||||
);
|
||||
|
||||
//
|
||||
result = iTime(
|
||||
symbol,
|
||||
period,
|
||||
loopback + startIndex //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Unique Identifier ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string GetTag()
|
||||
{
|
||||
//
|
||||
string result =
|
||||
//
|
||||
GetTypeName(this) + "_" +
|
||||
symbol + "_" +
|
||||
ToString(period) + "_" +
|
||||
ToString(upper) + "_" +
|
||||
ToString(lower)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user