refactor xTest EA to XGPUS5 for start Implementation ...
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// SaherElm IT Center MQL5 Expert Advisor
|
||||
// ----------------------------------------
|
||||
// Name: XAUUSD
|
||||
// Name: XGPUS5
|
||||
// Description: this is an expert controller
|
||||
// advisors which provides a mechanism for use them ...
|
||||
//
|
||||
@@ -27,10 +27,16 @@
|
||||
input group "Commons";
|
||||
|
||||
//
|
||||
// END Inputs ...
|
||||
// XCTIMER inputs ...
|
||||
input bool xGPUS5ShowCandleTimer = true; // Show Condle Remaining Time
|
||||
input color xGPUS5CandleTimerColot = clrYellow; // Candle Timer Color
|
||||
input ENUM_BASE_CORNER xGPUS5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to Show Candle Timer
|
||||
|
||||
//
|
||||
// END Inputs ...
|
||||
//
|
||||
|
||||
//
|
||||
//
|
||||
// START Including Providers ...
|
||||
//
|
||||
|
||||
@@ -65,6 +71,9 @@ bool isXGPUS5NewHour;
|
||||
bool isXGPUS5NewDay;
|
||||
bool isXGPUS5NewWeek;
|
||||
bool isXGPUS5NewMonth;
|
||||
|
||||
//
|
||||
int xGPUS5CTimerHandler = INVALID_HANDLE;
|
||||
//
|
||||
// END Global Definitions: Variables, Properties and etc ...
|
||||
//
|
||||
@@ -104,6 +113,16 @@ int OnInit()
|
||||
return INIT_PARAMETERS_INCORRECT;
|
||||
}
|
||||
|
||||
//
|
||||
// Init XCTimer ...
|
||||
if (xGPUS5ShowCandleTimer)
|
||||
{
|
||||
if (!XGPUS5CTimerInit())
|
||||
{
|
||||
return INIT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Init Succeed ...
|
||||
return INIT_SUCCEEDED;
|
||||
@@ -135,6 +154,9 @@ void OnDeinit(const int reason)
|
||||
//
|
||||
// De Init XDraw Library ...
|
||||
// OnDeinitDrawLibrary();
|
||||
|
||||
//
|
||||
IndicatorRelease(xGPUS5CTimerHandler);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -266,7 +288,6 @@ void OnTick()
|
||||
SendAlert(message);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Prevent Going Forward if user Disable it ...
|
||||
if (xGPUS5EnableProvider)
|
||||
@@ -277,11 +298,18 @@ void OnTick()
|
||||
}
|
||||
|
||||
//
|
||||
if (!IsNewCandle())
|
||||
// Check Can Ignore Tick or not ..
|
||||
bool canIgnoreTick = xGPUS5IsTestMode
|
||||
? !IsNewCandle()
|
||||
: !IsNewCandle() && xGPUS5WaitUntilNextCandle;
|
||||
if (canIgnoreTick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
xGPUS5WaitUntilNextCandle = false;
|
||||
|
||||
//
|
||||
// Prevent Going Forward if user Disable it ...
|
||||
if (xGPUS5EnableProvider)
|
||||
@@ -342,6 +370,30 @@ bool ValidateInputs()
|
||||
return result;
|
||||
}
|
||||
|
||||
bool XGPUS5CTimerInit()
|
||||
{
|
||||
//
|
||||
bool result = true;
|
||||
|
||||
//
|
||||
xGPUS5CTimerHandler = iCustom(
|
||||
_Symbol,
|
||||
_Period,
|
||||
"x-saherelm.xctimer.indicator",
|
||||
//
|
||||
// Inputs ...
|
||||
xGPUS5CandleTimerColot,
|
||||
xGPUS5CandleTimerCorner);
|
||||
|
||||
//
|
||||
if (xGPUS5CTimerHandler == INVALID_HANDLE)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
//
|
||||
// END Functions ...
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user