fix eaSession attaching in Expert class and also fix All Closed at Specific Time ...
This commit is contained in:
Vendored
+21
-21
@@ -1,6 +1,19 @@
|
||||
{
|
||||
"todo": [],
|
||||
"in-progress": [
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"creation_time": "2025-05-31T03:26:20.344Z",
|
||||
"description": {
|
||||
"content": "Add Alert for Initialize and Deinitialize Expert Class ...",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "19",
|
||||
"references": [],
|
||||
"title": "Add Alert for Initialize and Deinitialize Expert Class ..."
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
@@ -48,14 +61,18 @@
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"creation_time": "2025-05-31T03:26:20.344Z",
|
||||
"creation_time": "2025-05-29T11:30:42.846Z",
|
||||
"description": {
|
||||
"content": "Add Alert for Initialize and Deinitialize Expert Class ...",
|
||||
"content": "do all protections senari in here ",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "19",
|
||||
"details": {
|
||||
"content": "- [] What to Do when next Type position Recieved;\n- [] What to Do when opposit Type position Recieved;\n- [] What to Do when Max Same Time Positions Reached;\n- [] ...",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "15",
|
||||
"references": [],
|
||||
"title": "Add Alert for Initialize and Deinitialize Expert Class ..."
|
||||
"title": "Create a Protector class"
|
||||
}
|
||||
],
|
||||
"testing": [
|
||||
@@ -182,23 +199,6 @@
|
||||
"id": "6",
|
||||
"references": [],
|
||||
"title": "Complete Perday Trade Management based on SL(s) and TP(s)"
|
||||
},
|
||||
{
|
||||
"assignedTo": {
|
||||
"name": "Hadi Khazaee Asl"
|
||||
},
|
||||
"creation_time": "2025-05-29T11:30:42.846Z",
|
||||
"description": {
|
||||
"content": "do all protections senari in here ",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"details": {
|
||||
"content": "- [] What to Do when next Type position Recieved;\n- [] What to Do when opposit Type position Recieved;\n- [] What to Do when Max Same Time Positions Reached;\n- [] ...",
|
||||
"mime": "text/markdown"
|
||||
},
|
||||
"id": "15",
|
||||
"references": [],
|
||||
"title": "Create a Protector class"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -202,9 +202,9 @@ int OnInit()
|
||||
|
||||
//
|
||||
// Common ...
|
||||
eaExpert.eaMagicNumber = eaMagicNumber;
|
||||
eaExpert.eaSlippage = eaSlippage;
|
||||
eaExpert.eaLogSuffix = eaTag;
|
||||
eaExpert.eaSlippage = eaSlippage;
|
||||
eaExpert.eaMagicNumber = eaMagicNumber;
|
||||
|
||||
//
|
||||
// Detector ...
|
||||
@@ -213,11 +213,11 @@ int OnInit()
|
||||
// Validations ...
|
||||
eaExpert.eaForceHasSwing = eaForceHasSwing;
|
||||
eaExpert.eaForceOBBarType = eaForceOBBarType;
|
||||
eaExpert.eaMinRequiredOBBar = eaMinRequiredOBBar;
|
||||
eaExpert.eaForceFVGBarType = eaForceFVGBarType;
|
||||
eaExpert.eaLiquidityLoopback = eaLiquidityLoopback;
|
||||
eaExpert.eaMaxAllowedRange = eaMaxAllowedRange;
|
||||
eaExpert.eaMinAllowedRange = eaMinAllowedRange;
|
||||
eaExpert.eaMinRequiredOBBar = eaMinRequiredOBBar;
|
||||
eaExpert.eaLiquidityLoopback = eaLiquidityLoopback;
|
||||
eaExpert.eaForceHasFLiquidity = eaForceHasFLiquidity;
|
||||
eaExpert.eaForceHasRLiquidity = eaForceHasRLiquidity;
|
||||
eaExpert.eaValidateGapSequence = eaValidateGapSequence;
|
||||
@@ -226,36 +226,36 @@ int OnInit()
|
||||
|
||||
//
|
||||
// Filters ...
|
||||
eaExpert.eaBosLoopback = eaBosLoopback;
|
||||
eaExpert.eaFilterBasedOnKI = eaFilterBasedOnKI;
|
||||
eaExpert.eaFilterBasedOnPV = eaFilterBasedOnPV;
|
||||
eaExpert.eaBosLoopback = eaBosLoopback;
|
||||
eaExpert.eaFilterBasedOnSar = eaFilterBasedOnSar;
|
||||
eaExpert.eaForceSarSwitched = eaForceSarSwitched;
|
||||
eaExpert.eaForceSarOnBothSide = eaForceSarOnBothSide;
|
||||
eaExpert.eaForceSarHasBreakout = eaForceSarHasBreakout;
|
||||
eaExpert.eaForceSarHasReversalSide = eaForceSarHasReversalSide;
|
||||
eaExpert.eaFilterBasedOnRSI = eaFilterBasedOnRSI;
|
||||
eaExpert.eaForceSarSwitched = eaForceSarSwitched;
|
||||
eaExpert.eaFilterBasedOnADX = eaFilterBasedOnADX;
|
||||
eaExpert.eaFilterBasedOnATR = eaFilterBasedOnATR;
|
||||
eaExpert.eaForceHasTrendDir = eaForceHasTrendDir;
|
||||
eaExpert.eaForceSarOnBothSide = eaForceSarOnBothSide;
|
||||
eaExpert.eaFilterBasedOnTrend = eaFilterBasedOnTrend;
|
||||
eaExpert.eaForceHasTrendPlace = eaForceHasTrendPlace;
|
||||
eaExpert.eaFilterBasedOnDelta = eaFilterBasedOnDelta;
|
||||
eaExpert.eaForceSarHasBreakout = eaForceSarHasBreakout;
|
||||
eaExpert.eaForceHasRSITrending = eaForceHasRSITrending;
|
||||
eaExpert.eaForceHasRSIVPattern = eaForceHasRSIVPattern;
|
||||
eaExpert.eaForceHasRSICrossing = eaForceHasRSICrossing;
|
||||
eaExpert.eaFilterBasedOnADX = eaFilterBasedOnADX;
|
||||
eaExpert.eaForceHasADXTrending = eaForceHasADXTrending;
|
||||
eaExpert.eaForceHasADXCrossing = eaForceHasADXCrossing;
|
||||
eaExpert.eaFilterBasedOnATR = eaFilterBasedOnATR;
|
||||
eaExpert.eaForceHasATRTrending = eaForceHasATRTrending;
|
||||
eaExpert.eaForceHasATRBreakout = eaForceHasATRBreakout;
|
||||
eaExpert.eaFilterBasedOnTrend = eaFilterBasedOnTrend;
|
||||
eaExpert.eaForceHasTrendDir = eaForceHasTrendDir;
|
||||
eaExpert.eaForceHasTrendPlace = eaForceHasTrendPlace;
|
||||
eaExpert.eaForceHasTrendChange = eaForceHasTrendChange;
|
||||
eaExpert.eaFilterBasedOnVolume = eaFilterBasedOnVolume;
|
||||
eaExpert.eaForceHasTrendTrending = eaForceHasTrendTrending;
|
||||
eaExpert.eaForceHasTrendRejection = eaForceHasTrendRejection;
|
||||
eaExpert.eaForceHasTrendLineInside = eaForceHasTrendLineInside;
|
||||
eaExpert.eaForceHasTrendDirOnBothSide = eaForceHasTrendDirOnBothSide;
|
||||
eaExpert.eaFilterBasedOnDelta = eaFilterBasedOnDelta;
|
||||
eaExpert.eaFilterBasedOnVolume = eaFilterBasedOnVolume;
|
||||
eaExpert.eaFilterBasedOnSignalBar = eaFilterBasedOnSignalBar;
|
||||
eaExpert.eaForceSarHasReversalSide = eaForceSarHasReversalSide;
|
||||
eaExpert.eaForceHasTrendLineInside = eaForceHasTrendLineInside;
|
||||
eaExpert.eaFilterBasedOnHKSignalBar = eaFilterBasedOnHKSignalBar;
|
||||
eaExpert.eaForceHasTrendDirOnBothSide = eaForceHasTrendDirOnBothSide;
|
||||
|
||||
//
|
||||
// Signal ...
|
||||
@@ -266,53 +266,54 @@ int OnInit()
|
||||
// Volume ...
|
||||
eaExpert.eaVolumeSelect = eaVolumeSelect;
|
||||
eaExpert.eaStaticVoluem = eaStaticVoluem;
|
||||
eaExpert.eaDynamicVolumeStepBalance = eaDynamicVolumeStepBalance;
|
||||
eaExpert.eaDynamicVolumeStepVolume = eaDynamicVolumeStepVolume;
|
||||
eaExpert.eaConstantRiskBalance = eaConstantRiskBalance;
|
||||
eaExpert.eaConstantPercent = eaConstantPercent;
|
||||
eaExpert.eaConstantBalance = eaConstantBalance;
|
||||
eaExpert.eaConstantRiskBalance = eaConstantRiskBalance;
|
||||
eaExpert.eaDynamicVolumeStepVolume = eaDynamicVolumeStepVolume;
|
||||
eaExpert.eaDynamicVolumeStepBalance = eaDynamicVolumeStepBalance;
|
||||
|
||||
//
|
||||
// Management ...
|
||||
eaExpert.eaSymbols = eaSymbols;
|
||||
eaExpert.eaAllowGuards = eaAllowGuards;
|
||||
eaExpert.eaSessions = eaSessions;
|
||||
eaExpert.eaAllowTrade = eaAllowTrade;
|
||||
eaExpert.eaAllowLongs = eaAllowLongs;
|
||||
eaExpert.eaAllowGuards = eaAllowGuards;
|
||||
eaExpert.eaAllowShorts = eaAllowShorts;
|
||||
eaExpert.eaRestrictionsPeriod = eaRestrictionsPeriod;
|
||||
eaExpert.eaMaxAllowedTPs = eaMaxAllowedTPs;
|
||||
eaExpert.eaMaxAllowedSLs = eaMaxAllowedSLs;
|
||||
eaExpert.eaMaxAllowedTrades = eaMaxAllowedTrades;
|
||||
eaExpert.eaMaxAllowedPositions = eaMaxAllowedPositions;
|
||||
eaExpert.eaMaxAllowedSpread = eaMaxAllowedSpread;
|
||||
eaExpert.eaMaxAllowedDrawdownFactor = eaMaxAllowedDrawdownFactor;
|
||||
eaExpert.eaRestrictionsPeriod = eaRestrictionsPeriod;
|
||||
eaExpert.eaMaxAllowedPositions = eaMaxAllowedPositions;
|
||||
eaExpert.eaCloseAllOpenTradesAt = eaCloseAllOpenTradesAt;
|
||||
eaExpert.eaMaxAllowedDrawdownFactor = eaMaxAllowedDrawdownFactor;
|
||||
|
||||
//
|
||||
// Alert ...
|
||||
eaExpert.eaEnableAlerts = eaEnableAlerts;
|
||||
eaExpert.eaLogAlerts = eaLogAlerts;
|
||||
eaExpert.eaMailAlerts = eaMailAlerts;
|
||||
eaExpert.eaPushAlerts = eaPushAlerts;
|
||||
eaExpert.eaEnableAlerts = eaEnableAlerts;
|
||||
eaExpert.eaTerminalAlerts = eaTerminalAlerts;
|
||||
|
||||
//
|
||||
// Reports ...
|
||||
eaExpert.eaReportNewMonths = eaReportNewMonths;
|
||||
eaExpert.eaReportNewWeeks = eaReportNewWeeks;
|
||||
eaExpert.eaReportNewDays = eaReportNewDays;
|
||||
eaExpert.eaReportNewHours = eaReportNewHours;
|
||||
eaExpert.eaReportTrades = eaReportTrades;
|
||||
eaExpert.eaReportNewDays = eaReportNewDays;
|
||||
eaExpert.eaReportSignals = eaReportSignals;
|
||||
eaExpert.eaReportNewWeeks = eaReportNewWeeks;
|
||||
eaExpert.eaReportNewHours = eaReportNewHours;
|
||||
eaExpert.eaReportProtector = eaReportProtector;
|
||||
eaExpert.eaReportNewMonths = eaReportNewMonths;
|
||||
eaExpert.eaReportAfterTradesBalance = eaReportAfterTradesBalance;
|
||||
|
||||
//
|
||||
// Collector ...
|
||||
eaExpert.eaSaveTrades = eaSaveTrades;
|
||||
eaExpert.eaSaveSignals = eaSaveSignals;
|
||||
eaExpert.eaSaveWins = eaSaveWins;
|
||||
eaExpert.eaSaveLosts = eaSaveLosts;
|
||||
eaExpert.eaSaveTrades = eaSaveTrades;
|
||||
eaExpert.eaSaveSignals = eaSaveSignals;
|
||||
|
||||
//
|
||||
// Attach Event Handlers ...
|
||||
|
||||
@@ -306,6 +306,10 @@ class XCXCATBEAExpert : public XCBase
|
||||
eaTradeManager.SaveTrades(eaSaveTrades);
|
||||
eaTradeManager.SaveSignals(eaSaveSignals);
|
||||
|
||||
//
|
||||
// Enable Force Close At ...
|
||||
eaTradeManager.SetForceCloseTradesAt(eaCloseAllOpenTradesAt);
|
||||
|
||||
//
|
||||
// Setting Trade Reports ...
|
||||
eaTradeManager
|
||||
|
||||
@@ -294,16 +294,6 @@ class XCXCATBEASignaller : XCBase
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Here we Check Active Session ...
|
||||
// and Prevent Moving forward if there is not
|
||||
// Session actives ...
|
||||
// for improvement Calculation Speeds ...
|
||||
if (!isActiveSession)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize Bar ...
|
||||
bar.Init(
|
||||
@@ -331,18 +321,26 @@ class XCXCATBEASignaller : XCBase
|
||||
}
|
||||
|
||||
//
|
||||
// Check Signal Setups ...
|
||||
has = DetectSignalSetup(barIndex);
|
||||
if (has)
|
||||
// Here we Check Active Session ...
|
||||
// and Prevent Moving forward if there is not
|
||||
// Session actives ...
|
||||
// for improvement Calculation Speeds ...
|
||||
if (isActiveSession)
|
||||
{
|
||||
//
|
||||
barTraker.Waits();
|
||||
// Check Signal Setups ...
|
||||
has = DetectSignalSetup(barIndex);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
barTraker.Waits();
|
||||
|
||||
//
|
||||
AddConditionsIfNotExists();
|
||||
//
|
||||
AddConditionsIfNotExists();
|
||||
|
||||
//
|
||||
mConditions.Clean();
|
||||
//
|
||||
mConditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -2536,6 +2536,30 @@ class XCXCATBEATradeManager : public XCBaseAlert
|
||||
symbols[index].managedSLs += item.managedSLs;
|
||||
symbols[index].managedTPs += item.managedTPs;
|
||||
symbols[index].managedTrades += item.managedTrades;
|
||||
|
||||
//
|
||||
// Handle Remove on Managed SL based On Managed TP ...
|
||||
if (item.managedTPs > 0)
|
||||
{
|
||||
//
|
||||
symbols[index].managedSLs -= item.managedTPs;
|
||||
if (symbols[index].managedSLs < 0)
|
||||
{
|
||||
symbols[index].managedSLs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Remove on Managed TP based On Managed SL ...
|
||||
if (item.managedSLs > 0)
|
||||
{
|
||||
//
|
||||
symbols[index].managedTPs -= item.managedSLs;
|
||||
if (symbols[index].managedTPs < 0)
|
||||
{
|
||||
symbols[index].managedTPs = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user