This commit is contained in:
2025-02-28 14:24:22 +03:30
parent a266ed533b
commit c3bc38befb
7 changed files with 2138 additions and 97 deletions
+181 -2
View File
@@ -1547,8 +1547,8 @@ bool ToBox(
box.symbol = item.symbol;
box.period = item.period;
box.type = IsBullish(item.dir)
? ToString(X_BULLISH_CONSOLIDATION_ZONE)
: ToString(X_BEARISH_CONSOLIDATION_ZONE);
? ToString(X_BULLISH_CONSOLIDATION_ZONE)
: ToString(X_BEARISH_CONSOLIDATION_ZONE);
//
result = box.IsValid();
@@ -2271,6 +2271,185 @@ int ExtractInsideZones(
return result;
}
/**
* Add Specific Item into a Collection Reference only if it's not Exists ...
*
* @return ( bool )
*/
template <typename T>
bool AddIfNotExists(
T *item,
T *&items[] //
)
{
//
bool result = false;
//
result = item != NULL;
if (!result)
{
return result;
}
//
int before = ArraySize(items);
//
int idx = FindIndex(
item,
items //
);
bool has = IsValidIndex(idx);
result = !has;
if (!result)
{
return result;
}
//
Add(
item,
items //
);
//
int after = ArraySize(items);
//
result = after > before;
//
return result;
}
bool AddIfNotExists(
XConsolidationZone &item,
XConsolidationZone &items[] //
)
{
//
bool result = false;
//
result = item.IsValid();
if (!result)
{
return result;
}
//
int before = ArraySize(items);
//
int idx = FindIndex(
item,
items //
);
bool has = IsValidIndex(idx);
result = !has;
if (!result)
{
return result;
}
//
AddRef(
item,
items //
);
//
int after = ArraySize(items);
//
result = after > before;
//
return result;
}
/**
* Add items Collection reference Members into source Collection only if it's not Exists ...alignas
* @return ( int )
*/
template <typename T>
int AddIfNotExists(
T *&items[],
T *&sources[] //
)
{
//
int result = 0;
//
bool has = HasChild(items);
if (!has)
{
return result;
}
//
int before = ArraySize(sources);
//
int count = ArraySize(items);
for (int i = 0; i < count; i++)
{
//
has = AddIfNotExists(
items[i],
sources //
);
}
//
int after = ArraySize(sources);
//
result = after > before;
//
return result;
}
int AddIfNotExists(
XConsolidationZone &items[],
XConsolidationZone &sources[] //
)
{
//
int result = 0;
//
bool has = HasChild(items);
if (!has)
{
return result;
}
//
int before = ArraySize(sources);
//
int count = ArraySize(items);
for (int i = 0; i < count; i++)
{
//
has = AddIfNotExists(
items[i],
sources //
);
}
//
int after = ArraySize(sources);
//
result = after > before;
//
return result;
}
//
template <typename T>
int FilterZones(