diff --git a/.vscode/vscode-kanban.json b/.vscode/vscode-kanban.json index 8a6ddf84..9abfb83d 100644 --- a/.vscode/vscode-kanban.json +++ b/.vscode/vscode-kanban.json @@ -1,6 +1,38 @@ { "todo": [], - "in-progress": [], + "in-progress": [ + { + "assignedTo": { + "name": "Hadi Khazaee Asl" + }, + "creation_time": "2024-06-17T19:53:39.860Z", + "description": { + "content": "- use it for supportings", + "mime": "text/markdown" + }, + "id": "82", + "references": [], + "title": "add trend line class and test it" + }, + { + "assignedTo": { + "name": "Hadi Khazaee Asl" + }, + "creation_time": "2024-06-17T19:53:56.463Z", + "id": "83", + "references": [], + "title": "run a multi currency test" + }, + { + "assignedTo": { + "name": "Hadi Khazaee Asl" + }, + "creation_time": "2024-06-17T19:54:13.659Z", + "id": "84", + "references": [], + "title": "try to implement machine learning and neural network" + } + ], "testing": [ { "assignedTo": { @@ -24,19 +56,6 @@ "references": [], "title": "Complete Signalling COntrols ..." }, - { - "assignedTo": { - "name": "Hadi Khazaee Asl" - }, - "creation_time": "2024-06-16T23:58:59.163Z", - "description": { - "content": "Fix Open Signals When Support Signals only Open\nMax Allowed Trades Handler ...", - "mime": "text/markdown" - }, - "id": "79", - "references": [], - "title": "Fix Max Allowed Trade on Only SUpport Signals" - }, { "assignedTo": { "name": "Hadi Khazaee Asl" @@ -49,6 +68,19 @@ "id": "81", "references": [], "title": "Fix Allow Supports ..." + }, + { + "assignedTo": { + "name": "Hadi Khazaee Asl" + }, + "creation_time": "2024-06-16T23:58:59.163Z", + "description": { + "content": "Fix Open Signals When Support Signals only Open\nMax Allowed Trades Handler ...", + "mime": "text/markdown" + }, + "id": "79", + "references": [], + "title": "Fix Max Allowed Trade on Only SUpport Signals" } ], "done": [ diff --git a/Classes/x-saherelm.x121.setup.xea.mq5 b/Classes/x-saherelm.x121.setup.xea.mq5 index 838a68e6..78c0fc05 100644 --- a/Classes/x-saherelm.x121.setup.xea.mq5 +++ b/Classes/x-saherelm.x121.setup.xea.mq5 @@ -3051,6 +3051,25 @@ public: mTradeHandler.SetSave(value); } + // + double ForceCloseProfit() + { + return mForceCloseProfit; + } + + // + void ForceCloseProfit(double value) + { + // + if (value < 0) + { + value = 0; + } + + // + mForceCloseProfit = value; + } + // // Overrides ... @@ -3888,6 +3907,9 @@ public: // DoHedge(); + // + DoEQMForceClose(); + // // Handle Close All Positions on Specific Time ... DoEQMCloseOnSpecificTime(); @@ -4080,6 +4102,7 @@ private: // Signals ... bool mAllowLong; // Allow Long bool mAllowShort; // Allow Short + double mForceCloseProfit; // Close All Positions Regardless of Policies when Profit Reached int mReuiredSignalVerifications; // Required Verifications for Validate Signals bool mGetVerificationFromOtherTimeFrames; // Get Verifications from Other Time Frames @@ -4264,27 +4287,40 @@ private: // EQM Functions ... // - bool EnableTrailling() + void DoEQMForceClose() { - return mTradeHandler.EnableTrailling(); - } + // + bool canDo = mForceCloseProfit > 0; + if (!canDo) + { + return; + } - // - bool EnableGrid() - { - return mTradeHandler.EnableGrid(); - } + // + XPosition positions[]; + int positionsCount = mTrader.GetPositions(positions); + if (!IsValidSize(positionsCount)) + { + return; + } - // - bool EnableRecovery() - { - return mTradeHandler.EnableRecovery(); - } + // + double profit = SpecifiedCalculatePositionsProfit(positions); + if (profit > 0 && profit > mForceCloseProfit) + { + // + string comment = XEQMSupportToken + " Hedge ..."; + int closed = Close( + positions, + comment // + ); - // - bool EnableProtection() - { - return EnableGrid() || EnableRecovery() || EnableTrailling() || AllowSupport(); + // + if (IsValidSize(closed)) + { + // + } + } } // diff --git a/Experts/x-saherelm.x121.ea.mq5 b/Experts/x-saherelm.x121.ea.mq5 index c296a88a..5adb7ec1 100644 --- a/Experts/x-saherelm.x121.ea.mq5 +++ b/Experts/x-saherelm.x121.ea.mq5 @@ -89,7 +89,7 @@ input double x121EAMaxAllowedGridVolume = 0.8; // Max Allowed Grid Signals Volum // input group "Recovery"; -input bool x121EAAllowRecovery = true; // Allow Recovery Signals +input bool x121EAAllowRecovery = true; // Allow Recovery Signals input int x121EAMaxNumberOfRecoveries = 2; // Max Number of Recovery Signals input double x121EARecoveryDistance = 100; // Recovery Distance input double x121EARecoveryVolumeMultiplier = 2; // Recovery Volume Multiplier @@ -100,6 +100,7 @@ input group "Hedging"; input int x121EARestingAfterHedge = 1000; // Resting Seconds After Hedge input double x121EAMinRequiredProfitPerTrade = 0.5; // Minimum Required Profit for Hedging input double x121EAMinRequiredProfitPerVolumeFactor = 0.01; // Minimum Required Profit for Hedging Per Volume +input double x121EAForceCloseProfit = 40; // Close All Positions Regardless of Policies when Profit Reached // // Alert ... @@ -268,6 +269,7 @@ bool InitialEA() // // Hedging ... + x121EA.ForceCloseProfit(x121EAForceCloseProfit); x121EA.RestingAfterHedge(x121EARestingAfterHedge); x121EA.MinRequiredProfitPerTrade(x121EAMinRequiredProfitPerTrade); x121EA.MinRequiredProfitPerVolumeFactor(x121EAMinRequiredProfitPerVolumeFactor);