add support for XCTimer on XUSPY5 EA ...

This commit is contained in:
2024-02-10 15:19:31 +03:30
parent 469414c66b
commit 946b2bfe58
7 changed files with 765 additions and 12 deletions
@@ -27,10 +27,16 @@
input group "Commons";
//
// END Inputs ...
// XCTIMER inputs ...
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 ...
//
//
//
// START Including Providers ...
//
@@ -65,6 +71,9 @@ bool isXUSPY5NewHour;
bool isXUSPY5NewDay;
bool isXUSPY5NewWeek;
bool isXUSPY5NewMonth;
//
int xUSPY5CTimerHandler = INVALID_HANDLE;
//
// END Global Definitions: Variables, Properties and etc ...
//
@@ -104,6 +113,16 @@ int OnInit()
return INIT_PARAMETERS_INCORRECT;
}
//
// Init XCTimer ...
if (xUSPY5ShowCandleTimer)
{
if (!XUSPY5CTimerInit())
{
return INIT_FAILED;
}
}
//
// Init Succeed ...
return INIT_SUCCEEDED;
@@ -135,6 +154,9 @@ void OnDeinit(const int reason)
//
// De Init XDraw Library ...
// OnDeinitDrawLibrary();
//
IndicatorRelease(xUSPY5CTimerHandler);
}
//
@@ -266,7 +288,6 @@ void OnTick()
SendAlert(message);
}
//
// Prevent Going Forward if user Disable it ...
if (xUSPY5EnableProvider)
@@ -275,7 +296,7 @@ void OnTick()
// Handle Processing on XUSPY5 Signal Provider ...
XUSPY5SignalProviderDoControlState();
}
//
// Check Can Ignore Tick or not ..
bool canIgnoreTick = xUSPY5IsTestMode
@@ -349,6 +370,30 @@ bool ValidateInputs()
return result;
}
bool XUSPY5CTimerInit()
{
//
bool result = true;
//
xUSPY5CTimerHandler = iCustom(
_Symbol,
_Period,
"x-saherelm.xctimer.indicator",
//
// Inputs ...
xUSPY5CandleTimerColot,
xUSPY5CandleTimerCorner);
//
if (xUSPY5CTimerHandler == INVALID_HANDLE)
{
result = false;
}
//
return result;
}
//
// END Functions ...
//