last ...
This commit is contained in:
@@ -7793,6 +7793,57 @@ int FindIndex(
|
||||
//
|
||||
return result;
|
||||
}
|
||||
//
|
||||
// Find Specific Item Index inside a Collection ...
|
||||
template <typename T>
|
||||
int FindIndex(
|
||||
T &item, // Item to Find
|
||||
const T &items[] // Items for Search
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = -1;
|
||||
|
||||
//
|
||||
// Check Item Validation ...
|
||||
if (!item.IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int itemsCount = ArraySize(items);
|
||||
if (itemsCount <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < itemsCount; i++)
|
||||
{
|
||||
//
|
||||
T iItem = items[i];
|
||||
|
||||
//
|
||||
// Validate Item ...
|
||||
if (!iItem.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool isSame = item.IsSameAs(iItem);
|
||||
if (isSame && result <= -1)
|
||||
{
|
||||
//
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check an Array Contains Specified Value ...
|
||||
|
||||
@@ -2450,6 +2450,36 @@ int AddIfNotExists(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update to Time of Specifiex Collection ...
|
||||
*
|
||||
* @param items: XOBFVG instance Collection ...
|
||||
* @param value: datetime ...
|
||||
*/
|
||||
template <typename T>
|
||||
void SpecifiedUpdateTo(
|
||||
T *&items[],
|
||||
datetime value = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
value = NormalizeTime(value);
|
||||
|
||||
//
|
||||
int count = ArraySize(items);
|
||||
bool has = HasChild(items);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
items[i].To(value);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
template <typename T>
|
||||
int FilterZones(
|
||||
|
||||
@@ -2018,9 +2018,8 @@ class XCTwoBarZone : public XCZone
|
||||
XOHCL &startBar,
|
||||
XOHCL &endBar,
|
||||
ENUM_XPOIS type,
|
||||
bool useStartBarForUpper,
|
||||
ENUM_X_PRICE upperPrice,
|
||||
ENUM_X_PRICE lowerPrice //
|
||||
ENUM_X_PRICE startPrice,
|
||||
ENUM_X_PRICE endPrice //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -2042,18 +2041,33 @@ class XCTwoBarZone : public XCZone
|
||||
mType = type;
|
||||
mEndBar = endBar;
|
||||
mStartBar = startBar;
|
||||
mUpperPrice = upperPrice;
|
||||
mLowerPrice = lowerPrice;
|
||||
mUseStartBarForUpper = useStartBarForUpper;
|
||||
|
||||
//
|
||||
int startIndex = startBar.Index();
|
||||
int endIndex = endBar.Index();
|
||||
|
||||
mUpper =
|
||||
useStartBarForUpper
|
||||
? startBar.GetPrice(upperPrice)
|
||||
: endBar.GetPrice(upperPrice);
|
||||
mLower =
|
||||
useStartBarForUpper
|
||||
? endBar.GetPrice(lowerPrice)
|
||||
: startBar.GetPrice(lowerPrice);
|
||||
//
|
||||
double mStartPrice = startBar.GetPrice(startPrice);
|
||||
double mEndPrice = endBar.GetPrice(endPrice);
|
||||
bool isStartOverEnd = mStartPrice > mEndPrice;
|
||||
|
||||
//
|
||||
if (isStartOverEnd)
|
||||
{
|
||||
//
|
||||
mUpperPrice = startPrice;
|
||||
mLowerPrice = endPrice;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
mUpperPrice = endPrice;
|
||||
mLowerPrice = startPrice;
|
||||
}
|
||||
|
||||
//
|
||||
mUpper = MathMax(mStartPrice, mEndPrice);
|
||||
mLower = MathMin(mStartPrice, mEndPrice);
|
||||
|
||||
//
|
||||
result = IsValidTwoBarZone();
|
||||
@@ -4342,24 +4356,20 @@ class XCFVG : public XCTwoBarZone
|
||||
: X_POI_BEARISH_FVG;
|
||||
|
||||
//
|
||||
bool useFistForUpper = isDirBullish
|
||||
? false
|
||||
: true;
|
||||
ENUM_X_PRICE upPrice = isDirBullish
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_HIGH;
|
||||
ENUM_X_PRICE loPrice = isDirBullish
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_LOW;
|
||||
ENUM_X_PRICE startPrice = isDirBullish
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_LOW;
|
||||
ENUM_X_PRICE endPrice = isDirBullish
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_HIGH;
|
||||
|
||||
//
|
||||
result = InitTwoBarZone(
|
||||
startBar,
|
||||
endBar,
|
||||
mTT,
|
||||
useFistForUpper,
|
||||
upPrice,
|
||||
loPrice //
|
||||
startPrice,
|
||||
endPrice //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
|
||||
@@ -5165,57 +5165,6 @@ bool IsStateFilterPassed(
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
// Find Specific Item Index inside a Collection ...
|
||||
template <typename T>
|
||||
int FindIndex(
|
||||
T &item, // Item to Find
|
||||
const T &items[] // Items for Search
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = -1;
|
||||
|
||||
//
|
||||
// Check Item Validation ...
|
||||
if (!item.IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int itemsCount = ArraySize(items);
|
||||
if (itemsCount <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < itemsCount; i++)
|
||||
{
|
||||
//
|
||||
T iItem = items[i];
|
||||
|
||||
//
|
||||
// Validate Item ...
|
||||
if (!iItem.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool isSame = item.IsSameAs(iItem);
|
||||
if (isSame && result <= -1)
|
||||
{
|
||||
//
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user