Files
xMQL5/MQLTestWorkspace/BKPS/14030322/Experts/x-test-xxx.mq5
T

185 lines
3.6 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center XTESTXXX MQL5 Expert Advisor
// -------------------------------------------------
// Name: XTESTXXX
// Description: an Exper Advisor which used RSI and MA
// to Analyse Market ...
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////x
//
// Global Properties ...
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://saherelm.ir"
#property version "1.00"
#property description "SaherElm XTESTXXX"
#property strict
//
// Imports ...
#include "../Classes/x-saherelm.x121.setup.xea.mq5"
//
#define ShortName "XTESTXXX"
//
// Inputs ...
//
long eaMagicNumber = 78692110; // Magic Number
int eaSlippage = 10; // Slippgae
//
string eaSymbols = "EURUSDb"; // Symbols
//
bool eaAllowLong = true; // Allow Long Trades
bool eaAllowShort = true; // Allow Short Trades
double eaVolume = 0.05; // Static Volume
int eaReuiredVerifications = 1; // Required Verifications for Signals
//
// Definitions ...
//
// Local Variables ...
//
XSCX121SetupEA *mEA;
//
// Event Handlers ...
//
// Initialization ...
int OnInit()
{
//
drawPrefix = ShortName;
//
if (!InitialEA())
{
return INIT_PARAMETERS_INCORRECT;
}
//
// 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
//
// De Initialize XSampleEA Providers ...
delete mEA;
}
//
// On Tick Handler ...
void OnTick()
{
mEA.OnTick();
}
//
// Custom Functions ...
//
bool InitialEA()
{
//
bool result = false;
//
TesterHideIndicators(true);
//
result = IsValid(eaSymbols);
if (!result)
{
return result;
}
//
string symbols[];
int symbolsCount = SplitContent(
symbols,
eaSymbols //
);
result = symbolsCount > 0;
if (!result)
{
return result;
}
//
mEA = new XSCX121SetupEA(
eaSlippage,
eaMagicNumber //
);
//
// Allow Signals ...
mEA.AllowLong(true);
mEA.AllowShort(true);
//
mEA.SetAlertPrefix(ShortName);
//
X121SetupInputs setupInputsDefault;
setupInputsDefault.Default();
//
// Prepare Providers and Add them into mX121EA class ...
for (int i = 0; i < symbolsCount; i++)
{
//
// Requirements ...
string iSymbol = symbols[i];
ENUM_TIMEFRAMES iHostPeriod = _Period;
//
XSCX121SetupCycles *iSetupCycle;
iSetupCycle = new XSCX121SetupCycles();
result = iSetupCycle.Init(
setupInputsDefault,
iSymbol,
iHostPeriod //
);
if (!result)
{
break;
}
//
result = mEA.AddSetup(iSetupCycle);
if (!result)
{
break;
}
}
//
return result;
}