last ...
This commit is contained in:
Vendored
+13
-13
@@ -13,19 +13,6 @@
|
|||||||
"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"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"testing": [
|
"testing": [
|
||||||
@@ -50,6 +37,19 @@
|
|||||||
"id": "80",
|
"id": "80",
|
||||||
"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"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"done": [
|
"done": [
|
||||||
|
|||||||
@@ -431,13 +431,16 @@ struct XTradeInfo
|
|||||||
// Grid System Calculations ...
|
// Grid System Calculations ...
|
||||||
|
|
||||||
//
|
//
|
||||||
|
int gLevel; // Number of Grids
|
||||||
double gEntry; // Represents Next Grid Signal's Entry
|
double gEntry; // Represents Next Grid Signal's Entry
|
||||||
double gVolume; // Represent Next Grid Signal's Volume
|
double gVolume; // Represent Next Grid Signal's Volume
|
||||||
|
|
||||||
//
|
//
|
||||||
void ResetGrid()
|
void ResetGrid()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
gEntry = 0;
|
gEntry = 0;
|
||||||
|
gLevel = 0;
|
||||||
gVolume = 0;
|
gVolume = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,6 +579,9 @@ struct XTradeInfo
|
|||||||
distance,
|
distance,
|
||||||
volumeMultiplier //
|
volumeMultiplier //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
gLevel++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -592,11 +598,13 @@ struct XTradeInfo
|
|||||||
double rVolume; // Represent Next Recovery Signal's Volume
|
double rVolume; // Represent Next Recovery Signal's Volume
|
||||||
double rZoneUpper; // Zone Recovery Upper Bound
|
double rZoneUpper; // Zone Recovery Upper Bound
|
||||||
double rZoneLower; // Zone Recovery Lower Bound
|
double rZoneLower; // Zone Recovery Lower Bound
|
||||||
|
int rLevel; // Number of Recoveries
|
||||||
|
|
||||||
//
|
//
|
||||||
void ResetRecovery()
|
void ResetRecovery()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
rLevel = 0;
|
||||||
rVolume = 0;
|
rVolume = 0;
|
||||||
rLongEntry = 0;
|
rLongEntry = 0;
|
||||||
rZoneUpper = 0;
|
rZoneUpper = 0;
|
||||||
@@ -819,6 +827,9 @@ struct XTradeInfo
|
|||||||
volumeMultiplier,
|
volumeMultiplier,
|
||||||
rType //
|
rType //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
rLevel++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1258,6 +1269,8 @@ public:
|
|||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
AllowSupport() &&
|
AllowSupport() &&
|
||||||
|
SupportDistance() > 0 &&
|
||||||
|
MaxNumberOfSupports() >= 0 &&
|
||||||
SupportVolumeMultiplier() > 0
|
SupportVolumeMultiplier() > 0
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -1369,6 +1382,7 @@ public:
|
|||||||
//
|
//
|
||||||
AllowGrid() &&
|
AllowGrid() &&
|
||||||
GridDistance() > 0 &&
|
GridDistance() > 0 &&
|
||||||
|
MaxNumberOfGrids() >= 0 &&
|
||||||
GridVolumeMultiplier() > 0
|
GridVolumeMultiplier() > 0
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -1480,6 +1494,7 @@ public:
|
|||||||
//
|
//
|
||||||
AllowRecovery() &&
|
AllowRecovery() &&
|
||||||
RecoveryDistance() > 0 &&
|
RecoveryDistance() > 0 &&
|
||||||
|
MaxNumberOfRecoveries() >= 0 &&
|
||||||
RecoveryVolumeMultiplier() > 0
|
RecoveryVolumeMultiplier() > 0
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -1823,7 +1838,8 @@ public:
|
|||||||
//
|
//
|
||||||
// Handle Do All Protecting ...
|
// Handle Do All Protecting ...
|
||||||
int DoProtect(
|
int DoProtect(
|
||||||
XSignal &signals[] // if PRotecting Generate Some Support Signals, Holds them here
|
XSignal &signals[], // if PRotecting Generate Some Support Signals, Holds them here
|
||||||
|
XSCX121SetupCycles *&setups[] // Number of Setups
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1832,6 +1848,73 @@ public:
|
|||||||
//
|
//
|
||||||
// Calling Protection Algorithms ...
|
// Calling Protection Algorithms ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trailling ...
|
||||||
|
if (EnableTrailling())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int traillings = HandleTrailling();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supporting ...
|
||||||
|
if (EnableSupport())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSignal supports[];
|
||||||
|
int supportsCount = RequestForSupport(
|
||||||
|
supports,
|
||||||
|
setups //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (IsValidSize(supportsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
supports,
|
||||||
|
signals,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Grid ...
|
||||||
|
if (EnableGrid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSignal grids[];
|
||||||
|
int gridsCount = RequestForGrid(grids);
|
||||||
|
if (IsValidSize(gridsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
grids,
|
||||||
|
signals,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Recovery ...
|
||||||
|
if (EnableRecovery())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSignal recoveries[];
|
||||||
|
int recoveriesCount = RequestForRecovery(recoveries);
|
||||||
|
if (IsValidSize(recoveriesCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
recoveries,
|
||||||
|
signals,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = ArraySize(signals);
|
result = ArraySize(signals);
|
||||||
|
|
||||||
@@ -2056,9 +2139,7 @@ protected:
|
|||||||
//
|
//
|
||||||
int RequestForSupport(
|
int RequestForSupport(
|
||||||
XSignal &signals[],
|
XSignal &signals[],
|
||||||
XSCX121SetupCycles *&setups[], // Number of Setups
|
XSCX121SetupCycles *&setups[] //
|
||||||
double supportDistance = 50,
|
|
||||||
double volumeMultiplier = 2 //
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2102,6 +2183,12 @@ protected:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double supportDistance = SupportDistance();
|
||||||
|
int maxNUmberOfSupports = MaxNumberOfSupports();
|
||||||
|
double maxAllowedVolume = MaxAllowedSupportVolume();
|
||||||
|
double volumeMultiplier = SupportVolumeMultiplier();
|
||||||
|
|
||||||
//
|
//
|
||||||
X121SignalGenerator signalGenerator;
|
X121SignalGenerator signalGenerator;
|
||||||
|
|
||||||
@@ -2164,77 +2251,8 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now We Have all required Data to Decide What Supports for
|
// Check Support COunts and etc ...
|
||||||
// Specified In DrawDown Position ...
|
// implementing supporting mechanis ...
|
||||||
|
|
||||||
//
|
|
||||||
XSignal tmpSignal;
|
|
||||||
tmpSignal.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
double longEntry = GetEntry(
|
|
||||||
iPosition.symbol,
|
|
||||||
POSITION_TYPE_BUY //
|
|
||||||
);
|
|
||||||
double shortEntry = GetEntry(
|
|
||||||
iPosition.symbol,
|
|
||||||
POSITION_TYPE_SELL //
|
|
||||||
);
|
|
||||||
double mVolume = iPosition.volume * 2;
|
|
||||||
double mSL = 0;
|
|
||||||
double mTP = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isLong = IsLong(iPosition.type);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Here we Can Start a Recovery Zone ...
|
|
||||||
if (data[index].rLongEntry <= 0 &&
|
|
||||||
data[index].rShortEntry <= 0 &&
|
|
||||||
data[index].rVolume <= 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
data[index].PrepareNextRecovery(
|
|
||||||
supportDistance,
|
|
||||||
volumeMultiplier,
|
|
||||||
iPosition.type //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool hasRecovery = data[index].HasRecovery(
|
|
||||||
tmpSignal,
|
|
||||||
supportDistance,
|
|
||||||
volumeMultiplier //
|
|
||||||
);
|
|
||||||
if (hasRecovery)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// tmpSignal.sl = 0;
|
|
||||||
// tmpSignal.tp = 0;
|
|
||||||
string comment = GenerateEQMSupportTag(iPosition.ticket);
|
|
||||||
tmpSignal.comment = comment;
|
|
||||||
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
tmpSignal,
|
|
||||||
signals //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (priceDiffPoints >= supportDistance)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Reset
|
|
||||||
if (longEntry > data[index].rZoneUpper || shortEntry < data[index].rZoneLower)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// data[index].ResetRecovery();
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -2261,6 +2279,10 @@ protected:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int maxAllowed = MaxNumberOfGrids();
|
||||||
|
double maxAllowedVolume = MaxAllowedGridVolume();
|
||||||
|
|
||||||
//
|
//
|
||||||
int count = Count();
|
int count = Count();
|
||||||
if (!IsValidSize(count))
|
if (!IsValidSize(count))
|
||||||
@@ -2271,6 +2293,17 @@ protected:
|
|||||||
//
|
//
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Check Count ...
|
||||||
|
bool isMaxPassed =
|
||||||
|
maxAllowed <= 0
|
||||||
|
? true
|
||||||
|
: data[i].gLevel < maxAllowed;
|
||||||
|
if (!isMaxPassed)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
XSignal iSignal;
|
XSignal iSignal;
|
||||||
bool hasGrid = data[i].HasGrid(
|
bool hasGrid = data[i].HasGrid(
|
||||||
@@ -2282,6 +2315,13 @@ protected:
|
|||||||
//
|
//
|
||||||
if (hasGrid)
|
if (hasGrid)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Check Max Volume ...
|
||||||
|
iSignal.volume =
|
||||||
|
maxAllowedVolume <= 0
|
||||||
|
? iSignal.volume
|
||||||
|
: MathMin(iSignal.volume, maxAllowedVolume);
|
||||||
|
|
||||||
//
|
//
|
||||||
AddRef(
|
AddRef(
|
||||||
iSignal,
|
iSignal,
|
||||||
@@ -2312,6 +2352,10 @@ protected:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int maxAllowed = MaxNumberOfRecoveries();
|
||||||
|
double maxAllowedVolume = MaxAllowedRecoveryVolume();
|
||||||
|
|
||||||
//
|
//
|
||||||
int count = Count();
|
int count = Count();
|
||||||
if (!IsValidSize(count))
|
if (!IsValidSize(count))
|
||||||
@@ -2322,6 +2366,17 @@ protected:
|
|||||||
//
|
//
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Check Count ...
|
||||||
|
bool isMaxPassed =
|
||||||
|
maxAllowed <= 0
|
||||||
|
? true
|
||||||
|
: data[i].rLevel < maxAllowed;
|
||||||
|
if (!isMaxPassed)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
XSignal iSignal;
|
XSignal iSignal;
|
||||||
bool hasRecovery = data[i].HasRecovery(
|
bool hasRecovery = data[i].HasRecovery(
|
||||||
@@ -2333,6 +2388,13 @@ protected:
|
|||||||
//
|
//
|
||||||
if (hasRecovery)
|
if (hasRecovery)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Check Max Volume ...
|
||||||
|
iSignal.volume =
|
||||||
|
maxAllowedVolume <= 0
|
||||||
|
? iSignal.volume
|
||||||
|
: MathMin(iSignal.volume, maxAllowedVolume);
|
||||||
|
|
||||||
//
|
//
|
||||||
AddRef(
|
AddRef(
|
||||||
iSignal,
|
iSignal,
|
||||||
@@ -3025,8 +3087,7 @@ public:
|
|||||||
// filters theme here and passed them
|
// filters theme here and passed them
|
||||||
// for Executing ...
|
// for Executing ...
|
||||||
int RequestForSignal(
|
int RequestForSignal(
|
||||||
XSignal &signals[], // Holds Signals ...
|
XSignal &signals[] // Holds Signals ...
|
||||||
bool force = false //
|
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -3036,13 +3097,9 @@ public:
|
|||||||
Clean(signals);
|
Clean(signals);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!force)
|
if (!IsEnable())
|
||||||
{
|
{
|
||||||
//
|
return result;
|
||||||
if (!IsEnable())
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -3750,6 +3807,7 @@ public:
|
|||||||
// Filter Signals Based On Max Allowed ...
|
// Filter Signals Based On Max Allowed ...
|
||||||
if (maxAllowed > 0)
|
if (maxAllowed > 0)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
XPosition iSymbolsPositions[];
|
XPosition iSymbolsPositions[];
|
||||||
int iSymbolsPositionsCount = mTrader.GetPositions(
|
int iSymbolsPositionsCount = mTrader.GetPositions(
|
||||||
iSymbolsPositions,
|
iSymbolsPositions,
|
||||||
@@ -3759,7 +3817,25 @@ public:
|
|||||||
NULL,
|
NULL,
|
||||||
true //
|
true //
|
||||||
);
|
);
|
||||||
isSignalValid = iSymbolsPositionsCount < maxAllowed;
|
|
||||||
|
//
|
||||||
|
int iSupportsCount = 0;
|
||||||
|
if (IsValidSize(iSymbolsPositionsCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Filter Support Positions ...
|
||||||
|
XPosition iSupports[];
|
||||||
|
iSupportsCount = ExtractSupports(
|
||||||
|
iSymbolsPositions,
|
||||||
|
iSupports //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
isSignalValid =
|
||||||
|
iSupportsCount <= 0
|
||||||
|
? iSymbolsPositionsCount < maxAllowed
|
||||||
|
: iSymbolsPositionsCount - iSupportsCount < maxAllowed;
|
||||||
if (!isSignalValid)
|
if (!isSignalValid)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -4217,7 +4293,10 @@ private:
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
XSignal supports[];
|
XSignal supports[];
|
||||||
int supportsCount = mTradeHandler.DoProtect(supports);
|
int supportsCount = mTradeHandler.DoProtect(
|
||||||
|
supports,
|
||||||
|
mSetups //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (IsValidSize(supportsCount))
|
if (IsValidSize(supportsCount))
|
||||||
|
|||||||
@@ -1337,3 +1337,75 @@
|
|||||||
Alert(message);
|
Alert(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// //
|
||||||
|
// XSignal tmpSignal;
|
||||||
|
// tmpSignal.Clean();
|
||||||
|
|
||||||
|
// //
|
||||||
|
// double longEntry = GetEntry(
|
||||||
|
// iPosition.symbol,
|
||||||
|
// POSITION_TYPE_BUY //
|
||||||
|
// );
|
||||||
|
// double shortEntry = GetEntry(
|
||||||
|
// iPosition.symbol,
|
||||||
|
// POSITION_TYPE_SELL //
|
||||||
|
// );
|
||||||
|
// double mVolume = iPosition.volume * 2;
|
||||||
|
// double mSL = 0;
|
||||||
|
// double mTP = 0;
|
||||||
|
|
||||||
|
// //
|
||||||
|
// bool isLong = IsLong(iPosition.type);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Here we Can Start a Recovery Zone ...
|
||||||
|
// if (data[index].rLongEntry <= 0 &&
|
||||||
|
// data[index].rShortEntry <= 0 &&
|
||||||
|
// data[index].rVolume <= 0)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// data[index].PrepareNextRecovery(
|
||||||
|
// supportDistance,
|
||||||
|
// volumeMultiplier,
|
||||||
|
// iPosition.type //
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// bool hasRecovery = data[index].HasRecovery(
|
||||||
|
// tmpSignal,
|
||||||
|
// supportDistance,
|
||||||
|
// volumeMultiplier //
|
||||||
|
// );
|
||||||
|
// if (hasRecovery)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// // tmpSignal.sl = 0;
|
||||||
|
// // tmpSignal.tp = 0;
|
||||||
|
// string comment = GenerateEQMSupportTag(iPosition.ticket);
|
||||||
|
// tmpSignal.comment = comment;
|
||||||
|
|
||||||
|
// //
|
||||||
|
// AddRef(
|
||||||
|
// tmpSignal,
|
||||||
|
// signals //
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// else if (priceDiffPoints >= supportDistance)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// // Reset
|
||||||
|
// if (longEntry > data[index].rZoneUpper || shortEntry < data[index].rZoneLower)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// // data[index].ResetRecovery();
|
||||||
|
|
||||||
|
// //
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user