This commit is contained in:
2026-02-13 00:46:53 +03:30
parent 3ccaf9981d
commit 5abca35202
3 changed files with 268 additions and 48 deletions
@@ -6551,4 +6551,102 @@ int RemoveBreakedZones(
// #endregion
//+------------------------------------------------------------------+
// #region Bar Extensions ...
/**
* Check Specified Bar is Breaked or not ...
*
* @param bar: XOHCL, Specified Bar for Checking Proce ...
* @param breakerBar: XOHCL, Hold's Breaker Bar if Exists ...
* @param barIndex: int, Start Checking Bar till Bar's Index ...
* @param breakDir: ENUM_X_DIRECTION, Checking Direction Type, if Bullish Break Price must bigger, otherwise must lower ...
* @param barPriceType: ENUM_X_PRICE, Price type to Check Break ...
* @param breakPriceType: ENUM_X_PRICE, Price Type to Break Bar's Price ...
*
* @return ( bool )
*/
bool IsBarBreaked(
XOHCL &bar,
XOHCL &breakerBar,
int barIndex = 0,
ENUM_X_DIRECTION breakDir = X_DIRECTION_NONE,
ENUM_X_PRICE barPriceType = X_PRICE_CLOSE,
ENUM_X_PRICE breakPriceType = X_PRICE_CLOSE //
)
{
//
bool result = false;
//
// Normalize ...
breakerBar.Clean();
if (barIndex < 0)
{
barIndex = 0;
}
//
// Validate ...
result =
bar.IsValid() &&
HasDirection(breakDir) &&
IsXValid(barPriceType) &&
IsXValid(breakPriceType) &&
barIndex < bar.Index();
if (!result)
{
return result;
}
//
// Loop for Validating ...
XOHCL tmpBar;
bool has = false;
double tmpPrice = EMPTY_VALUE;
double barPrice = bar.GetPrice(barPriceType);
for (int i = barIndex; i < bar.Index(); i++)
{
//
has = tmpBar.Init(bar.symbol, bar.period, i);
if (!has)
{
continue;
}
//
tmpPrice = tmpBar.GetPrice(breakPriceType);
has = NotEmptyZero(tmpPrice);
if (!has)
{
//
tmpBar.Clean();
//
continue;
}
//
has =
IsXBullish(breakDir)
? tmpPrice > barPrice
: tmpPrice < barPrice;
if (has)
{
//
breakerBar = tmpBar;
tmpBar.Clean();
break;
}
//
tmpBar.Clean();
}
//
result = breakerBar.IsValid();
//
return result;
}
// #endregion
//