Complete Strategy 4 Signals ...

This commit is contained in:
2025-10-26 19:13:04 +03:30
parent de338d8916
commit 8f317a3b1d
4 changed files with 3071 additions and 63 deletions
+184 -8
View File
@@ -4654,6 +4654,57 @@ bool ToBox(
return result;
}
/**
* Converts Order Flow to Zone ...
*
* @param zone: XBoxZone, reference to holds result ...
* @param orderFlow: XBoxZone, collection reference to provides order flow ...
*
* @return ( bool )
*/
bool ToBox(
XBoxZone &zone,
XBoxZone &orderFlow[] //
)
{
//
bool result = false;
//
// Prepare ...
zone.Clean();
//
// Validate ...
result = HasChild(orderFlow);
if (!result)
{
return result;
}
//
zone = orderFlow[0];
int idx = GetHighest(orderFlow);
if (IsValidIndex(idx))
{
zone.upper = orderFlow[idx].upper;
}
idx = GetLowest(orderFlow);
if (IsValidIndex(idx))
{
zone.lower = orderFlow[idx].lower;
}
//
zone.type = "XOrderFlowP";
//
result = zone.IsValid();
//
return result;
}
/**
* Converts a Bar to OB Box ...
*
@@ -4993,7 +5044,10 @@ bool ToResistanceBox(
*
* @return ( int )
*/
int RemoveBreakedZones(XBoxZone &source[])
int RemoveBreakedZones(
XBoxZone &source[],
bool forceBreak = false //
)
{
//
int result = 0;
@@ -5014,22 +5068,37 @@ int RemoveBreakedZones(XBoxZone &source[])
tmps //
);
XClean(source);
XOHCL tmpBars[];
int breakerBars = 0;
while (HasChild(tmps))
{
//
iZone.Clean();
iZone = tmps[0];
ArrayRemove(tmps, 0, 1);
has = iZone.IsValid() &&
!IsXValid(iZone.breakAt);
has = IsXValid(iZone.breakAt);
if (has)
{
//
AddIfNotExists(
iZone,
source //
);
continue;
}
//
if (forceBreak)
{
//
breakerBars = GetBreakerBars(iZone, tmpBars);
has = IsValidSize(breakerBars);
}
if (has)
{
continue;
}
//
AddIfNotExists(
iZone,
source //
);
}
//
@@ -5904,6 +5973,113 @@ int GetTesterBars(
//
return result;
}
bool IsBreaked(
XBoxZone &zone,
ENUM_X_PRICE priceType = X_PRICE_CLOSE //
)
{
//
bool result = false;
//
// Validate ...
result = zone.IsValid() &&
IsXValid(priceType);
if (!result)
{
//
result = true;
return result;
}
//
XOHCL iBar;
double iPrice;
bool isBullish;
int start = zone.ToIndex();
int end = zone.FromIndex();
for (int i = start; i < end; i++)
{
//
// Initialize Indexed Bar ...
iBar.Clean();
result = iBar.Init(zone.symbol, zone.period, i);
if (!result)
{
//
result = true;
break;
}
//
isBullish = zone.IsBullish();
iPrice = iBar.GetPrice(priceType);
result = isBullish
? iPrice < zone.lower
: iPrice > zone.upper;
if (result)
{
break;
}
}
//
// Cleanup ...
iBar.Clean();
//
return result;
}
int RemoveBreakedZones(
XBoxZone &source[],
ENUM_X_PRICE priceType = X_PRICE_CLOSE //
)
{
//
int result = 0;
//
// Validate ...
if (!HasChild(source) || !IsXValid(priceType))
{
return result;
}
//
XBoxZone tmp[];
Copy(source, tmp);
XClean(source);
XBoxZone iTMP;
bool isBreaked = false;
while (HasChild(tmp))
{
//
iTMP.Clean();
iTMP = tmp[0];
ArrayRemove(tmp, 0, 1);
//
isBreaked = IsBreaked(iTMP, priceType);
if (!isBreaked)
{
//
AddIfNotExists(iTMP, source);
}
}
//
result = ArraySize(source);
//
// Cleanup ...
XClean(tmp);
iTMP.Clean();
//
return result;
}
//+------------------------------------------------------------------+
//