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
+63 -2
View File
@@ -1098,6 +1098,43 @@ struct XPosition
return result;
}
//
bool IsLong()
{
return IsValid() &&
IsXBullish(type);
}
//
bool IsBullish()
{
return IsLong();
}
//
bool IsShort()
{
return IsValid() &&
IsXBearish(type);
}
//
bool IsBearish()
{
return IsShort();
}
//
ENUM_X_DIRECTION GetDirection()
{
//
return IsBullish()
? X_DIRECTION_BULLISH
: IsBearish()
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
// Retrieve Entry Price ...
double GetEntry()
@@ -1317,7 +1354,7 @@ struct XPosition
//
double risk = GetRisk();
int r2r = (int)GetRiskRewardRatio();
bool isLong = IsLong(type);
bool isLong = IsLong();
for (int i = 0; i < r2r; i++)
{
//
@@ -1350,7 +1387,7 @@ struct XPosition
reachedLevel = -1;
reachedPrice = 0;
double tps[];
bool isLong = IsLong(type);
bool isLong = IsLong();
double exitPrice = GetExit();
int tpLevels = CalculateTPLevels(tps);
if (!IsValidSize(tpLevels) || exitPrice <= 0)
@@ -3868,6 +3905,30 @@ bool IsValid(ENUM_X_ORDER_MODES value)
return value != X_ORDER_MODE_NOTHING;
}
//
bool IsXBullish(ENUM_POSITION_TYPE type)
{
return type == POSITION_TYPE_BUY;
}
//
bool IsXBullish(ENUM_X_POSITION_TYPES type)
{
return type == X_POSITION_TYPE_LONG;
}
//
bool IsXBearish(ENUM_POSITION_TYPE type)
{
return type == POSITION_TYPE_SELL;
}
//
bool IsXBearish(ENUM_X_POSITION_TYPES type)
{
return type == X_POSITION_TYPE_SHORT;
}
//
// Ages ...