fix all ENUM_X_POSITION_TYPE refactoring Side Affects ...

This commit is contained in:
2024-06-05 10:28:52 +03:30
parent 46fda23346
commit 2214e13262
4 changed files with 101 additions and 55 deletions
+58 -12
View File
@@ -120,6 +120,32 @@ enum ENUM_X_POSITION_TYPE
X_POSITION_TYPE_SHORT = 3,
};
bool ToPositinType(
ENUM_POSITION_TYPE &dest,
ENUM_X_POSITION_TYPE source //
)
{
//
bool result = false;
//
result = source == X_POSITION_TYPE_LONG ||
source == X_POSITION_TYPE_SHORT;
if (!result)
{
return result;
}
//
dest =
source == X_POSITION_TYPE_LONG
? POSITION_TYPE_BUY
: POSITION_TYPE_SELL;
//
return result;
}
//
// Structs ...
@@ -496,12 +522,12 @@ struct XPosition
//
// Check Items Passed Specific Filters or not ...
bool IsFiltersPassed(
string mSymbol = NULL, // Trading Symbol
string mProvider = NULL, // Signal Provider
ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe
ENUM_POSITION_TYPE mType = NULL, // Long (Buy), Short (Sell)
ulong mMagic = NULL, // Magic Number
bool mFilterByMagic = true // Get Only Self Open Positions
string mSymbol = NULL, // Trading Symbol
string mProvider = NULL, // Signal Provider
ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe
ENUM_X_POSITION_TYPE mType = NULL, // Long (Buy), Short (Sell)
ulong mMagic = NULL, // Magic Number
bool mFilterByMagic = true // Get Only Self Open Positions
)
{
//
@@ -2549,7 +2575,7 @@ struct XGuard
string symbol; // Trading Symbol ...
string provider; // Signal Provider ...
ENUM_TIMEFRAMES period; // Trading Timeframe ...
ENUM_POSITION_TYPE type; // Position Type ...
ENUM_X_POSITION_TYPE type; // Position Type ...
ENUM_X_GUARD_ACTIONS action; // Which Action to Do ...
//
@@ -2569,11 +2595,11 @@ struct XGuard
//
// Global Initializer ...
bool Init(
string mSymbol, // Trading Symbol ...
ENUM_TIMEFRAMES mPeriod, // Trading Timeframe ...
ENUM_X_GUARD_ACTIONS mAction, // Which Action to Do ...
ENUM_POSITION_TYPE mType = NULL, // Position Type ...
string mProvider = NULL, // Signal Provider ...
string mSymbol, // Trading Symbol ...
ENUM_TIMEFRAMES mPeriod, // Trading Timeframe ...
ENUM_X_GUARD_ACTIONS mAction, // Which Action to Do ...
ENUM_X_POSITION_TYPE mType = NULL, // Position Type ...
string mProvider = NULL, // Signal Provider ...
double mDblPayLoad = NULL,
string mStrPayload = NULL //
)
@@ -3859,6 +3885,26 @@ ENUM_ORDER_TYPE ToOrderType(ENUM_POSITION_TYPE value)
//
return result;
}
ENUM_ORDER_TYPE ToOrderType(ENUM_X_POSITION_TYPE value)
{
//
ENUM_POSITION_TYPE mType =
value == X_POSITION_TYPE_SHORT
? POSITION_TYPE_SELL
: POSITION_TYPE_BUY;
//
bool isLong = IsLong(mType);
//
ENUM_ORDER_TYPE result =
isLong
? ORDER_TYPE_BUY
: ORDER_TYPE_SELL;
//
return result;
}
//
// Tagging ...