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
+1 -1
View File
@@ -260,7 +260,7 @@ public:
XSignal &support, // Holds Support Signal, if Provided XSignal &support, // Holds Support Signal, if Provided
string provider, // Positions Provided by Specific Provider string provider, // Positions Provided by Specific Provider
string symbol, // Trading Symbol string symbol, // Trading Symbol
ENUM_POSITION_TYPE type, // Trading Type ENUM_X_POSITION_TYPE type, // Trading Type
ENUM_TIMEFRAMES period // Specified Time Frame ENUM_TIMEFRAMES period // Specified Time Frame
) override ) override
{ {
+14 -14
View File
@@ -1707,7 +1707,7 @@ public:
string symbol = NULL, string symbol = NULL,
string provider = NULL, string provider = NULL,
ENUM_TIMEFRAMES period = NULL, ENUM_TIMEFRAMES period = NULL,
ENUM_POSITION_TYPE type = NULL // ENUM_X_POSITION_TYPE type = NULL //
) )
{ {
// //
@@ -1777,7 +1777,7 @@ public:
string symbol = NULL, string symbol = NULL,
string provider = NULL, string provider = NULL,
ENUM_TIMEFRAMES period = NULL, ENUM_TIMEFRAMES period = NULL,
ENUM_POSITION_TYPE type = NULL // ENUM_X_POSITION_TYPE type = NULL //
) )
{ {
// //
@@ -1847,7 +1847,7 @@ public:
string symbol = NULL, string symbol = NULL,
string provider = NULL, string provider = NULL,
ENUM_TIMEFRAMES period = NULL, ENUM_TIMEFRAMES period = NULL,
ENUM_POSITION_TYPE type = NULL // ENUM_X_POSITION_TYPE type = NULL //
) )
{ {
// //
@@ -1917,7 +1917,7 @@ public:
string symbol = NULL, string symbol = NULL,
string provider = NULL, string provider = NULL,
ENUM_TIMEFRAMES period = NULL, ENUM_TIMEFRAMES period = NULL,
ENUM_POSITION_TYPE type = NULL // ENUM_X_POSITION_TYPE type = NULL //
) )
{ {
// //
@@ -1987,7 +1987,7 @@ public:
string symbol = NULL, string symbol = NULL,
string provider = NULL, string provider = NULL,
ENUM_TIMEFRAMES period = NULL, ENUM_TIMEFRAMES period = NULL,
ENUM_POSITION_TYPE type = NULL // ENUM_X_POSITION_TYPE type = NULL //
) )
{ {
// //
@@ -2057,7 +2057,7 @@ public:
string symbol = NULL, string symbol = NULL,
string provider = NULL, string provider = NULL,
ENUM_TIMEFRAMES period = NULL, ENUM_TIMEFRAMES period = NULL,
ENUM_POSITION_TYPE type = NULL // ENUM_X_POSITION_TYPE type = NULL //
) )
{ {
// //
@@ -2457,7 +2457,7 @@ public:
XSignal &support, // Holds Support Signal, if Provided XSignal &support, // Holds Support Signal, if Provided
string provider, // Positions Provided by Specific Provider string provider, // Positions Provided by Specific Provider
string symbol, // Trading Symbol string symbol, // Trading Symbol
ENUM_POSITION_TYPE type, // Trading Type ENUM_X_POSITION_TYPE type, // Trading Type
ENUM_TIMEFRAMES period // Specified Time Frame ENUM_TIMEFRAMES period // Specified Time Frame
) )
{ {
@@ -3186,7 +3186,7 @@ protected:
void HandleGuardHedgeAction( void HandleGuardHedgeAction(
string provider, // Positions Provided by Specific Provider string provider, // Positions Provided by Specific Provider
string symbol, // Trading Symbol string symbol, // Trading Symbol
ENUM_POSITION_TYPE type, // Trading Type ENUM_X_POSITION_TYPE type, // Trading Type
ENUM_TIMEFRAMES period, // Specified Time Frame ENUM_TIMEFRAMES period, // Specified Time Frame
double minProfitForHedging = 1, // Specified Profit for Hedge double minProfitForHedging = 1, // Specified Profit for Hedge
double minProfitForHedgingVolumeFactor = 0.01 // Specified Volume Factor for Hedge double minProfitForHedgingVolumeFactor = 0.01 // Specified Volume Factor for Hedge
@@ -3245,7 +3245,7 @@ protected:
void HandleGuardCloseInProfitAction( void HandleGuardCloseInProfitAction(
string provider, // Positions Provided by Specific Provider string provider, // Positions Provided by Specific Provider
string symbol, // Trading Symbol string symbol, // Trading Symbol
ENUM_POSITION_TYPE type, // Trading Type ENUM_X_POSITION_TYPE type, // Trading Type
ENUM_TIMEFRAMES period, // Specified Time Frame ENUM_TIMEFRAMES period, // Specified Time Frame
ENUM_X_POSITION_SELECT_METHODS method = NULL // Select Method ENUM_X_POSITION_SELECT_METHODS method = NULL // Select Method
) )
@@ -3287,7 +3287,7 @@ protected:
void HandleGuardCloseInDrawdownAction( void HandleGuardCloseInDrawdownAction(
string provider, // Positions Provided by Specific Provider string provider, // Positions Provided by Specific Provider
string symbol, // Trading Symbol string symbol, // Trading Symbol
ENUM_POSITION_TYPE type, // Trading Type ENUM_X_POSITION_TYPE type, // Trading Type
ENUM_TIMEFRAMES period, // Specified Time Frame ENUM_TIMEFRAMES period, // Specified Time Frame
ENUM_X_POSITION_SELECT_METHODS method = NULL // Select Method ENUM_X_POSITION_SELECT_METHODS method = NULL // Select Method
) )
@@ -3329,7 +3329,7 @@ protected:
void HandleGuardForceCloseAction( void HandleGuardForceCloseAction(
string provider, // Positions Provided by Specific Provider string provider, // Positions Provided by Specific Provider
string symbol, // Trading Symbol string symbol, // Trading Symbol
ENUM_POSITION_TYPE type, // Trading Type ENUM_X_POSITION_TYPE type, // Trading Type
ENUM_TIMEFRAMES period, // Specified Time Frame ENUM_TIMEFRAMES period, // Specified Time Frame
ulong ticket = 0 // Specific Ticket ulong ticket = 0 // Specific Ticket
) )
@@ -3406,7 +3406,7 @@ protected:
void HandleGuardTrailingStopAction( void HandleGuardTrailingStopAction(
string provider, // Positions Provided by Specific Provider string provider, // Positions Provided by Specific Provider
string symbol, // Trading Symbol string symbol, // Trading Symbol
ENUM_POSITION_TYPE type, // Trading Type ENUM_X_POSITION_TYPE type, // Trading Type
ENUM_TIMEFRAMES period, // Specified Time Frame ENUM_TIMEFRAMES period, // Specified Time Frame
double sl // Desired SL Value ... double sl // Desired SL Value ...
) )
@@ -3484,7 +3484,7 @@ protected:
void HandleGuardAddSupportPositionAction( void HandleGuardAddSupportPositionAction(
string provider, // Positions Provided by Specific Provider string provider, // Positions Provided by Specific Provider
string symbol, // Trading Symbol string symbol, // Trading Symbol
ENUM_POSITION_TYPE type, // Trading Type ENUM_X_POSITION_TYPE type, // Trading Type
ENUM_TIMEFRAMES period // Specified Time Frame ENUM_TIMEFRAMES period // Specified Time Frame
) )
{ {
@@ -3537,7 +3537,7 @@ protected:
void HandleGuardCancelPendingOrdersAction( void HandleGuardCancelPendingOrdersAction(
string provider, // Positions Provided by Specific Provider string provider, // Positions Provided by Specific Provider
string symbol, // Trading Symbol string symbol, // Trading Symbol
ENUM_POSITION_TYPE type, // Trading Type ENUM_X_POSITION_TYPE type, // Trading Type
ENUM_TIMEFRAMES period // Specified Time Frame ENUM_TIMEFRAMES period // Specified Time Frame
) )
{ {
+2 -2
View File
@@ -2174,7 +2174,7 @@ public:
string symbol = NULL, // Trading Symbol string symbol = NULL, // Trading Symbol
string provider = NULL, // Signal Provider string provider = NULL, // Signal Provider
ENUM_TIMEFRAMES period = NULL, // Trading Period ENUM_TIMEFRAMES period = NULL, // Trading Period
ENUM_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell) ENUM_X_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell)
ENUM_X_POSITION_SELECT_METHODS method = NULL, // Selection Method ENUM_X_POSITION_SELECT_METHODS method = NULL, // Selection Method
bool filterByMagic = true, // Get Only Self Open Positions bool filterByMagic = true, // Get Only Self Open Positions
bool forceClean = true // Clean Result Array bool forceClean = true // Clean Result Array
@@ -2305,7 +2305,7 @@ public:
string symbol = NULL, // Trading Symbol string symbol = NULL, // Trading Symbol
string provider = NULL, // Signal Provider string provider = NULL, // Signal Provider
ENUM_TIMEFRAMES period = NULL, // Trading Period ENUM_TIMEFRAMES period = NULL, // Trading Period
ENUM_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell) ENUM_X_POSITION_TYPE type = NULL, // Long (Buy) or Short (Sell)
ENUM_X_POSITION_SELECT_METHODS method = NULL, // Selection Method ENUM_X_POSITION_SELECT_METHODS method = NULL, // Selection Method
bool filterByMagic = true, // Get Only Self Open Positions bool filterByMagic = true, // Get Only Self Open Positions
bool forceClean = true // Clean Result Array bool forceClean = true // Clean Result Array
+49 -3
View File
@@ -120,6 +120,32 @@ enum ENUM_X_POSITION_TYPE
X_POSITION_TYPE_SHORT = 3, 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 ... // Structs ...
@@ -499,7 +525,7 @@ struct XPosition
string mSymbol = NULL, // Trading Symbol string mSymbol = NULL, // Trading Symbol
string mProvider = NULL, // Signal Provider string mProvider = NULL, // Signal Provider
ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe
ENUM_POSITION_TYPE mType = NULL, // Long (Buy), Short (Sell) ENUM_X_POSITION_TYPE mType = NULL, // Long (Buy), Short (Sell)
ulong mMagic = NULL, // Magic Number ulong mMagic = NULL, // Magic Number
bool mFilterByMagic = true // Get Only Self Open Positions bool mFilterByMagic = true // Get Only Self Open Positions
) )
@@ -2549,7 +2575,7 @@ struct XGuard
string symbol; // Trading Symbol ... string symbol; // Trading Symbol ...
string provider; // Signal Provider ... string provider; // Signal Provider ...
ENUM_TIMEFRAMES period; // Trading Timeframe ... 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 ... ENUM_X_GUARD_ACTIONS action; // Which Action to Do ...
// //
@@ -2572,7 +2598,7 @@ struct XGuard
string mSymbol, // Trading Symbol ... string mSymbol, // Trading Symbol ...
ENUM_TIMEFRAMES mPeriod, // Trading Timeframe ... ENUM_TIMEFRAMES mPeriod, // Trading Timeframe ...
ENUM_X_GUARD_ACTIONS mAction, // Which Action to Do ... ENUM_X_GUARD_ACTIONS mAction, // Which Action to Do ...
ENUM_POSITION_TYPE mType = NULL, // Position Type ... ENUM_X_POSITION_TYPE mType = NULL, // Position Type ...
string mProvider = NULL, // Signal Provider ... string mProvider = NULL, // Signal Provider ...
double mDblPayLoad = NULL, double mDblPayLoad = NULL,
string mStrPayload = NULL // string mStrPayload = NULL //
@@ -3859,6 +3885,26 @@ ENUM_ORDER_TYPE ToOrderType(ENUM_POSITION_TYPE value)
// //
return result; 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 ... // Tagging ...