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": [],
|
"todo": [],
|
||||||
"in-progress": [
|
"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": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
@@ -48,14 +61,18 @@
|
|||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "Hadi Khazaee Asl"
|
"name": "Hadi Khazaee Asl"
|
||||||
},
|
},
|
||||||
"creation_time": "2025-05-31T03:26:20.344Z",
|
"creation_time": "2025-05-29T11:30:42.846Z",
|
||||||
"description": {
|
"description": {
|
||||||
"content": "Add Alert for Initialize and Deinitialize Expert Class ...",
|
"content": "do all protections senari in here ",
|
||||||
"mime": "text/markdown"
|
"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": [],
|
"references": [],
|
||||||
"title": "Add Alert for Initialize and Deinitialize Expert Class ..."
|
"title": "Create a Protector class"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"testing": [
|
"testing": [
|
||||||
@@ -182,23 +199,6 @@
|
|||||||
"id": "6",
|
"id": "6",
|
||||||
"references": [],
|
"references": [],
|
||||||
"title": "Complete Perday Trade Management based on SL(s) and TP(s)"
|
"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 ...
|
// Common ...
|
||||||
eaExpert.eaMagicNumber = eaMagicNumber;
|
|
||||||
eaExpert.eaSlippage = eaSlippage;
|
|
||||||
eaExpert.eaLogSuffix = eaTag;
|
eaExpert.eaLogSuffix = eaTag;
|
||||||
|
eaExpert.eaSlippage = eaSlippage;
|
||||||
|
eaExpert.eaMagicNumber = eaMagicNumber;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detector ...
|
// Detector ...
|
||||||
@@ -213,11 +213,11 @@ int OnInit()
|
|||||||
// Validations ...
|
// Validations ...
|
||||||
eaExpert.eaForceHasSwing = eaForceHasSwing;
|
eaExpert.eaForceHasSwing = eaForceHasSwing;
|
||||||
eaExpert.eaForceOBBarType = eaForceOBBarType;
|
eaExpert.eaForceOBBarType = eaForceOBBarType;
|
||||||
eaExpert.eaMinRequiredOBBar = eaMinRequiredOBBar;
|
|
||||||
eaExpert.eaForceFVGBarType = eaForceFVGBarType;
|
eaExpert.eaForceFVGBarType = eaForceFVGBarType;
|
||||||
eaExpert.eaLiquidityLoopback = eaLiquidityLoopback;
|
|
||||||
eaExpert.eaMaxAllowedRange = eaMaxAllowedRange;
|
eaExpert.eaMaxAllowedRange = eaMaxAllowedRange;
|
||||||
eaExpert.eaMinAllowedRange = eaMinAllowedRange;
|
eaExpert.eaMinAllowedRange = eaMinAllowedRange;
|
||||||
|
eaExpert.eaMinRequiredOBBar = eaMinRequiredOBBar;
|
||||||
|
eaExpert.eaLiquidityLoopback = eaLiquidityLoopback;
|
||||||
eaExpert.eaForceHasFLiquidity = eaForceHasFLiquidity;
|
eaExpert.eaForceHasFLiquidity = eaForceHasFLiquidity;
|
||||||
eaExpert.eaForceHasRLiquidity = eaForceHasRLiquidity;
|
eaExpert.eaForceHasRLiquidity = eaForceHasRLiquidity;
|
||||||
eaExpert.eaValidateGapSequence = eaValidateGapSequence;
|
eaExpert.eaValidateGapSequence = eaValidateGapSequence;
|
||||||
@@ -226,36 +226,36 @@ int OnInit()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Filters ...
|
// Filters ...
|
||||||
|
eaExpert.eaBosLoopback = eaBosLoopback;
|
||||||
eaExpert.eaFilterBasedOnKI = eaFilterBasedOnKI;
|
eaExpert.eaFilterBasedOnKI = eaFilterBasedOnKI;
|
||||||
eaExpert.eaFilterBasedOnPV = eaFilterBasedOnPV;
|
eaExpert.eaFilterBasedOnPV = eaFilterBasedOnPV;
|
||||||
eaExpert.eaBosLoopback = eaBosLoopback;
|
|
||||||
eaExpert.eaFilterBasedOnSar = eaFilterBasedOnSar;
|
eaExpert.eaFilterBasedOnSar = eaFilterBasedOnSar;
|
||||||
eaExpert.eaForceSarSwitched = eaForceSarSwitched;
|
|
||||||
eaExpert.eaForceSarOnBothSide = eaForceSarOnBothSide;
|
|
||||||
eaExpert.eaForceSarHasBreakout = eaForceSarHasBreakout;
|
|
||||||
eaExpert.eaForceSarHasReversalSide = eaForceSarHasReversalSide;
|
|
||||||
eaExpert.eaFilterBasedOnRSI = eaFilterBasedOnRSI;
|
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.eaForceHasRSITrending = eaForceHasRSITrending;
|
||||||
eaExpert.eaForceHasRSIVPattern = eaForceHasRSIVPattern;
|
eaExpert.eaForceHasRSIVPattern = eaForceHasRSIVPattern;
|
||||||
eaExpert.eaForceHasRSICrossing = eaForceHasRSICrossing;
|
eaExpert.eaForceHasRSICrossing = eaForceHasRSICrossing;
|
||||||
eaExpert.eaFilterBasedOnADX = eaFilterBasedOnADX;
|
|
||||||
eaExpert.eaForceHasADXTrending = eaForceHasADXTrending;
|
eaExpert.eaForceHasADXTrending = eaForceHasADXTrending;
|
||||||
eaExpert.eaForceHasADXCrossing = eaForceHasADXCrossing;
|
eaExpert.eaForceHasADXCrossing = eaForceHasADXCrossing;
|
||||||
eaExpert.eaFilterBasedOnATR = eaFilterBasedOnATR;
|
|
||||||
eaExpert.eaForceHasATRTrending = eaForceHasATRTrending;
|
eaExpert.eaForceHasATRTrending = eaForceHasATRTrending;
|
||||||
eaExpert.eaForceHasATRBreakout = eaForceHasATRBreakout;
|
eaExpert.eaForceHasATRBreakout = eaForceHasATRBreakout;
|
||||||
eaExpert.eaFilterBasedOnTrend = eaFilterBasedOnTrend;
|
|
||||||
eaExpert.eaForceHasTrendDir = eaForceHasTrendDir;
|
|
||||||
eaExpert.eaForceHasTrendPlace = eaForceHasTrendPlace;
|
|
||||||
eaExpert.eaForceHasTrendChange = eaForceHasTrendChange;
|
eaExpert.eaForceHasTrendChange = eaForceHasTrendChange;
|
||||||
|
eaExpert.eaFilterBasedOnVolume = eaFilterBasedOnVolume;
|
||||||
eaExpert.eaForceHasTrendTrending = eaForceHasTrendTrending;
|
eaExpert.eaForceHasTrendTrending = eaForceHasTrendTrending;
|
||||||
eaExpert.eaForceHasTrendRejection = eaForceHasTrendRejection;
|
eaExpert.eaForceHasTrendRejection = eaForceHasTrendRejection;
|
||||||
eaExpert.eaForceHasTrendLineInside = eaForceHasTrendLineInside;
|
|
||||||
eaExpert.eaForceHasTrendDirOnBothSide = eaForceHasTrendDirOnBothSide;
|
|
||||||
eaExpert.eaFilterBasedOnDelta = eaFilterBasedOnDelta;
|
|
||||||
eaExpert.eaFilterBasedOnVolume = eaFilterBasedOnVolume;
|
|
||||||
eaExpert.eaFilterBasedOnSignalBar = eaFilterBasedOnSignalBar;
|
eaExpert.eaFilterBasedOnSignalBar = eaFilterBasedOnSignalBar;
|
||||||
|
eaExpert.eaForceSarHasReversalSide = eaForceSarHasReversalSide;
|
||||||
|
eaExpert.eaForceHasTrendLineInside = eaForceHasTrendLineInside;
|
||||||
eaExpert.eaFilterBasedOnHKSignalBar = eaFilterBasedOnHKSignalBar;
|
eaExpert.eaFilterBasedOnHKSignalBar = eaFilterBasedOnHKSignalBar;
|
||||||
|
eaExpert.eaForceHasTrendDirOnBothSide = eaForceHasTrendDirOnBothSide;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Signal ...
|
// Signal ...
|
||||||
@@ -266,53 +266,54 @@ int OnInit()
|
|||||||
// Volume ...
|
// Volume ...
|
||||||
eaExpert.eaVolumeSelect = eaVolumeSelect;
|
eaExpert.eaVolumeSelect = eaVolumeSelect;
|
||||||
eaExpert.eaStaticVoluem = eaStaticVoluem;
|
eaExpert.eaStaticVoluem = eaStaticVoluem;
|
||||||
eaExpert.eaDynamicVolumeStepBalance = eaDynamicVolumeStepBalance;
|
|
||||||
eaExpert.eaDynamicVolumeStepVolume = eaDynamicVolumeStepVolume;
|
|
||||||
eaExpert.eaConstantRiskBalance = eaConstantRiskBalance;
|
|
||||||
eaExpert.eaConstantPercent = eaConstantPercent;
|
eaExpert.eaConstantPercent = eaConstantPercent;
|
||||||
eaExpert.eaConstantBalance = eaConstantBalance;
|
eaExpert.eaConstantBalance = eaConstantBalance;
|
||||||
|
eaExpert.eaConstantRiskBalance = eaConstantRiskBalance;
|
||||||
|
eaExpert.eaDynamicVolumeStepVolume = eaDynamicVolumeStepVolume;
|
||||||
|
eaExpert.eaDynamicVolumeStepBalance = eaDynamicVolumeStepBalance;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Management ...
|
// Management ...
|
||||||
eaExpert.eaSymbols = eaSymbols;
|
eaExpert.eaSymbols = eaSymbols;
|
||||||
eaExpert.eaAllowGuards = eaAllowGuards;
|
eaExpert.eaSessions = eaSessions;
|
||||||
eaExpert.eaAllowTrade = eaAllowTrade;
|
eaExpert.eaAllowTrade = eaAllowTrade;
|
||||||
eaExpert.eaAllowLongs = eaAllowLongs;
|
eaExpert.eaAllowLongs = eaAllowLongs;
|
||||||
|
eaExpert.eaAllowGuards = eaAllowGuards;
|
||||||
eaExpert.eaAllowShorts = eaAllowShorts;
|
eaExpert.eaAllowShorts = eaAllowShorts;
|
||||||
eaExpert.eaRestrictionsPeriod = eaRestrictionsPeriod;
|
|
||||||
eaExpert.eaMaxAllowedTPs = eaMaxAllowedTPs;
|
eaExpert.eaMaxAllowedTPs = eaMaxAllowedTPs;
|
||||||
eaExpert.eaMaxAllowedSLs = eaMaxAllowedSLs;
|
eaExpert.eaMaxAllowedSLs = eaMaxAllowedSLs;
|
||||||
eaExpert.eaMaxAllowedTrades = eaMaxAllowedTrades;
|
eaExpert.eaMaxAllowedTrades = eaMaxAllowedTrades;
|
||||||
eaExpert.eaMaxAllowedPositions = eaMaxAllowedPositions;
|
|
||||||
eaExpert.eaMaxAllowedSpread = eaMaxAllowedSpread;
|
eaExpert.eaMaxAllowedSpread = eaMaxAllowedSpread;
|
||||||
eaExpert.eaMaxAllowedDrawdownFactor = eaMaxAllowedDrawdownFactor;
|
eaExpert.eaRestrictionsPeriod = eaRestrictionsPeriod;
|
||||||
|
eaExpert.eaMaxAllowedPositions = eaMaxAllowedPositions;
|
||||||
eaExpert.eaCloseAllOpenTradesAt = eaCloseAllOpenTradesAt;
|
eaExpert.eaCloseAllOpenTradesAt = eaCloseAllOpenTradesAt;
|
||||||
|
eaExpert.eaMaxAllowedDrawdownFactor = eaMaxAllowedDrawdownFactor;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Alert ...
|
// Alert ...
|
||||||
eaExpert.eaEnableAlerts = eaEnableAlerts;
|
|
||||||
eaExpert.eaLogAlerts = eaLogAlerts;
|
eaExpert.eaLogAlerts = eaLogAlerts;
|
||||||
eaExpert.eaMailAlerts = eaMailAlerts;
|
eaExpert.eaMailAlerts = eaMailAlerts;
|
||||||
eaExpert.eaPushAlerts = eaPushAlerts;
|
eaExpert.eaPushAlerts = eaPushAlerts;
|
||||||
|
eaExpert.eaEnableAlerts = eaEnableAlerts;
|
||||||
eaExpert.eaTerminalAlerts = eaTerminalAlerts;
|
eaExpert.eaTerminalAlerts = eaTerminalAlerts;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reports ...
|
// Reports ...
|
||||||
eaExpert.eaReportNewMonths = eaReportNewMonths;
|
|
||||||
eaExpert.eaReportNewWeeks = eaReportNewWeeks;
|
|
||||||
eaExpert.eaReportNewDays = eaReportNewDays;
|
|
||||||
eaExpert.eaReportNewHours = eaReportNewHours;
|
|
||||||
eaExpert.eaReportTrades = eaReportTrades;
|
eaExpert.eaReportTrades = eaReportTrades;
|
||||||
|
eaExpert.eaReportNewDays = eaReportNewDays;
|
||||||
eaExpert.eaReportSignals = eaReportSignals;
|
eaExpert.eaReportSignals = eaReportSignals;
|
||||||
|
eaExpert.eaReportNewWeeks = eaReportNewWeeks;
|
||||||
|
eaExpert.eaReportNewHours = eaReportNewHours;
|
||||||
eaExpert.eaReportProtector = eaReportProtector;
|
eaExpert.eaReportProtector = eaReportProtector;
|
||||||
|
eaExpert.eaReportNewMonths = eaReportNewMonths;
|
||||||
eaExpert.eaReportAfterTradesBalance = eaReportAfterTradesBalance;
|
eaExpert.eaReportAfterTradesBalance = eaReportAfterTradesBalance;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Collector ...
|
// Collector ...
|
||||||
eaExpert.eaSaveTrades = eaSaveTrades;
|
|
||||||
eaExpert.eaSaveSignals = eaSaveSignals;
|
|
||||||
eaExpert.eaSaveWins = eaSaveWins;
|
eaExpert.eaSaveWins = eaSaveWins;
|
||||||
eaExpert.eaSaveLosts = eaSaveLosts;
|
eaExpert.eaSaveLosts = eaSaveLosts;
|
||||||
|
eaExpert.eaSaveTrades = eaSaveTrades;
|
||||||
|
eaExpert.eaSaveSignals = eaSaveSignals;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Attach Event Handlers ...
|
// Attach Event Handlers ...
|
||||||
|
|||||||
@@ -306,6 +306,10 @@ class XCXCATBEAExpert : public XCBase
|
|||||||
eaTradeManager.SaveTrades(eaSaveTrades);
|
eaTradeManager.SaveTrades(eaSaveTrades);
|
||||||
eaTradeManager.SaveSignals(eaSaveSignals);
|
eaTradeManager.SaveSignals(eaSaveSignals);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enable Force Close At ...
|
||||||
|
eaTradeManager.SetForceCloseTradesAt(eaCloseAllOpenTradesAt);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setting Trade Reports ...
|
// Setting Trade Reports ...
|
||||||
eaTradeManager
|
eaTradeManager
|
||||||
|
|||||||
@@ -294,16 +294,6 @@ class XCXCATBEASignaller : XCBase
|
|||||||
return;
|
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 ...
|
// Initialize Bar ...
|
||||||
bar.Init(
|
bar.Init(
|
||||||
@@ -330,6 +320,13 @@ class XCXCATBEASignaller : XCBase
|
|||||||
drawer.Draw(bar.time);
|
drawer.Draw(bar.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Here we Check Active Session ...
|
||||||
|
// and Prevent Moving forward if there is not
|
||||||
|
// Session actives ...
|
||||||
|
// for improvement Calculation Speeds ...
|
||||||
|
if (isActiveSession)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Check Signal Setups ...
|
// Check Signal Setups ...
|
||||||
has = DetectSignalSetup(barIndex);
|
has = DetectSignalSetup(barIndex);
|
||||||
@@ -344,6 +341,7 @@ class XCXCATBEASignaller : XCBase
|
|||||||
//
|
//
|
||||||
mConditions.Clean();
|
mConditions.Clean();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup Resources ...
|
// Cleanup Resources ...
|
||||||
|
|||||||
@@ -2536,6 +2536,30 @@ class XCXCATBEATradeManager : public XCBaseAlert
|
|||||||
symbols[index].managedSLs += item.managedSLs;
|
symbols[index].managedSLs += item.managedSLs;
|
||||||
symbols[index].managedTPs += item.managedTPs;
|
symbols[index].managedTPs += item.managedTPs;
|
||||||
symbols[index].managedTrades += item.managedTrades;
|
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