This commit is contained in:
2024-06-18 01:09:05 +03:30
parent d29102df54
commit 36b92c3492
3 changed files with 102 additions and 32 deletions
+46 -14
View File
@@ -1,6 +1,38 @@
{ {
"todo": [], "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": [ "testing": [
{ {
"assignedTo": { "assignedTo": {
@@ -24,19 +56,6 @@
"references": [], "references": [],
"title": "Complete Signalling COntrols ..." "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": { "assignedTo": {
"name": "Hadi Khazaee Asl" "name": "Hadi Khazaee Asl"
@@ -49,6 +68,19 @@
"id": "81", "id": "81",
"references": [], "references": [],
"title": "Fix Allow Supports ..." "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": [ "done": [
+53 -17
View File
@@ -3051,6 +3051,25 @@ public:
mTradeHandler.SetSave(value); mTradeHandler.SetSave(value);
} }
//
double ForceCloseProfit()
{
return mForceCloseProfit;
}
//
void ForceCloseProfit(double value)
{
//
if (value < 0)
{
value = 0;
}
//
mForceCloseProfit = value;
}
// //
// Overrides ... // Overrides ...
@@ -3888,6 +3907,9 @@ public:
// //
DoHedge(); DoHedge();
//
DoEQMForceClose();
// //
// Handle Close All Positions on Specific Time ... // Handle Close All Positions on Specific Time ...
DoEQMCloseOnSpecificTime(); DoEQMCloseOnSpecificTime();
@@ -4080,6 +4102,7 @@ private:
// Signals ... // Signals ...
bool mAllowLong; // Allow Long bool mAllowLong; // Allow Long
bool mAllowShort; // Allow Short bool mAllowShort; // Allow Short
double mForceCloseProfit; // Close All Positions Regardless of Policies when Profit Reached
int mReuiredSignalVerifications; // Required Verifications for Validate Signals int mReuiredSignalVerifications; // Required Verifications for Validate Signals
bool mGetVerificationFromOtherTimeFrames; // Get Verifications from Other Time Frames bool mGetVerificationFromOtherTimeFrames; // Get Verifications from Other Time Frames
@@ -4264,27 +4287,40 @@ private:
// EQM Functions ... // EQM Functions ...
// //
bool EnableTrailling() void DoEQMForceClose()
{ {
return mTradeHandler.EnableTrailling(); //
} bool canDo = mForceCloseProfit > 0;
if (!canDo)
{
return;
}
// //
bool EnableGrid() XPosition positions[];
{ int positionsCount = mTrader.GetPositions(positions);
return mTradeHandler.EnableGrid(); if (!IsValidSize(positionsCount))
} {
return;
}
// //
bool EnableRecovery() double profit = SpecifiedCalculatePositionsProfit(positions);
{ if (profit > 0 && profit > mForceCloseProfit)
return mTradeHandler.EnableRecovery(); {
} //
string comment = XEQMSupportToken + " Hedge ...";
int closed = Close(
positions,
comment //
);
// //
bool EnableProtection() if (IsValidSize(closed))
{ {
return EnableGrid() || EnableRecovery() || EnableTrailling() || AllowSupport(); //
}
}
} }
// //
+3 -1
View File
@@ -89,7 +89,7 @@ input double x121EAMaxAllowedGridVolume = 0.8; // Max Allowed Grid Signals Volum
// //
input group "Recovery"; 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 int x121EAMaxNumberOfRecoveries = 2; // Max Number of Recovery Signals
input double x121EARecoveryDistance = 100; // Recovery Distance input double x121EARecoveryDistance = 100; // Recovery Distance
input double x121EARecoveryVolumeMultiplier = 2; // Recovery Volume Multiplier input double x121EARecoveryVolumeMultiplier = 2; // Recovery Volume Multiplier
@@ -100,6 +100,7 @@ input group "Hedging";
input int x121EARestingAfterHedge = 1000; // Resting Seconds After Hedge input int x121EARestingAfterHedge = 1000; // Resting Seconds After Hedge
input double x121EAMinRequiredProfitPerTrade = 0.5; // Minimum Required Profit for Hedging input double x121EAMinRequiredProfitPerTrade = 0.5; // Minimum Required Profit for Hedging
input double x121EAMinRequiredProfitPerVolumeFactor = 0.01; // Minimum Required Profit for Hedging Per Volume 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 ... // Alert ...
@@ -268,6 +269,7 @@ bool InitialEA()
// //
// Hedging ... // Hedging ...
x121EA.ForceCloseProfit(x121EAForceCloseProfit);
x121EA.RestingAfterHedge(x121EARestingAfterHedge); x121EA.RestingAfterHedge(x121EARestingAfterHedge);
x121EA.MinRequiredProfitPerTrade(x121EAMinRequiredProfitPerTrade); x121EA.MinRequiredProfitPerTrade(x121EAMinRequiredProfitPerTrade);
x121EA.MinRequiredProfitPerVolumeFactor(x121EAMinRequiredProfitPerVolumeFactor); x121EA.MinRequiredProfitPerVolumeFactor(x121EAMinRequiredProfitPerVolumeFactor);