This commit is contained in:
2025-10-30 00:07:23 +03:30
parent 90988de7bf
commit 574c79afcc
6 changed files with 2209 additions and 961 deletions
@@ -2916,199 +2916,6 @@ struct XPatternAnalysisDrawConfig
}
};
/**
* an strucutre to Model Specified Leg Pattern ...
**/
struct XLeg
{
//
// Props ...
//
datetime time;
string symbol;
ENUM_X_DIRECTION dir;
ENUM_TIMEFRAMES period;
//
double upper;
double lower;
//
XOHCL bullishBars[];
XOHCL bearishBars[];
//
XBoxZone supports[];
XBoxZone resistances[];
//
XBoxZone bullishFVGs[];
XBoxZone bearishFVGs[];
//
XPatternAnalysis patterns[];
//
int sequentialBullishBars;
int sequentialBearishBars;
//
// Constructor ...
//
// Tools ...
/**
* Cleanup ...
*/
void Clean()
{
//
time = NULL;
symbol = NULL;
period = NULL;
dir = X_DIRECTION_NONE;
//
upper = 0;
lower = 0;
sequentialBullishBars = 0;
sequentialBearishBars = 0;
//
XClean(patterns);
XClean(supports);
XClean(bullishBars);
XClean(bearishBars);
XClean(resistances);
XClean(bullishFVGs);
XClean(bearishFVGs);
}
/**
* Validate ...
*
* @return ( bool )
*/
bool IsValid()
{
//
bool result = false;
//
result =
IsXValid(time) &&
IsXValid(symbol) &&
IsXValid(period) &&
HasDirection(dir) &&
NotEmptyZero(upper) &&
NotEmptyZero(lower) &&
upper > lower;
//
return result;
}
/**
* Check is Bullish ...
*
* @return ( bool )
*/
bool IsBullish()
{
return IsValid() &&
IsXBullish(dir);
}
/**
* Check is Bearish ...
*
* @return ( bool )
*/
bool IsBearish()
{
return IsValid() &&
IsXBearish(dir);
}
/**
* Converts a Leg to XBoxZone ...
*
* @param zone: XBoxZone, reference to holds Converted ...
*
* @return ( bool )
*/
bool ToBox(XBoxZone &zone)
{
//
bool result = false;
//
// Prepare ...
zone.Clean();
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
zone.at = time;
zone.dir = dir;
zone.from = time;
zone.upper = upper;
zone.lower = lower;
zone.symbol = symbol;
zone.period = period;
zone.to = TimeCurrent();
zone.type = ToXString(X_BAR_PATTERN_LEG);
//
result = zone.IsValid();
//
// Cleanup ...
if (!result)
{
zone.Clean();
}
//
return result;
}
/**
* Update Times of Collections ...
*
* @param value: datetime, Specified Time ...
*/
void UpdateTimes(datetime value = NULL)
{
//
// Normalize ...
value = NormalizeTime(value);
//
// Validate ...
if (!IsValid())
{
return;
}
//
UpdateToTime(supports, value);
UpdateToTime(resistances, value);
UpdateToTime(bullishFVGs, value);
UpdateToTime(bearishFVGs, value);
}
//
};
//
// Extensions ...