apply fix on XEU5 ...

This commit is contained in:
2024-02-24 08:45:32 +03:30
parent f482e4097a
commit 558928d1a2
8 changed files with 7708 additions and 6754 deletions
@@ -17,20 +17,21 @@
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm XAU5 EA"
#property description "SaherElm XEU5 EA"
#property strict
//
// START Inputs ...
//
//
input group "Commons";
//
// XCTIMER inputs ...
input bool xAU5ShowCandleTimer = true; // Show Condle Remaining Time
input color xAU5CandleTimerColot = clrYellow; // Candle Timer Color
input ENUM_BASE_CORNER xAU5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to Show Candle Timer
input bool xEU5ShowCandleTimer = true; // Show Condle Remaining Time
input color xEU5CandleTimerColot = clrYellow; // Candle Timer Color
input ENUM_BASE_CORNER xEU5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to Show Candle Timer
//
// END Inputs ...
@@ -57,8 +58,8 @@ input ENUM_BASE_CORNER xAU5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to S
#include "../Libraries/x-saherelm.draw.lib.mq5"
//
// XAU5 Signal Provider ...
#include "../Providers/x-saherelm.xau5.provider.lib.mq5"
// XEU5 Signal Provider ...
#include "../Providers/x-saherelm.xeu5.provider.lib.mq5"
//
// END Including Providers ...
@@ -67,13 +68,13 @@ input ENUM_BASE_CORNER xAU5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to S
//
// START Global Definitions: Variables, Properties and etc ...
//
bool isXAU5NewHour;
bool isXAU5NewDay;
bool isXAU5NewWeek;
bool isXAU5NewMonth;
bool isXEU5NewHour;
bool isXEU5NewDay;
bool isXEU5NewWeek;
bool isXEU5NewMonth;
//
int xAU5CTimerHandler = INVALID_HANDLE;
int xEU5CTimerHandler = INVALID_HANDLE;
//
// END Global Definitions: Variables, Properties and etc ...
//
@@ -87,7 +88,7 @@ int xAU5CTimerHandler = INVALID_HANDLE;
int OnInit()
{
//
logTag = "XAU5EA";
logTag = "XEU5EA";
drawPrefix = logTag;
alertPrefix = logTag;
@@ -107,17 +108,17 @@ int OnInit()
}
//
// Initialize XAU5 Provider ...
if (!XAU5InitSignalProviderLibrary())
// Initialize XEU5 Provider ...
if (!XEU5InitSignalProviderLibrary())
{
return INIT_PARAMETERS_INCORRECT;
}
//
// Init XCTimer ...
if (xAU5ShowCandleTimer)
if (xEU5ShowCandleTimer)
{
if (!XAU5CTimerInit())
if (!XEU5CTimerInit())
{
return INIT_FAILED;
}
@@ -148,15 +149,15 @@ void OnDeinit(const int reason)
// Here we can handle De Initialization Reasons ...
//
// De Initialize XAU5 Provider ...
XAU5DeinitSignalProviderLibrary(reason);
// De Initialize XEU5 Provider ...
XEU5DeinitSignalProviderLibrary(reason);
//
// De Init XDraw Library ...
// OnDeinitDrawLibrary();
//
IndicatorRelease(xAU5CTimerHandler);
IndicatorRelease(xEU5CTimerHandler);
}
//
@@ -166,15 +167,15 @@ void OnTick()
//
// Handle Monthly Alert ...
bool isFirstMonth = xMonth == -1;
isXAU5NewMonth = IsNewMonth();
isXEU5NewMonth = IsNewMonth();
bool canMonthlyAlert =
isXAU5NewMonth &&
xAU5EnableAlerts &&
xAU5EnableMonthlyAlerts;
isXEU5NewMonth &&
xEU5EnableAlerts &&
xEU5EnableMonthlyAlerts;
bool canMonthlyReport =
!isFirstMonth &&
canMonthlyAlert &&
xAU5EnableMonthlyReports;
xEU5EnableMonthlyReports;
if (canMonthlyAlert)
{
//
@@ -185,7 +186,7 @@ void OnTick()
if (canMonthlyReport)
{
//
string report = xAU5Reporter.GenerateReportString(XREPORT_MONTHLY);
string report = xEU5Reporter.GenerateReportString(XREPORT_MONTHLY);
//
message = "Last Month Report:\n" + report;
@@ -193,7 +194,7 @@ void OnTick()
//
// Reset Report ...
xAU5Reporter.Reset(XREPORT_MONTHLY);
xEU5Reporter.Reset(XREPORT_MONTHLY);
//
SendAlert(message);
@@ -202,15 +203,15 @@ void OnTick()
//
// Handle Weekly Alert ...
bool isFirstWeek = xDayOfWeek == -1;
isXAU5NewWeek = IsNewWeek();
isXEU5NewWeek = IsNewWeek();
bool canWeeklyAlert =
isXAU5NewWeek &&
xAU5EnableAlerts &&
xAU5EnableWeeklyAlerts;
isXEU5NewWeek &&
xEU5EnableAlerts &&
xEU5EnableWeeklyAlerts;
bool canWeeklyReport =
!isFirstWeek &&
canWeeklyAlert &&
xAU5EnableWeeklyReports;
xEU5EnableWeeklyReports;
if (canWeeklyAlert)
{
//
@@ -221,7 +222,7 @@ void OnTick()
if (canWeeklyReport)
{
//
string report = xAU5Reporter.GenerateReportString(XREPORT_WEEKLY);
string report = xEU5Reporter.GenerateReportString(XREPORT_WEEKLY);
//
message = "Last Week Report:\n" + report;
@@ -229,7 +230,7 @@ void OnTick()
//
// Reset Report ...
xAU5Reporter.Reset(XREPORT_WEEKLY);
xEU5Reporter.Reset(XREPORT_WEEKLY);
//
SendAlert(message);
@@ -238,15 +239,15 @@ void OnTick()
//
// Handle Daily Alert ...
bool isFirstDay = xDay == -1;
isXAU5NewDay = IsNewDay();
isXEU5NewDay = IsNewDay();
bool canDailyAlert =
isXAU5NewDay &&
xAU5EnableAlerts &&
xAU5EnableDailyAlerts;
isXEU5NewDay &&
xEU5EnableAlerts &&
xEU5EnableDailyAlerts;
bool canDailyReport =
!isFirstDay &&
canDailyAlert &&
xAU5EnableDailyReports;
xEU5EnableDailyReports;
if (canDailyAlert)
{
//
@@ -257,7 +258,7 @@ void OnTick()
if (canDailyReport)
{
//
string report = xAU5Reporter.GenerateReportString(XREPORT_DAILY);
string report = xEU5Reporter.GenerateReportString(XREPORT_DAILY);
//
message = "Last Week Report:\n" + report;
@@ -265,7 +266,7 @@ void OnTick()
//
// Reset Report ...
xAU5Reporter.Reset(XREPORT_DAILY);
xEU5Reporter.Reset(XREPORT_DAILY);
//
SendAlert(message);
@@ -274,11 +275,11 @@ void OnTick()
//
// Handle Hourly Alert ...
bool isFirstHour = xHour == -1;
isXAU5NewHour = IsNewHour();
isXEU5NewHour = IsNewHour();
bool canHourlyAlert =
isXAU5NewHour &&
xAU5EnableAlerts &&
xAU5EnableHourlyAlerts;
isXEU5NewHour &&
xEU5EnableAlerts &&
xEU5EnableHourlyAlerts;
if (canHourlyAlert)
{
//
@@ -290,33 +291,33 @@ void OnTick()
//
// Prevent Going Forward if user Disable it ...
if (xAU5EnableProvider)
if (xEU5EnableProvider)
{
//
// Handle Processing on XAU5 Signal Provider ...
XAU5SignalProviderDoControlState();
// Handle Processing on XEU5 Signal Provider ...
XEU5SignalProviderDoControlState();
}
//
// Check Can Ignore Tick or not ..
bool canIgnoreTick = xAU5IsTestMode
bool canIgnoreTick = xEU5IsTestMode
? !IsNewCandle()
: !IsNewCandle() && xAU5WaitUntilNextCandle;
: !IsNewCandle() && xEU5WaitUntilNextCandle;
if (canIgnoreTick)
{
return;
}
//
xAU5WaitUntilNextCandle = false;
xEU5WaitUntilNextCandle = false;
//
// Prevent Going Forward if user Disable it ...
if (xAU5EnableProvider)
if (xEU5EnableProvider)
{
//
// Handle Processing on XAU5 Signal Provider ...
XAU5SignalProviderHandleTick();
// Handle Processing on XEU5 Signal Provider ...
XEU5SignalProviderHandleTick();
}
}
@@ -327,11 +328,11 @@ void OnTrade()
//
// Prevent Going Forward if user Disable it ...
if (xAU5EnableProvider)
if (xEU5EnableProvider)
{
//
// Handle Processing Trades on XAU5 Signal Provider ...
XAU5SignalProviderHandleTrade();
// Handle Processing Trades on XEU5 Signal Provider ...
XEU5SignalProviderHandleTrade();
}
}
@@ -354,8 +355,8 @@ bool ValidateInputs()
// Validate Args ...
//
// Validate XAU5 Provider Inputs ...
result = XAU5ValidateInputs();
// Validate XEU5 Provider Inputs ...
result = XEU5ValidateInputs();
if (!result)
{
return false;
@@ -370,24 +371,24 @@ bool ValidateInputs()
return result;
}
bool XAU5CTimerInit()
bool XEU5CTimerInit()
{
//
bool result = true;
//
xAU5CTimerHandler = iCustom(
xEU5CTimerHandler = iCustom(
_Symbol,
_Period,
"x-saherelm.xctimer.indicator",
//
// Inputs ...
xAU5CandleTimerColot,
xAU5CandleTimerCorner);
xEU5CandleTimerColot,
xEU5CandleTimerCorner
);
//
if (xAU5CTimerHandler == INVALID_HANDLE)
{
if (xEU5CTimerHandler == INVALID_HANDLE) {
result = false;
}