last ...
This commit is contained in:
@@ -1214,6 +1214,81 @@ struct XOHCL
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Highest of Specified Price type in Market ...
|
||||
*
|
||||
* @param index: souble, reference to hold detected Value Bar index ...
|
||||
* @param mLength: int, Specified Loopback Length ...
|
||||
* @param mPriceType: ENUM_X_PRICE, Specified Price type to Detect ...
|
||||
*
|
||||
* @return ( double )
|
||||
*/
|
||||
double FindHighest(
|
||||
int &index, // Index ...
|
||||
int mLength, // Loopback ...
|
||||
ENUM_X_PRICE mPriceType // Price Type ...
|
||||
)
|
||||
{
|
||||
//
|
||||
double result = EMPTY_VALUE;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
index = -1;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
mLength = NormalizeInt(mLength, 1);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
bool has = IsValid() &&
|
||||
IsXValid(mPriceType);
|
||||
if (!has)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
int start = Index();
|
||||
int end = start + mLength;
|
||||
double iValue = EMPTY_VALUE;
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
//
|
||||
iBar.Clean();
|
||||
has = BarAt(i, iBar);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate Price ...
|
||||
iValue = iBar.GetPrice(mPriceType);
|
||||
|
||||
//
|
||||
// Compare Price With Prev Detected ...
|
||||
has = !NotEmptyZero(result)
|
||||
? true
|
||||
: iValue > result;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
index = i;
|
||||
result = iValue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Highest ...
|
||||
double FindHighestUp(
|
||||
@@ -1316,6 +1391,81 @@ struct XOHCL
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Lowest of Specified Price type in Market ...
|
||||
*
|
||||
* @param index: souble, reference to hold detected Value Bar index ...
|
||||
* @param mLength: int, Specified Loopback Length ...
|
||||
* @param mPriceType: ENUM_X_PRICE, Specified Price type to Detect ...
|
||||
*
|
||||
* @return ( double )
|
||||
*/
|
||||
double FindLowest(
|
||||
int &index, // Index ...
|
||||
int mLength, // Loopback ...
|
||||
ENUM_X_PRICE mPriceType // Price Type ...
|
||||
)
|
||||
{
|
||||
//
|
||||
double result = EMPTY_VALUE;
|
||||
|
||||
//
|
||||
// Prepare ...
|
||||
index = -1;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
mLength = NormalizeInt(mLength, 1);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
bool has = IsValid() &&
|
||||
IsXValid(mPriceType);
|
||||
if (!has)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
int start = Index();
|
||||
int end = start + mLength;
|
||||
double iValue = EMPTY_VALUE;
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
//
|
||||
iBar.Clean();
|
||||
has = BarAt(i, iBar);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate Price ...
|
||||
iValue = iBar.GetPrice(mPriceType);
|
||||
|
||||
//
|
||||
// Compare Price With Prev Detected ...
|
||||
has = !NotEmptyZero(result)
|
||||
? true
|
||||
: iValue < result;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
index = i;
|
||||
result = iValue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Lowest ...
|
||||
double FindLowesttDown(
|
||||
|
||||
Reference in New Issue
Block a user