diff --git a/Classes/x-saherelm.x121.xea.class.mq5 b/Classes/x-saherelm.x121.xea.class.mq5 index 7e2df881..935678c1 100644 --- a/Classes/x-saherelm.x121.xea.class.mq5 +++ b/Classes/x-saherelm.x121.xea.class.mq5 @@ -257,11 +257,11 @@ public: // // Request for Support Signals using Guard ... bool RequestForSupport( - XSignal &support, // Holds Support Signal, if Provided - string provider, // Positions Provided by Specific Provider - string symbol, // Trading Symbol - ENUM_POSITION_TYPE type, // Trading Type - ENUM_TIMEFRAMES period // Specified Time Frame + XSignal &support, // Holds Support Signal, if Provided + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_X_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period // Specified Time Frame ) override { // diff --git a/Classes/x-saherelm.xea.class.mq5 b/Classes/x-saherelm.xea.class.mq5 index 1a448379..79ca38f0 100644 --- a/Classes/x-saherelm.xea.class.mq5 +++ b/Classes/x-saherelm.xea.class.mq5 @@ -1707,7 +1707,7 @@ public: string symbol = NULL, string provider = 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 provider = 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 provider = 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 provider = 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 provider = 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 provider = 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 ... // if it's Provided, Execute it ... virtual bool RequestForSupport( - XSignal &support, // Holds Support Signal, if Provided - string provider, // Positions Provided by Specific Provider - string symbol, // Trading Symbol - ENUM_POSITION_TYPE type, // Trading Type - ENUM_TIMEFRAMES period // Specified Time Frame + XSignal &support, // Holds Support Signal, if Provided + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_X_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period // Specified Time Frame ) { return false; @@ -3184,11 +3184,11 @@ protected: // // Close All Specified Provider's Positions in Profit Summary ... void HandleGuardHedgeAction( - string provider, // Positions Provided by Specific Provider - string symbol, // Trading Symbol - ENUM_POSITION_TYPE type, // Trading Type - ENUM_TIMEFRAMES period, // Specified Time Frame - double minProfitForHedging = 1, // Specified Profit for Hedge + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_X_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period, // Specified Time Frame + double minProfitForHedging = 1, // Specified Profit for Hedge double minProfitForHedgingVolumeFactor = 0.01 // Specified Volume Factor for Hedge ) { @@ -3245,7 +3245,7 @@ protected: void HandleGuardCloseInProfitAction( string provider, // Positions Provided by Specific Provider string symbol, // Trading Symbol - ENUM_POSITION_TYPE type, // Trading Type + ENUM_X_POSITION_TYPE type, // Trading Type ENUM_TIMEFRAMES period, // Specified Time Frame ENUM_X_POSITION_SELECT_METHODS method = NULL // Select Method ) @@ -3287,7 +3287,7 @@ protected: void HandleGuardCloseInDrawdownAction( string provider, // Positions Provided by Specific Provider string symbol, // Trading Symbol - ENUM_POSITION_TYPE type, // Trading Type + ENUM_X_POSITION_TYPE type, // Trading Type ENUM_TIMEFRAMES period, // Specified Time Frame ENUM_X_POSITION_SELECT_METHODS method = NULL // Select Method ) @@ -3327,11 +3327,11 @@ protected: // // Force Close Specified Set Of Position ... void HandleGuardForceCloseAction( - string provider, // Positions Provided by Specific Provider - string symbol, // Trading Symbol - ENUM_POSITION_TYPE type, // Trading Type - ENUM_TIMEFRAMES period, // Specified Time Frame - ulong ticket = 0 // Specific Ticket + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_X_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period, // Specified Time Frame + ulong ticket = 0 // Specific Ticket ) { // @@ -3404,11 +3404,11 @@ protected: // // Trailing Specified Set Of Positions Stop Losses ... void HandleGuardTrailingStopAction( - string provider, // Positions Provided by Specific Provider - string symbol, // Trading Symbol - ENUM_POSITION_TYPE type, // Trading Type - ENUM_TIMEFRAMES period, // Specified Time Frame - double sl // Desired SL Value ... + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_X_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period, // Specified Time Frame + double sl // Desired SL Value ... ) { // @@ -3482,10 +3482,10 @@ protected: // // Add Support Signal for Specified Positions ... void HandleGuardAddSupportPositionAction( - string provider, // Positions Provided by Specific Provider - string symbol, // Trading Symbol - ENUM_POSITION_TYPE type, // Trading Type - ENUM_TIMEFRAMES period // Specified Time Frame + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_X_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period // Specified Time Frame ) { // @@ -3535,10 +3535,10 @@ protected: // // Cancel all Placed Orders ... void HandleGuardCancelPendingOrdersAction( - string provider, // Positions Provided by Specific Provider - string symbol, // Trading Symbol - ENUM_POSITION_TYPE type, // Trading Type - ENUM_TIMEFRAMES period // Specified Time Frame + string provider, // Positions Provided by Specific Provider + string symbol, // Trading Symbol + ENUM_X_POSITION_TYPE type, // Trading Type + ENUM_TIMEFRAMES period // Specified Time Frame ) { // diff --git a/Classes/x-saherelm.xtrade.class.mq5 b/Classes/x-saherelm.xtrade.class.mq5 index 7fdf8c18..260140aa 100644 --- a/Classes/x-saherelm.xtrade.class.mq5 +++ b/Classes/x-saherelm.xtrade.class.mq5 @@ -2174,7 +2174,7 @@ public: string symbol = NULL, // Trading Symbol string provider = NULL, // Signal Provider 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 bool filterByMagic = true, // Get Only Self Open Positions bool forceClean = true // Clean Result Array @@ -2305,7 +2305,7 @@ public: string symbol = NULL, // Trading Symbol string provider = NULL, // Signal Provider 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 bool filterByMagic = true, // Get Only Self Open Positions bool forceClean = true // Clean Result Array diff --git a/Libraries/x-saherelm.xtrade.lib.mq5 b/Libraries/x-saherelm.xtrade.lib.mq5 index 38456ebd..5eb8f70b 100644 --- a/Libraries/x-saherelm.xtrade.lib.mq5 +++ b/Libraries/x-saherelm.xtrade.lib.mq5 @@ -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 ...