fix all ENUM_X_POSITION_TYPE refactoring Side Affects ...
This commit is contained in:
@@ -257,11 +257,11 @@ public:
|
|||||||
//
|
//
|
||||||
// Request for Support Signals using Guard ...
|
// Request for Support Signals using Guard ...
|
||||||
bool RequestForSupport(
|
bool RequestForSupport(
|
||||||
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
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -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 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2454,11 +2454,11 @@ public:
|
|||||||
// this Method Calls For Retrieve Support Signal ...
|
// this Method Calls For Retrieve Support Signal ...
|
||||||
// if it's Provided, Execute it ...
|
// if it's Provided, Execute it ...
|
||||||
virtual bool RequestForSupport(
|
virtual bool RequestForSupport(
|
||||||
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
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -3184,11 +3184,11 @@ protected:
|
|||||||
//
|
//
|
||||||
// Close All Specified Provider's Positions in Profit Summary ...
|
// Close All Specified Provider's Positions in Profit Summary ...
|
||||||
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
|
||||||
)
|
)
|
||||||
@@ -3327,11 +3327,11 @@ protected:
|
|||||||
//
|
//
|
||||||
// Force Close Specified Set Of Position ...
|
// Force Close Specified Set Of Position ...
|
||||||
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
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -3404,11 +3404,11 @@ protected:
|
|||||||
//
|
//
|
||||||
// Trailing Specified Set Of Positions Stop Losses ...
|
// Trailing Specified Set Of Positions Stop Losses ...
|
||||||
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 ...
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -3482,10 +3482,10 @@ protected:
|
|||||||
//
|
//
|
||||||
// Add Support Signal for Specified Positions ...
|
// Add Support Signal for Specified Positions ...
|
||||||
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
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -3535,10 +3535,10 @@ protected:
|
|||||||
//
|
//
|
||||||
// Cancel all Placed Orders ...
|
// Cancel all Placed Orders ...
|
||||||
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
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 ...
|
||||||
|
|
||||||
@@ -496,12 +522,12 @@ struct XPosition
|
|||||||
//
|
//
|
||||||
// Check Items Passed Specific Filters or not ...
|
// Check Items Passed Specific Filters or not ...
|
||||||
bool IsFiltersPassed(
|
bool IsFiltersPassed(
|
||||||
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 ...
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2569,11 +2595,11 @@ struct XGuard
|
|||||||
//
|
//
|
||||||
// Global Initializer ...
|
// Global Initializer ...
|
||||||
bool Init(
|
bool Init(
|
||||||
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 ...
|
||||||
|
|||||||
Reference in New Issue
Block a user