apply latest optimization on indicator helpers classes and also add time tracking configurations into ea ...

This commit is contained in:
2024-07-09 12:40:59 +03:30
parent 47e21cece6
commit ee9f04b817
39 changed files with 499 additions and 399 deletions
+102 -54
View File
@@ -124,6 +124,15 @@ input bool x121EAMailAlerts = false; // Mail Alerts
input bool x121EAPushAlerts = false; // Push Alerts
input bool x121EATerminalAlerts = false; // Terminal Alerts
//
// Time Tracking ...
input group "Time Tracking";
input bool x121EAAlertNewMonth = false; // Alert New Month
input bool x121EAAlertNewWeek = false; // Alert New Week
input bool x121EAAlertNewDay = false; // Alert New Day
input bool x121EAAlertNewHour = false; // Alert New Hour
input bool x121EAAlertNewMinute = false; // Alert New Minute
//
// Definitions ...
@@ -131,7 +140,7 @@ input bool x121EATerminalAlerts = false; // Terminal Alerts
// Local Variables ...
//
bool is121EAInTestMode = false;
const bool is121EAInTestMode = IsRunningOnTestMode();
XTimeTracker x121EATimeTracker;
//
@@ -159,12 +168,9 @@ int OnInit()
return INIT_PARAMETERS_INCORRECT;
}
//
is121EAInTestMode = IsRunningOnTestMode();
//
// Initializitation Succeed Message ...
x121EA.Alert("Initialized Successfully ...");
x121EAAlert.Alert("Initialized Successfully ...");
//
// Init Succeed ...
@@ -187,18 +193,24 @@ void OnDeinit(const int reason)
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
// REASON_CLOSE 9 Terminal closed
//
// De Initialization Succeed ...
x121EAAlert.Alert("De Initialized Successfully ...");
//
// Clean Array ...
Clean(x121EAUsedSymbols);
//
// De Initialize XSampleEA Providers ...
delete x121EA;
//
delete x121EAAlert;
delete x121EACTHelper;
delete x121EACCHelper;
//
// De Initialization Succeed ...
x121EA.Alert("De Initialized Successfully ...");
delete x121EAAlert;
}
//
@@ -206,51 +218,7 @@ void OnDeinit(const int reason)
void OnTick()
{
//
// Time Tracking ...
//
// Alert Month ...
if (x121EATimeTracker.IsNewMonth())
{
//
if (!is121EAInTestMode)
{
x121EAAlert.Alert("New Mount ...");
}
}
//
// Alert Week ...
if (x121EATimeTracker.IsNewWeek())
{
//
if (!is121EAInTestMode)
{
x121EAAlert.Alert("New Week ...");
}
}
//
// Alert New Day ...
if (x121EATimeTracker.IsNewDay())
{
//
if (!is121EAInTestMode)
{
x121EAAlert.Alert("New Day ...");
}
}
//
// Alert New Hour ...
if (x121EATimeTracker.IsNewHour())
{
//
if (!is121EAInTestMode)
{
x121EAAlert.Alert("New Hour ...");
}
}
X121EAHandleTimeReports();
//
x121EA.OnTick();
@@ -370,6 +338,11 @@ bool InitialEA()
result = IsValidSize(symbolsCount);
if (!result)
{
//
Clean(inputSymbols);
Clean(allSymbols);
Clean(watchListSymbols);
Clean(x121EAUsedSymbols);
return result;
}
@@ -474,14 +447,15 @@ bool InitialEA()
//
// Prepare Providers and Add them into mX121EA class ...
ENUM_TIMEFRAMES iHostPeriod = _Period;
for (int i = 0; i < symbolsCount; i++)
{
//
// Requirements ...
string iSymbol = x121EAUsedSymbols[i];
ENUM_TIMEFRAMES iHostPeriod = _Period;
//
// Instancing Setup Cycle ...
XSCX121SetupCycles *iSetupCycle;
iSetupCycle = new XSCX121SetupCycles();
result = iSetupCycle.Init(
@@ -495,6 +469,7 @@ bool InitialEA()
}
//
// Adding Instance Pointer Class to EA Class Instance ...
result = x121EA.AddSetup(iSetupCycle);
if (!result)
{
@@ -502,6 +477,12 @@ bool InitialEA()
}
}
//
// Cleaning Unused Arrays ...
Clean(inputSymbols);
Clean(allSymbols);
Clean(watchListSymbols);
//
return result;
}
@@ -746,3 +727,70 @@ void X121ReportState()
}
//
void X121EAHandleTimeReports()
{
//
// Time Tracking ...
//
// Alert Month ...
if (x121EAAlertNewMonth)
{
//
bool isNewMonth = x121EATimeTracker.IsNewMonth();
if (isNewMonth)
{
x121EAAlert.Alert("New Mount ...");
}
}
//
// Alert Week ...
if (x121EAAlertNewWeek)
{
//
bool isNewWeek = x121EATimeTracker.IsNewWeek();
if (isNewWeek)
{
x121EAAlert.Alert("New Week ...");
}
}
//
// Alert New Day ...
if (x121EAAlertNewDay)
{
//
bool isNewDay = x121EATimeTracker.IsNewDay();
if (isNewDay)
{
x121EAAlert.Alert("New Day ...");
}
}
//
// Alert New Hour ...
if (x121EAAlertNewHour)
{
//
bool isNewHour = x121EATimeTracker.IsNewHour();
if (isNewHour)
{
x121EAAlert.Alert("New Hour ...");
}
}
//
// Alert New Minute ...
if (x121EAAlertNewMinute)
{
//
bool isNewMinute = x121EATimeTracker.IsNewMinute();
if (isNewMinute)
{
x121EAAlert.Alert("New Minute ...");
}
}
}
//