last works ...

This commit is contained in:
2025-10-27 05:02:51 +03:30
parent 8f317a3b1d
commit 31f1abb8d3
11 changed files with 5766 additions and 261 deletions
+188
View File
@@ -321,6 +321,194 @@ int GetAllBarPatters(ENUM_X_BAR_PATTERN &dest[])
//
// Structures ...
/**
* Model a Trend Line ...
**/
struct XTrend
{
//
string symbol;
datetime time;
ENUM_TIMEFRAMES period;
//
double fromValue;
datetime fromTime;
//
double toValue;
datetime toTime;
//
ENUM_X_DIRECTION dir;
//
// Constructor ...
XTrend()
{
Clean();
}
//
// Tools ...
/**
* Initialize ...
*
* @param _symbol: string, Specified Symbol ...
* @param _period: ENUM_TIMEFRAMES, Specified Period ...
* @param _time: datetime, Detection Time ...
* @param _fromValue: double, From Value ...
* @param _fromTime: datetime, From Time ...
* @param _toValue: double, To Value ...
* @param _toTime: datetime, To Time ...
*
* @return ( bool )
*/
bool Init(
string _symbol,
ENUM_TIMEFRAMES _period,
datetime _time,
double _fromValue,
datetime _fromTime,
double _toValue,
datetime _toTime //
)
{
//
bool result = false;
//
time = _time;
symbol = _symbol;
period = _period;
toTime = _toTime;
toValue = _toValue;
fromTime = _fromTime;
fromValue = _fromValue;
//
result = IsValid();
if (!result)
{
Clean();
}
//
// Setting Direction ...
if (result)
{
//
dir =
fromValue < toValue
? X_DIRECTION_BULLISH
: fromValue > toValue
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
return result;
}
/**
* Cleanup ...
*/
void Clean()
{
//
time = NULL;
toValue = 0;
fromValue = 0;
symbol = NULL;
period = NULL;
toTime = NULL;
fromTime = NULL;
dir = X_DIRECTION_NONE;
//
ZeroMemory(this);
}
/**
* Validate ...
*
* @return ( bool )
*/
bool IsValid()
{
//
bool result = false;
//
result =
IsXValid(time) &&
IsXValid(symbol) &&
IsXValid(period) &&
IsXValid(toTime) &&
IsXValid(fromTime) &&
NotEmptyZero(toValue) &&
NotEmptyZero(fromValue) &&
fromTime < toTime;
//
return result;
}
/**
* Check Trend Has Specific Direction ...
*
* @return ( bool )
*/
bool HasTrend()
{
return IsValid() &&
HasDirection(dir);
}
/**
* Check Trend is Bullish ...
*
* @return ( bool )
*/
bool IsBullish()
{
return HasTrend() &&
IsXBullish(dir);
}
/**
* Check Trend is Bearish ...
*
* @return ( bool )
*/
bool IsBearish()
{
return HasTrend() &&
IsXBearish(dir);
}
/**
* Get Unique Identifier ...
*
* @return ( string )
*/
string GetObjectID()
{
//
string result = NULL;
//
if (IsValid())
{
result = "XTRND_" + ToXString(dir) + "_" + ToXString(TimeToSeconds(time));
}
//
return result;
}
};
/**
* Represent a Pivot ...
**/