prepare XUSPY5 EA Workspace ...

This commit is contained in:
2024-02-24 18:13:35 -08:00
parent 5a5587660a
commit 97058d084a
43 changed files with 46498 additions and 1218 deletions
@@ -2,7 +2,7 @@
//
// SaherElm IT Center MQL5 Expert Advisor
// ----------------------------------------
// Name: XAUUSD
// Name: XUSPY5
// Description: this is an expert controller
// advisors which provides a mechanism for use them ...
//
@@ -17,7 +17,7 @@
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm XBTUS5 EA"
#property description "SaherElm XUSPY5 EA"
#property strict
//
@@ -28,9 +28,9 @@ input group "Commons";
//
// XCTIMER inputs ...
input bool xBTUS5ShowCandleTimer = true; // Show Condle Remaining Time
input color xBTUS5CandleTimerColot = clrYellow; // Candle Timer Color
input ENUM_BASE_CORNER xBTUS5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to Show Candle Timer
input bool xUSPY5ShowCandleTimer = true; // Show Condle Remaining Time
input color xUSPY5CandleTimerColot = clrYellow; // Candle Timer Color
input ENUM_BASE_CORNER xUSPY5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to Show Candle Timer
//
// END Inputs ...
@@ -57,8 +57,8 @@ input ENUM_BASE_CORNER xBTUS5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to
#include "../Libraries/x-saherelm.draw.lib.mq5"
//
// XBTUS5 Signal Provider ...
#include "../Providers/x-saherelm.xbtus5.provider.lib.mq5"
// XUSPY5 Signal Provider ...
#include "../Providers/x-saherelm.xuspy5.provider.lib.mq5"
//
// END Including Providers ...
@@ -67,13 +67,13 @@ input ENUM_BASE_CORNER xBTUS5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to
//
// START Global Definitions: Variables, Properties and etc ...
//
bool isXBTUS5NewHour;
bool isXBTUS5NewDay;
bool isXBTUS5NewWeek;
bool isXBTUS5NewMonth;
bool isXUSPY5NewHour;
bool isXUSPY5NewDay;
bool isXUSPY5NewWeek;
bool isXUSPY5NewMonth;
//
int xBTUS5CTimerHandler = INVALID_HANDLE;
int xUSPY5CTimerHandler = INVALID_HANDLE;
//
// END Global Definitions: Variables, Properties and etc ...
//
@@ -87,7 +87,7 @@ int xBTUS5CTimerHandler = INVALID_HANDLE;
int OnInit()
{
//
logTag = "XBTUS5EA";
logTag = "XUSPY5EA";
drawPrefix = logTag;
alertPrefix = logTag;
@@ -107,17 +107,17 @@ int OnInit()
}
//
// Initialize XBTUS5 Provider ...
if (!XBTUS5InitSignalProviderLibrary())
// Initialize XUSPY5 Provider ...
if (!XUSPY5InitSignalProviderLibrary())
{
return INIT_PARAMETERS_INCORRECT;
}
//
// Init XCTimer ...
if (xBTUS5ShowCandleTimer)
if (xUSPY5ShowCandleTimer)
{
if (!XBTUS5CTimerInit())
if (!XUSPY5CTimerInit())
{
return INIT_FAILED;
}
@@ -148,15 +148,15 @@ void OnDeinit(const int reason)
// Here we can handle De Initialization Reasons ...
//
// De Initialize XBTUS5 Provider ...
XBTUS5DeinitSignalProviderLibrary(reason);
// De Initialize XUSPY5 Provider ...
XUSPY5DeinitSignalProviderLibrary(reason);
//
// De Init XDraw Library ...
// OnDeinitDrawLibrary();
//
IndicatorRelease(xBTUS5CTimerHandler);
IndicatorRelease(xUSPY5CTimerHandler);
}
//
@@ -166,15 +166,15 @@ void OnTick()
//
// Handle Monthly Alert ...
bool isFirstMonth = xMonth == -1;
isXBTUS5NewMonth = IsNewMonth();
isXUSPY5NewMonth = IsNewMonth();
bool canMonthlyAlert =
isXBTUS5NewMonth &&
xBTUS5EnableAlerts &&
xBTUS5EnableMonthlyAlerts;
isXUSPY5NewMonth &&
xUSPY5EnableAlerts &&
xUSPY5EnableMonthlyAlerts;
bool canMonthlyReport =
!isFirstMonth &&
canMonthlyAlert &&
xBTUS5EnableMonthlyReports;
xUSPY5EnableMonthlyReports;
if (canMonthlyAlert)
{
//
@@ -185,7 +185,7 @@ void OnTick()
if (canMonthlyReport)
{
//
string report = xBTUS5Reporter.GenerateReportString(XREPORT_MONTHLY);
string report = xUSPY5Reporter.GenerateReportString(XREPORT_MONTHLY);
//
message = "Last Month Report:\n" + report;
@@ -193,7 +193,7 @@ void OnTick()
//
// Reset Report ...
xBTUS5Reporter.Reset(XREPORT_MONTHLY);
xUSPY5Reporter.Reset(XREPORT_MONTHLY);
//
SendAlert(message);
@@ -202,15 +202,15 @@ void OnTick()
//
// Handle Weekly Alert ...
bool isFirstWeek = xDayOfWeek == -1;
isXBTUS5NewWeek = IsNewWeek();
isXUSPY5NewWeek = IsNewWeek();
bool canWeeklyAlert =
isXBTUS5NewWeek &&
xBTUS5EnableAlerts &&
xBTUS5EnableWeeklyAlerts;
isXUSPY5NewWeek &&
xUSPY5EnableAlerts &&
xUSPY5EnableWeeklyAlerts;
bool canWeeklyReport =
!isFirstWeek &&
canWeeklyAlert &&
xBTUS5EnableWeeklyReports;
xUSPY5EnableWeeklyReports;
if (canWeeklyAlert)
{
//
@@ -221,7 +221,7 @@ void OnTick()
if (canWeeklyReport)
{
//
string report = xBTUS5Reporter.GenerateReportString(XREPORT_WEEKLY);
string report = xUSPY5Reporter.GenerateReportString(XREPORT_WEEKLY);
//
message = "Last Week Report:\n" + report;
@@ -229,7 +229,7 @@ void OnTick()
//
// Reset Report ...
xBTUS5Reporter.Reset(XREPORT_WEEKLY);
xUSPY5Reporter.Reset(XREPORT_WEEKLY);
//
SendAlert(message);
@@ -238,15 +238,15 @@ void OnTick()
//
// Handle Daily Alert ...
bool isFirstDay = xDay == -1;
isXBTUS5NewDay = IsNewDay();
isXUSPY5NewDay = IsNewDay();
bool canDailyAlert =
isXBTUS5NewDay &&
xBTUS5EnableAlerts &&
xBTUS5EnableDailyAlerts;
isXUSPY5NewDay &&
xUSPY5EnableAlerts &&
xUSPY5EnableDailyAlerts;
bool canDailyReport =
!isFirstDay &&
canDailyAlert &&
xBTUS5EnableDailyReports;
xUSPY5EnableDailyReports;
if (canDailyAlert)
{
//
@@ -257,7 +257,7 @@ void OnTick()
if (canDailyReport)
{
//
string report = xBTUS5Reporter.GenerateReportString(XREPORT_DAILY);
string report = xUSPY5Reporter.GenerateReportString(XREPORT_DAILY);
//
message = "Last Week Report:\n" + report;
@@ -265,7 +265,7 @@ void OnTick()
//
// Reset Report ...
xBTUS5Reporter.Reset(XREPORT_DAILY);
xUSPY5Reporter.Reset(XREPORT_DAILY);
//
SendAlert(message);
@@ -274,11 +274,11 @@ void OnTick()
//
// Handle Hourly Alert ...
bool isFirstHour = xHour == -1;
isXBTUS5NewHour = IsNewHour();
isXUSPY5NewHour = IsNewHour();
bool canHourlyAlert =
isXBTUS5NewHour &&
xBTUS5EnableAlerts &&
xBTUS5EnableHourlyAlerts;
isXUSPY5NewHour &&
xUSPY5EnableAlerts &&
xUSPY5EnableHourlyAlerts;
if (canHourlyAlert)
{
//
@@ -290,33 +290,33 @@ void OnTick()
//
// Prevent Going Forward if user Disable it ...
if (xBTUS5EnableProvider)
if (xUSPY5EnableProvider)
{
//
// Handle Processing on XBTUS5 Signal Provider ...
XBTUS5SignalProviderDoControlState();
// Handle Processing on XUSPY5 Signal Provider ...
XUSPY5SignalProviderDoControlState();
}
//
// Check Can Ignore Tick or not ..
bool canIgnoreTick = xBTUS5IsTestMode
bool canIgnoreTick = xUSPY5IsTestMode
? !IsNewCandle()
: !IsNewCandle() && xBTUS5WaitUntilNextCandle;
: !IsNewCandle() && xUSPY5WaitUntilNextCandle;
if (canIgnoreTick)
{
return;
}
//
xBTUS5WaitUntilNextCandle = false;
xUSPY5WaitUntilNextCandle = false;
//
// Prevent Going Forward if user Disable it ...
if (xBTUS5EnableProvider)
if (xUSPY5EnableProvider)
{
//
// Handle Processing on XBTUS5 Signal Provider ...
XBTUS5SignalProviderHandleTick();
// Handle Processing on XUSPY5 Signal Provider ...
XUSPY5SignalProviderHandleTick();
}
}
@@ -327,11 +327,11 @@ void OnTrade()
//
// Prevent Going Forward if user Disable it ...
if (xBTUS5EnableProvider)
if (xUSPY5EnableProvider)
{
//
// Handle Processing Trades on XBTUS5 Signal Provider ...
XBTUS5SignalProviderHandleTrade();
// Handle Processing Trades on XUSPY5 Signal Provider ...
XUSPY5SignalProviderHandleTrade();
}
}
@@ -354,8 +354,8 @@ bool ValidateInputs()
// Validate Args ...
//
// Validate XBTUS5 Provider Inputs ...
result = XBTUS5ValidateInputs();
// Validate XUSPY5 Provider Inputs ...
result = XUSPY5ValidateInputs();
if (!result)
{
return false;
@@ -370,23 +370,23 @@ bool ValidateInputs()
return result;
}
bool XBTUS5CTimerInit()
bool XUSPY5CTimerInit()
{
//
bool result = true;
//
xBTUS5CTimerHandler = iCustom(
xUSPY5CTimerHandler = iCustom(
_Symbol,
_Period,
"x-saherelm.xctimer.indicator",
//
// Inputs ...
xBTUS5CandleTimerColot,
xBTUS5CandleTimerCorner);
xUSPY5CandleTimerColot,
xUSPY5CandleTimerCorner);
//
if (xBTUS5CTimerHandler == INVALID_HANDLE)
if (xUSPY5CTimerHandler == INVALID_HANDLE)
{
result = false;
}