add alert class instance in x121ea and configure it for using tima tracker alerting ...
This commit is contained in:
@@ -139,6 +139,7 @@ string x121EAUsedSymbols[];
|
|||||||
XSCX121SetupEA *x121EA;
|
XSCX121SetupEA *x121EA;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
XSCAlert *x121EAAlert;
|
||||||
XSCXCTHelper *x121EACTHelper;
|
XSCXCTHelper *x121EACTHelper;
|
||||||
XSCXCCHelper *x121EACCHelper;
|
XSCXCCHelper *x121EACCHelper;
|
||||||
|
|
||||||
@@ -207,32 +208,46 @@ void OnTick()
|
|||||||
// Time Tracking ...
|
// Time Tracking ...
|
||||||
|
|
||||||
//
|
//
|
||||||
if (x121EATimeTracker.IsNewHour())
|
// Alert Month ...
|
||||||
{
|
|
||||||
//
|
|
||||||
if (!is121EAInTestMode)
|
|
||||||
{
|
|
||||||
x121EA.Alert("New Hour ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (x121EATimeTracker.IsNewDay())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (!is121EAInTestMode)
|
|
||||||
{
|
|
||||||
x121EA.Alert("New Day ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (x121EATimeTracker.IsNewMonth())
|
if (x121EATimeTracker.IsNewMonth())
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (!is121EAInTestMode)
|
if (!is121EAInTestMode)
|
||||||
{
|
{
|
||||||
x121EA.Alert("New Mount ...");
|
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 ...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,6 +297,17 @@ bool InitialEA()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initial Alert Class ...
|
||||||
|
x121EATimeTracker.Clean();
|
||||||
|
x121EAAlert = new XSCAlert();
|
||||||
|
x121EAAlert.SetPrefix(ShortName);
|
||||||
|
x121EAAlert.SetEnableAlerts(x121EAEnableAlerts);
|
||||||
|
x121EAAlert.SetLogAlerts(x121EALogAlerts);
|
||||||
|
x121EAAlert.SetMailAlerts(x121EAMailAlerts);
|
||||||
|
x121EAAlert.SetPushAlerts(x121EAPushAlerts);
|
||||||
|
x121EAAlert.SetTerminalAlerts(x121EATerminalAlerts);
|
||||||
|
|
||||||
//
|
//
|
||||||
// TesterHideIndicators(true);
|
// TesterHideIndicators(true);
|
||||||
|
|
||||||
|
|||||||
+75
-12
@@ -49,6 +49,10 @@ XSCXTestSetup *iSetup;
|
|||||||
XSCXCTHelper *mCTHelper;
|
XSCXCTHelper *mCTHelper;
|
||||||
XSCXCCHelper *mCCHelper;
|
XSCXCCHelper *mCCHelper;
|
||||||
|
|
||||||
|
//
|
||||||
|
XSCAlert *eaAlert;
|
||||||
|
XTimeTracker eaTimeTracker;
|
||||||
|
|
||||||
//
|
//
|
||||||
// For Pivot Checking ...
|
// For Pivot Checking ...
|
||||||
XPivot lastSupportPivot;
|
XPivot lastSupportPivot;
|
||||||
@@ -79,6 +83,7 @@ int OnInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Initial Bar Tracker ...
|
||||||
bool isInited = eaBarTracker.Init(
|
bool isInited = eaBarTracker.Init(
|
||||||
_Symbol,
|
_Symbol,
|
||||||
_Period //
|
_Period //
|
||||||
@@ -88,6 +93,18 @@ int OnInit()
|
|||||||
return INIT_FAILED;
|
return INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initial Alert Class ...
|
||||||
|
eaAlert = new XSCAlert(
|
||||||
|
ShortName,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true //
|
||||||
|
);
|
||||||
|
eaTimeTracker.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init Succeed ...
|
// Init Succeed ...
|
||||||
return INIT_SUCCEEDED;
|
return INIT_SUCCEEDED;
|
||||||
@@ -131,11 +148,15 @@ void OnTick()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Check Pivots ...
|
// Check Pivots ...
|
||||||
HandleCheckPivots();
|
// HandleCheckPivots();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Zones ...
|
// Check Zones ...
|
||||||
// HandleCheckZones();
|
// HandleCheckZones();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Time Tracker ...
|
||||||
|
// HandleCheckTimeTracker();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -446,50 +467,92 @@ void HandleCheckPivots()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void HandleCheckZones() {
|
void HandleCheckZones()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Last Support Zone ...
|
// Find Last Support Zone ...
|
||||||
if (!lastSupportZone.IsValid()) {
|
if (!lastSupportZone.IsValid())
|
||||||
|
{
|
||||||
//
|
//
|
||||||
result = lastSupportZone.FindLastSupportZone(
|
result = lastSupportZone.FindLastSupportZone(
|
||||||
_Symbol,
|
_Symbol,
|
||||||
_Period //
|
_Period //
|
||||||
);
|
);
|
||||||
if (!result) {
|
if (!result)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = lastSupportZone.Draw(ChartID());
|
result = lastSupportZone.Draw(ChartID());
|
||||||
if (result) {
|
if (result)
|
||||||
|
{
|
||||||
Print("Valid Support Zone ...");
|
Print("Valid Support Zone ...");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Last Resistance Zone ...
|
// Find Last Resistance Zone ...
|
||||||
if (!lastResistanceZone.IsValid()) {
|
if (!lastResistanceZone.IsValid())
|
||||||
|
{
|
||||||
//
|
//
|
||||||
result = lastResistanceZone.FindLastResistanceZone(
|
result = lastResistanceZone.FindLastResistanceZone(
|
||||||
_Symbol,
|
_Symbol,
|
||||||
_Period //
|
_Period //
|
||||||
);
|
);
|
||||||
if (!result) {
|
if (!result)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = lastResistanceZone.Draw(ChartID());
|
result = lastResistanceZone.Draw(ChartID());
|
||||||
if (result) {
|
if (result)
|
||||||
|
{
|
||||||
Print("Valid Resistance Zone ...");
|
Print("Valid Resistance Zone ...");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void HandleCheckTimeTracker() {
|
||||||
|
//
|
||||||
|
// Month ...
|
||||||
|
if (eaTimeTracker.IsNewMonth()) {
|
||||||
|
eaAlert.Alert("New Month ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Week ...
|
||||||
|
if (eaTimeTracker.IsNewWeek()) {
|
||||||
|
eaAlert.Alert("New Week ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Day ...
|
||||||
|
if (eaTimeTracker.IsNewDay()) {
|
||||||
|
eaAlert.Alert("New Day ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hour ...
|
||||||
|
if (eaTimeTracker.IsNewHour()) {
|
||||||
|
eaAlert.Alert("New Hour ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Minute ...
|
||||||
|
if (eaTimeTracker.IsNewMinute()) {
|
||||||
|
eaAlert.Alert("New Minute ...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,5 +693,5 @@ void OldTests()
|
|||||||
// eaBarTracker.Waits();
|
// eaBarTracker.Waits();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1862,6 +1862,7 @@ struct XTimeTracker
|
|||||||
int xForWeekDay;
|
int xForWeekDay;
|
||||||
int xDay;
|
int xDay;
|
||||||
int xHour;
|
int xHour;
|
||||||
|
int xMinute;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
@@ -1880,10 +1881,34 @@ struct XTimeTracker
|
|||||||
xDay = -1;
|
xDay = -1;
|
||||||
xHour = -1;
|
xHour = -1;
|
||||||
xMonth = -1;
|
xMonth = -1;
|
||||||
|
xMinute = -1;
|
||||||
xDayOfWeek = -1;
|
xDayOfWeek = -1;
|
||||||
xForWeekDay = -1;
|
xForWeekDay = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detecting New Minute ...
|
||||||
|
bool IsNewMinute()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Current Time as Struct ...
|
||||||
|
MqlDateTime timeStruct = GetCurrentTime();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Houre ...
|
||||||
|
result = timeStruct.min != xMinute;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
xMinute = timeStruct.min;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detecting New Houre ...
|
// Detecting New Houre ...
|
||||||
bool IsNewHour()
|
bool IsNewHour()
|
||||||
|
|||||||
Reference in New Issue
Block a user