237 lines
4.6 KiB
Plaintext
237 lines
4.6 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Expert Advisor
|
|
// ----------------------------------------
|
|
// Name: XEA
|
|
// Description: this is an expert controller
|
|
// advisors which provides a mechanism for use them ...
|
|
//
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
//
|
|
// Global Properties ...
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://saherelm.ir"
|
|
#property version "1.00"
|
|
#property description "SaherElm XEA"
|
|
#property strict
|
|
|
|
//
|
|
// START Inputs ...
|
|
//
|
|
|
|
input group "Commons";
|
|
|
|
//
|
|
// END Inputs ...
|
|
//
|
|
|
|
//
|
|
// START Including Providers ...
|
|
//
|
|
|
|
//
|
|
// Logger Library ...
|
|
#include "..\Libraries\x-saherelm.log.lib.mq5";
|
|
|
|
//
|
|
// Common Library ...
|
|
#include "..\Libraries\x-saherelm.common.lib.mq5";
|
|
|
|
//
|
|
// Alert Library ...
|
|
#include "..\Libraries\x-saherelm.alert.lib.mq5";
|
|
|
|
//
|
|
// Draw Library ...
|
|
#include "..\Libraries\x-saherelm.draw.lib.mq5";
|
|
|
|
// //
|
|
// // XTM Signal Provider ...
|
|
// #include "..\Libraries\x-saherelm.xtm.provider.lib.mq5";
|
|
|
|
// //
|
|
// // XTD Signal Provider ...
|
|
// #include "..\Libraries\x-saherelm.xtd.provider.lib.mq5";
|
|
|
|
//
|
|
// XCHMA Signal Provider ...
|
|
#include "..\Libraries\x-saherelm.xchma.provider.lib.mq5";
|
|
|
|
//
|
|
// END Including Providers ...
|
|
//
|
|
|
|
//
|
|
// START Global Definitions: Variables, Properties and etc ...
|
|
//
|
|
|
|
//
|
|
// END Global Definitions: Variables, Properties and etc ...
|
|
//
|
|
|
|
//
|
|
// START Event Handlers ...
|
|
//
|
|
|
|
//
|
|
// Initialization ...
|
|
int OnInit()
|
|
{
|
|
//
|
|
logTag = "XEA";
|
|
drawPrefix = logTag;
|
|
alertPrefix = logTag;
|
|
|
|
//
|
|
// Validate Inputs ...
|
|
if (!ValidateInputs())
|
|
{
|
|
return INIT_PARAMETERS_INCORRECT;
|
|
}
|
|
|
|
// //
|
|
// // Initialize XTM Provider ...
|
|
// if (!XTMInitSignalProviderLibrary())
|
|
// {
|
|
// return INIT_PARAMETERS_INCORRECT;
|
|
// }
|
|
|
|
// //
|
|
// // Initialize XTD Provider ...
|
|
// if (!XTDInitSignalProviderLibrary())
|
|
// {
|
|
// return INIT_PARAMETERS_INCORRECT;
|
|
// }
|
|
|
|
//
|
|
// Initialize XCHMA Provider ...
|
|
if (!XCHMAInitSignalProviderLibrary())
|
|
{
|
|
return INIT_PARAMETERS_INCORRECT;
|
|
}
|
|
|
|
//
|
|
// Apply default Chart Style for EA ...
|
|
ApplyChartStyle();
|
|
|
|
//
|
|
// Init Succeed ...
|
|
return INIT_SUCCEEDED;
|
|
}
|
|
|
|
//
|
|
// DeInitialization ...
|
|
void OnDeinit(const int reason)
|
|
{
|
|
//
|
|
// REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function
|
|
// REASON_REMOVE 1 Program removed from a chart
|
|
// REASON_RECOMPILE 2 Program recompiled
|
|
// REASON_CHARTCHANGE 3 A symbol or a chart period is changed
|
|
// REASON_CHARTCLOSE 4 Chart closed
|
|
// REASON_PARAMETERS 5 Inputs changed by a user
|
|
// REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings
|
|
// REASON_TEMPLATE 7 Another chart template applied
|
|
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
|
|
// REASON_CLOSE 9 Terminal closed
|
|
|
|
//
|
|
// Here we can handle De Initialization Reasons ...
|
|
|
|
// //
|
|
// // De Initialize XTM Provider ...
|
|
// XTMDeinitSignalProviderLibrary(reason);
|
|
|
|
// //
|
|
// // De Initialize XTD Provider ...
|
|
// XTDDeinitSignalProviderLibrary(reason);
|
|
|
|
//
|
|
// De Initialize XCHMA Provider ...
|
|
XCHMADeinitSignalProviderLibrary(reason);
|
|
|
|
//
|
|
// De Init XDraw Library ...
|
|
OnDeinitDrawLibrary();
|
|
}
|
|
|
|
//
|
|
// On Tick Handler ...
|
|
void OnTick()
|
|
{
|
|
//
|
|
if (!IsNewCandle())
|
|
{
|
|
return;
|
|
}
|
|
|
|
// //
|
|
// // Handle Processing on XTM Signal Provider ...
|
|
// XTMSignalProviderHandleTick();
|
|
|
|
// //
|
|
// // Handle Processing on XTD Signal Provider ...
|
|
// XTDSignalProviderHandleTick();
|
|
|
|
//
|
|
// Handle Processing on XCHMA Signal Provider ...
|
|
XCHMASignalProviderHandleTick();
|
|
}
|
|
|
|
//
|
|
// END Event Handlers ...
|
|
//
|
|
|
|
//
|
|
// START Functions ...
|
|
//
|
|
|
|
//
|
|
// Validate Input Args for Initialization ...
|
|
bool ValidateInputs()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Validate Args ...
|
|
|
|
// //
|
|
// // Validate XTM Provider Inputs ...
|
|
// result = XTMValidateInputs();
|
|
// if (!result) {
|
|
// return false;
|
|
// }
|
|
|
|
// //
|
|
// // Validate XTD Provider Inputs ...
|
|
// result = XTDValidateInputs();
|
|
// if (!result) {
|
|
// return false;
|
|
// }
|
|
|
|
//
|
|
// Validate XCHMA Provider Inputs ...
|
|
result = XCHMAValidateInputs();
|
|
if (!result) {
|
|
return false;
|
|
}
|
|
|
|
//
|
|
// Logging State ...
|
|
string message = "Validation of (" + "XEA" + ") Inputs " + (result ? "Succeeded" : "Failed") + " ...";
|
|
LogMessage(message);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// END Functions ...
|
|
//
|