apply some fix on XAU5 ...

This commit is contained in:
2024-02-24 08:23:11 +03:30
parent e5dd6854fb
commit f482e4097a
9 changed files with 5779 additions and 8704 deletions
@@ -17,7 +17,7 @@
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm XUSCHF5 EA"
#property description "SaherElm XAU5 EA"
#property strict
//
@@ -28,9 +28,9 @@ input group "Commons";
//
// XCTIMER inputs ...
input bool xUSCHF5ShowCandleTimer = true; // Show Condle Remaining Time
input color xUSCHF5CandleTimerColot = clrYellow; // Candle Timer Color
input ENUM_BASE_CORNER xUSCHF5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to Show Candle Timer
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
//
// END Inputs ...
@@ -57,8 +57,8 @@ input ENUM_BASE_CORNER xUSCHF5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where t
#include "../Libraries/x-saherelm.draw.lib.mq5"
//
// XUSCHF5 Signal Provider ...
#include "../Providers/x-saherelm.xuschf5.provider.lib.mq5"
// XAU5 Signal Provider ...
#include "../Providers/x-saherelm.xau5.provider.lib.mq5"
//
// END Including Providers ...
@@ -67,13 +67,13 @@ input ENUM_BASE_CORNER xUSCHF5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where t
//
// START Global Definitions: Variables, Properties and etc ...
//
bool isXUSCHF5NewHour;
bool isXUSCHF5NewDay;
bool isXUSCHF5NewWeek;
bool isXUSCHF5NewMonth;
bool isXAU5NewHour;
bool isXAU5NewDay;
bool isXAU5NewWeek;
bool isXAU5NewMonth;
//
int xUSCHF5CTimerHandler = INVALID_HANDLE;
int xAU5CTimerHandler = INVALID_HANDLE;
//
// END Global Definitions: Variables, Properties and etc ...
//
@@ -87,7 +87,7 @@ int xUSCHF5CTimerHandler = INVALID_HANDLE;
int OnInit()
{
//
logTag = "XUSCHF5EA";
logTag = "XAU5EA";
drawPrefix = logTag;
alertPrefix = logTag;
@@ -107,17 +107,17 @@ int OnInit()
}
//
// Initialize XUSCHF5 Provider ...
if (!XUSCHF5InitSignalProviderLibrary())
// Initialize XAU5 Provider ...
if (!XAU5InitSignalProviderLibrary())
{
return INIT_PARAMETERS_INCORRECT;
}
//
// Init XCTimer ...
if (xUSCHF5ShowCandleTimer)
if (xAU5ShowCandleTimer)
{
if (!XUSCHF5CTimerInit())
if (!XAU5CTimerInit())
{
return INIT_FAILED;
}
@@ -148,15 +148,15 @@ void OnDeinit(const int reason)
// Here we can handle De Initialization Reasons ...
//
// De Initialize XUSCHF5 Provider ...
XUSCHF5DeinitSignalProviderLibrary(reason);
// De Initialize XAU5 Provider ...
XAU5DeinitSignalProviderLibrary(reason);
//
// De Init XDraw Library ...
// OnDeinitDrawLibrary();
//
IndicatorRelease(xUSCHF5CTimerHandler);
IndicatorRelease(xAU5CTimerHandler);
}
//
@@ -166,15 +166,15 @@ void OnTick()
//
// Handle Monthly Alert ...
bool isFirstMonth = xMonth == -1;
isXUSCHF5NewMonth = IsNewMonth();
isXAU5NewMonth = IsNewMonth();
bool canMonthlyAlert =
isXUSCHF5NewMonth &&
xUSCHF5EnableAlerts &&
xUSCHF5EnableMonthlyAlerts;
isXAU5NewMonth &&
xAU5EnableAlerts &&
xAU5EnableMonthlyAlerts;
bool canMonthlyReport =
!isFirstMonth &&
canMonthlyAlert &&
xUSCHF5EnableMonthlyReports;
xAU5EnableMonthlyReports;
if (canMonthlyAlert)
{
//
@@ -185,7 +185,7 @@ void OnTick()
if (canMonthlyReport)
{
//
string report = xUSCHF5Reporter.GenerateReportString(XREPORT_MONTHLY);
string report = xAU5Reporter.GenerateReportString(XREPORT_MONTHLY);
//
message = "Last Month Report:\n" + report;
@@ -193,7 +193,7 @@ void OnTick()
//
// Reset Report ...
xUSCHF5Reporter.Reset(XREPORT_MONTHLY);
xAU5Reporter.Reset(XREPORT_MONTHLY);
//
SendAlert(message);
@@ -202,15 +202,15 @@ void OnTick()
//
// Handle Weekly Alert ...
bool isFirstWeek = xDayOfWeek == -1;
isXUSCHF5NewWeek = IsNewWeek();
isXAU5NewWeek = IsNewWeek();
bool canWeeklyAlert =
isXUSCHF5NewWeek &&
xUSCHF5EnableAlerts &&
xUSCHF5EnableWeeklyAlerts;
isXAU5NewWeek &&
xAU5EnableAlerts &&
xAU5EnableWeeklyAlerts;
bool canWeeklyReport =
!isFirstWeek &&
canWeeklyAlert &&
xUSCHF5EnableWeeklyReports;
xAU5EnableWeeklyReports;
if (canWeeklyAlert)
{
//
@@ -221,7 +221,7 @@ void OnTick()
if (canWeeklyReport)
{
//
string report = xUSCHF5Reporter.GenerateReportString(XREPORT_WEEKLY);
string report = xAU5Reporter.GenerateReportString(XREPORT_WEEKLY);
//
message = "Last Week Report:\n" + report;
@@ -229,7 +229,7 @@ void OnTick()
//
// Reset Report ...
xUSCHF5Reporter.Reset(XREPORT_WEEKLY);
xAU5Reporter.Reset(XREPORT_WEEKLY);
//
SendAlert(message);
@@ -238,15 +238,15 @@ void OnTick()
//
// Handle Daily Alert ...
bool isFirstDay = xDay == -1;
isXUSCHF5NewDay = IsNewDay();
isXAU5NewDay = IsNewDay();
bool canDailyAlert =
isXUSCHF5NewDay &&
xUSCHF5EnableAlerts &&
xUSCHF5EnableDailyAlerts;
isXAU5NewDay &&
xAU5EnableAlerts &&
xAU5EnableDailyAlerts;
bool canDailyReport =
!isFirstDay &&
canDailyAlert &&
xUSCHF5EnableDailyReports;
xAU5EnableDailyReports;
if (canDailyAlert)
{
//
@@ -257,7 +257,7 @@ void OnTick()
if (canDailyReport)
{
//
string report = xUSCHF5Reporter.GenerateReportString(XREPORT_DAILY);
string report = xAU5Reporter.GenerateReportString(XREPORT_DAILY);
//
message = "Last Week Report:\n" + report;
@@ -265,7 +265,7 @@ void OnTick()
//
// Reset Report ...
xUSCHF5Reporter.Reset(XREPORT_DAILY);
xAU5Reporter.Reset(XREPORT_DAILY);
//
SendAlert(message);
@@ -274,11 +274,11 @@ void OnTick()
//
// Handle Hourly Alert ...
bool isFirstHour = xHour == -1;
isXUSCHF5NewHour = IsNewHour();
isXAU5NewHour = IsNewHour();
bool canHourlyAlert =
isXUSCHF5NewHour &&
xUSCHF5EnableAlerts &&
xUSCHF5EnableHourlyAlerts;
isXAU5NewHour &&
xAU5EnableAlerts &&
xAU5EnableHourlyAlerts;
if (canHourlyAlert)
{
//
@@ -290,33 +290,33 @@ void OnTick()
//
// Prevent Going Forward if user Disable it ...
if (xUSCHF5EnableProvider)
if (xAU5EnableProvider)
{
//
// Handle Processing on XUSCHF5 Signal Provider ...
XUSCHF5SignalProviderDoControlState();
// Handle Processing on XAU5 Signal Provider ...
XAU5SignalProviderDoControlState();
}
//
// Check Can Ignore Tick or not ..
bool canIgnoreTick = xUSCHF5IsTestMode
bool canIgnoreTick = xAU5IsTestMode
? !IsNewCandle()
: !IsNewCandle() && xUSCHF5WaitUntilNextCandle;
: !IsNewCandle() && xAU5WaitUntilNextCandle;
if (canIgnoreTick)
{
return;
}
//
xUSCHF5WaitUntilNextCandle = false;
xAU5WaitUntilNextCandle = false;
//
// Prevent Going Forward if user Disable it ...
if (xUSCHF5EnableProvider)
if (xAU5EnableProvider)
{
//
// Handle Processing on XUSCHF5 Signal Provider ...
XUSCHF5SignalProviderHandleTick();
// Handle Processing on XAU5 Signal Provider ...
XAU5SignalProviderHandleTick();
}
}
@@ -327,11 +327,11 @@ void OnTrade()
//
// Prevent Going Forward if user Disable it ...
if (xUSCHF5EnableProvider)
if (xAU5EnableProvider)
{
//
// Handle Processing Trades on XUSCHF5 Signal Provider ...
XUSCHF5SignalProviderHandleTrade();
// Handle Processing Trades on XAU5 Signal Provider ...
XAU5SignalProviderHandleTrade();
}
}
@@ -354,8 +354,8 @@ bool ValidateInputs()
// Validate Args ...
//
// Validate XUSCHF5 Provider Inputs ...
result = XUSCHF5ValidateInputs();
// Validate XAU5 Provider Inputs ...
result = XAU5ValidateInputs();
if (!result)
{
return false;
@@ -370,23 +370,23 @@ bool ValidateInputs()
return result;
}
bool XUSCHF5CTimerInit()
bool XAU5CTimerInit()
{
//
bool result = true;
//
xUSCHF5CTimerHandler = iCustom(
xAU5CTimerHandler = iCustom(
_Symbol,
_Period,
"x-saherelm.xctimer.indicator",
//
// Inputs ...
xUSCHF5CandleTimerColot,
xUSCHF5CandleTimerCorner);
xAU5CandleTimerColot,
xAU5CandleTimerCorner);
//
if (xUSCHF5CTimerHandler == INVALID_HANDLE)
if (xAU5CTimerHandler == INVALID_HANDLE)
{
result = false;
}