This commit is contained in:
2025-05-09 11:51:37 +03:30
parent b3be1b4596
commit bffe99a008
4 changed files with 162 additions and 21 deletions
+32 -13
View File
@@ -1,6 +1,25 @@
{ {
"todo": [], "todo": [
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-08T10:58:12.985Z",
"id": "7",
"references": [],
"title": "add support for Swings on Block Detection ..."
}
],
"in-progress": [ "in-progress": [
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-09T02:09:15.086Z",
"id": "8",
"references": [],
"title": "add support for Multi Time Frame and Multi Symbol"
},
{ {
"assignedTo": { "assignedTo": {
"name": "Hadi Khazaee Asl" "name": "Hadi Khazaee Asl"
@@ -14,19 +33,10 @@
"assignedTo": { "assignedTo": {
"name": "Hadi Khazaee Asl" "name": "Hadi Khazaee Asl"
}, },
"creation_time": "2025-05-08T10:58:12.985Z", "creation_time": "2025-05-09T02:16:34.743Z",
"id": "7", "id": "9",
"references": [], "references": [],
"title": "add support for Swings on Block Detection ..." "title": "add support for Closing All Trades at Specified Time ..."
},
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-08T10:51:12.522Z",
"id": "5",
"references": [],
"title": "add Trade Session Support and Multi Symbol Structure"
} }
], ],
"testing": [ "testing": [
@@ -72,6 +82,15 @@
"references": [], "references": [],
"title": "Add Support for Daily Max Volume and Ticks Box in XCAEA POI Detector ..." "title": "Add Support for Daily Max Volume and Ticks Box in XCAEA POI Detector ..."
}, },
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-08T10:51:12.522Z",
"id": "5",
"references": [],
"title": "add Trade Session Support and Multi Symbol Structure"
},
{ {
"assignedTo": { "assignedTo": {
"name": "Hadi Khazaee Asl" "name": "Hadi Khazaee Asl"
+12 -4
View File
@@ -159,7 +159,7 @@ void OnDeinit(const int reason)
// REASON_CLOSE 9 Terminal closed // REASON_CLOSE 9 Terminal closed
// //
// eaSignaller.DeInit(); eaSignaller.DeInit();
// //
ZeroMemory(eaAlert); ZeroMemory(eaAlert);
@@ -678,8 +678,15 @@ void InitRequirements()
eaTradeManager eaTradeManager
.SetTradeSession( .SetTradeSession(
_Symbol, _Symbol,
"03:00", // Start ... "01:30", // Start ...
"20:00", // End ... "14:25", // End ...
"XSaherSession" // Name ...
);
eaTradeManager
.SetTradeSession(
_Symbol,
"19:30", // Start ...
"11:30", // End ...
"XSaherSession" // Name ... "XSaherSession" // Name ...
); );
@@ -687,7 +694,8 @@ void InitRequirements()
// EA Signaller ... // EA Signaller ...
eaSignaller = new XCXCAEASignaller( eaSignaller = new XCXCAEASignaller(
_Symbol, _Symbol,
_Period // _Period,
PERIOD_H1 // Analysing Period ...
); );
// //
+87 -3
View File
@@ -613,6 +613,10 @@ class XCXCAEATradeManager : public XCBaseAlert
allowLongs = true; allowLongs = true;
allowShorts = true; allowShorts = true;
//
forceCloseAt = NULL;
isForceCloseAtTime = false;
// //
maxAllowedTPs = 0; maxAllowedTPs = 0;
maxAllowedSLs = 0; maxAllowedSLs = 0;
@@ -671,6 +675,14 @@ class XCXCAEATradeManager : public XCBaseAlert
mSaveTrades = value; mSaveTrades = value;
} }
//
void SetForceCloseTradesAt(
string _forceCloseAt //
)
{
forceCloseAt = _forceCloseAt;
}
// //
void SetTradeSession( void SetTradeSession(
string symbol, string symbol,
@@ -955,7 +967,28 @@ class XCXCAEATradeManager : public XCBaseAlert
// //
// Do Collection Protectiong ... // Do Collection Protectiong ...
// TODO: Implement this ...
//
// Check Force Close ...
if (IsValid(forceCloseAt))
{
//
datetime forceCloseTime = ParseDateTimeFromTimeString(forceCloseAt);
bool canForceClose = IsTimeInRange(
TimeCurrent(),
forceCloseTime //
) &&
!isForceCloseAtTime;
if (canForceClose)
{
//
isForceCloseAtTime = HandleForceCloseTrades(ownPosition);
//
// Prevent Moving Forward ...
return;
}
}
// //
// Do Signle Protections ... // Do Signle Protections ...
@@ -1224,10 +1257,12 @@ class XCXCAEATradeManager : public XCBaseAlert
// //
// Chack Trade Session Validating ... // Chack Trade Session Validating ...
if (isSymbolSessionExists) { if (isSymbolSessionExists)
{
// //
result = sessions[symbolSessionIDX].CanTrade(); result = sessions[symbolSessionIDX].CanTrade();
if (!result) { if (!result)
{
// //
executionResult = X_SIGNAL_EXECUTION_FAILED_DELAY_NOT_PASSED; executionResult = X_SIGNAL_EXECUTION_FAILED_DELAY_NOT_PASSED;
@@ -1620,6 +1655,44 @@ class XCXCAEATradeManager : public XCBaseAlert
RemoveTrade(idx); RemoveTrade(idx);
} }
/**
* Handle Force Close Trades ...
*/
bool HandleForceCloseTrades(
XPosition &positions[] //
)
{
//
bool result = false;
//
result = HasChild(positions);
if (!result)
{
return result;
}
//
string prefix = "Protector: ";
string comment = "Force Close ...";
//
int closedsCount = trader.Close(
positions,
comment //
);
result = IsValidSize(closedsCount);
if (result)
{
//
string message = prefix + "Force Close (" + ToString(closedsCount) + ") Trades at Specified Time ...";
HandleReportProtector(message);
}
//
return result;
}
// //
// TODO: Complete this ... // TODO: Complete this ...
void HandleGuard() void HandleGuard()
@@ -2040,6 +2113,13 @@ class XCXCAEATradeManager : public XCBaseAlert
bool isNewWeek = timeTracker.IsNewWeek(); bool isNewWeek = timeTracker.IsNewWeek();
bool isNewMonth = timeTracker.IsNewMonth(); bool isNewMonth = timeTracker.IsNewMonth();
//
// Reset Force Closed Flag on new Day Starts ...
if (isNewDay)
{
isForceCloseAtTime = false;
}
// //
bool canResetRestrictions = bool canResetRestrictions =
( (
@@ -2174,6 +2254,10 @@ class XCXCAEATradeManager : public XCBaseAlert
bool allowLongs; bool allowLongs;
bool allowShorts; bool allowShorts;
//
string forceCloseAt;
bool isForceCloseAtTime;
// //
int maxAllowedTPs; int maxAllowedTPs;
int maxAllowedSLs; int maxAllowedSLs;
+31 -1
View File
@@ -48,6 +48,7 @@ class XCXCAEASignaller : XCBase
XCXCAEAPOIDrawer *drawer; XCXCAEAPOIDrawer *drawer;
bool continuesRFTillTarget; bool continuesRFTillTarget;
XBoxZone unAvailableBoxes[]; XBoxZone unAvailableBoxes[];
XCXCAEAHelper *analyseHelper;
XCXCAEAPOIDetector *detector; XCXCAEAPOIDetector *detector;
XCAEAStrategyConditions mConditions; XCAEAStrategyConditions mConditions;
XCAEAStrategyConditions mConditionsCollection[]; XCAEAStrategyConditions mConditionsCollection[];
@@ -56,12 +57,14 @@ class XCXCAEASignaller : XCBase
// Constructor ... // Constructor ...
XCXCAEASignaller( XCXCAEASignaller(
string _symbol, string _symbol,
ENUM_TIMEFRAMES _period // ENUM_TIMEFRAMES _period,
ENUM_TIMEFRAMES _analysePeriod //
) )
{ {
// //
symbol = _symbol; symbol = _symbol;
period = _period; period = _period;
analysePeriod = _analysePeriod;
// //
Init(); Init();
@@ -175,6 +178,15 @@ class XCXCAEASignaller : XCBase
inputs // inputs //
); );
//
// XCAEA Analyse Helper ...
analyseHelper = new XCXCAEAHelper();
analyseHelper.Init(
symbol,
analysePeriod,
inputs //
);
// //
// Initialize and Configure Detector ... // Initialize and Configure Detector ...
detector = new XCXCAEAPOIDetector(helper); detector = new XCXCAEAPOIDetector(helper);
@@ -347,6 +359,7 @@ class XCXCAEASignaller : XCBase
ZeroMemory(drawer); ZeroMemory(drawer);
ZeroMemory(helper); ZeroMemory(helper);
ZeroMemory(detector); ZeroMemory(detector);
ZeroMemory(analyseHelper);
// //
mConditions.Clean(); mConditions.Clean();
@@ -461,6 +474,7 @@ class XCXCAEASignaller : XCBase
// //
// Checking Signal's Decision Zone ... // Checking Signal's Decision Zone ...
// On Trigger Time Frame ...
hasDecisionZone = DetectDecisionZone( hasDecisionZone = DetectDecisionZone(
helper, helper,
drawer, drawer,
@@ -471,6 +485,19 @@ class XCXCAEASignaller : XCBase
loopback // loopback //
); );
//
// Checking Signal's Decision Zone ...
// On Analyse Time Frame ...
// hasDecisionZone = DetectDecisionZone(
// helper,
// drawer,
// decisionZone,
// decisionZoneDir,
// conditions,
// zIndex,
// loopback //
// );
// //
// Make Signal Box UnAvailable ... // Make Signal Box UnAvailable ...
if (hasDecisionZone) if (hasDecisionZone)
@@ -891,6 +918,9 @@ class XCXCAEASignaller : XCBase
// Props ... // Props ...
string symbol; string symbol;
ENUM_TIMEFRAMES period; ENUM_TIMEFRAMES period;
ENUM_TIMEFRAMES analysePeriod;
//
CArrayObj mObjects; CArrayObj mObjects;
CArrayObj mBarObjects; CArrayObj mBarObjects;