This commit is contained in:
2025-09-20 18:02:13 +03:30
parent becac9983d
commit 73a97a80b3
5 changed files with 1922 additions and 15 deletions
+195
View File
@@ -411,4 +411,199 @@ struct XZigZagPoint
}
};
/**
* Specified ZigZag based Market Analysis ...
**/
struct XZigZagAnalysis
{
//
// Props ...
string symbol; // Symbol ...
datetime time; // Time ...
ENUM_TIMEFRAMES period; // Period ...
XZigZagPoint pivots[]; // ZigZag Pivots ...
//
ENUM_X_DIRECTION dir; // Direction ...
//
// Constructor ...
XZigZagAnalysis()
{
Clean();
}
//
// Tools ...
/**
* Cleanup Model ...
*/
void Clean()
{
//
time = NULL;
symbol = NULL;
period = NULL;
dir = X_DIRECTION_NONE;
SpecifiedClean(pivots);
//
ZeroMemory(this);
}
/**
* Validate Model ...
*
* @return ( bool )
*/
bool IsValid()
{
//
bool result = false;
//
result =
HasChild(pivots) &&
HasDirection(dir) &&
IsSpecifiedValid(time) &&
IsSpecifiedValid(symbol) &&
IsSpecifiedValid(period);
//
return result;
}
/**
* Calculate Analysis Age, based on Specified Time Frame ...
*
* @param forPeriod: ENUM_TIMEFRAMES, Specified Period ...
*
* @return ( int )
*/
int GetAge(
ENUM_TIMEFRAMES forPeriod = NULL //
)
{
//
int result = -1;
//
// Validate ...
if (!IsValid())
{
return result;
}
//
// Normalize ...
if (!IsSpecifiedValid(forPeriod))
{
forPeriod = period;
}
//
result = GetBarIndex(
symbol,
forPeriod,
time //
);
//
return result;
}
/**
* Check two item is Same or not ...
*
* @param item: XZigZagAnalysis, dest model for Checking ...
*
* @return ( bool )
*/
bool IsSameAs(XZigZagAnalysis &item)
{
//
bool result = false;
//
result =
IsValid() &&
item.IsValid() &&
time == item.time &&
IsSameMarketAs(item);
//
return result;
}
/**
* Check to model Has Same Symbol ...
*
* @param item: XZigZagAnalysis, dest model for Checking ...
*
* @return ( bool )
*/
bool IsSameSymbolAs(XZigZagAnalysis &item)
{
//
bool result = false;
//
result =
IsValid() &&
item.IsValid() &&
symbol == item.symbol;
//
return result;
}
/**
* Check to model Has Same Period ...
*
* @param item: XZigZagAnalysis, dest model for Checking ...
*
* @return ( bool )
*/
bool IsSamePeriodAs(XZigZagAnalysis &item)
{
//
bool result = false;
//
result =
IsValid() &&
item.IsValid() &&
period == item.period;
//
return result;
}
/**
* Check to model Has Same Symbol/Period ...
*
* @param item: XZigZagAnalysis, dest model for Checking ...
*
* @return ( bool )
*/
bool IsSameMarketAs(XZigZagAnalysis &item)
{
//
bool result = false;
//
result =
IsValid() &&
item.IsValid() &&
IsSameSymbolAs(item) &&
IsSamePeriodAs(item);
//
return result;
}
//
};
//