last works ...

This commit is contained in:
2024-06-12 06:02:38 +03:30
parent aaf55da2de
commit 6da0c05cdf
15 changed files with 1042 additions and 1968 deletions
+214
View File
@@ -0,0 +1,214 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center X121EA MQL5 Expert Advisor
// -------------------------------------------------
// Name: X121EA
// 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 X121EA"
#property strict
//
// Imports ...
#include "../Classes/x-saherelm.x121.setup.xea.mq5"
//
#define ShortName "X121EA"
//
// Inputs ...
//
// Common ...
long x121EAMagicNumber = 78692110; // Magic Number
int x121EASlippage = 10; // Slippgae
//
// Trading Symbols ...
string x121EASymbols = "EURUSDb,GBPUSDb,XAUUSDb,USDCHFb"; // Symbols
//
// Signals ...
bool x121EAAllowLong = true; // Allow Long Trades
bool x121EAAllowShort = true; // Allow Short Trades
int x121EAReuiredSignalVerifications = 2; // Required Verifications for Signals
//
// Risk Management ...
double x121EAVolume = 0.01; // Static Volume
double x121EATPPoint = 30; // TP Point
double x121EASLPoint = 300; // SL Point
bool x121EAIgnoreSL = true; // Ignore Calculated SL
bool x121EAIgnoreTP = false; // Ignore Calculated TP
//
// Alert ...
bool x121EAEnableAlerts = true; // Enable Alerts
bool x121EALogAlerts = true; // Log Alerts
bool x121EAMailAlerts = false; // Mail Alerts
bool x121EAPushAlerts = false; // Push Alerts
bool x121EATerminalAlerts = false; // Terminal Alerts
//
// Definitions ...
//
// Local Variables ...
//
XSCX121SetupEA *x121EA;
//
// 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 x121EA;
}
//
// On Tick Handler ...
void OnTick()
{
x121EA.OnTick();
}
//
// Custom Functions ...
//
bool InitialEA()
{
//
bool result = false;
//
TesterHideIndicators(true);
//
result = IsValid(x121EASymbols);
if (!result)
{
return result;
}
//
string symbols[];
int symbolsCount = SplitContent(
symbols,
x121EASymbols //
);
result = symbolsCount > 0;
if (!result)
{
return result;
}
//
x121EA = new XSCX121SetupEA(
x121EASlippage,
x121EAMagicNumber //
);
//
// Configure EA ...
x121EA.Volume(x121EAVolume);
x121EA.TPPoint(x121EATPPoint);
x121EA.SLPoint(x121EASLPoint);
x121EA.IgnoreSL(x121EAIgnoreSL);
x121EA.IgnoreTP(x121EAIgnoreTP);
x121EA.AllowLong(x121EAAllowLong);
x121EA.AllowShort(x121EAAllowShort);
x121EA.ReuiredSignalVerifications(x121EAReuiredSignalVerifications);
//
// Configure Alert ...
x121EA.SetAlertPrefix(ShortName);
x121EA.SetAlertEnableAlerts(x121EAEnableAlerts);
x121EA.SetAlertLogAlerts(x121EALogAlerts);
x121EA.SetAlertMailAlerts(x121EAMailAlerts);
x121EA.SetAlertPushAlerts(x121EAPushAlerts);
x121EA.SetAlertTerminalAlerts(x121EATerminalAlerts);
//
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 = x121EA.AddSetup(iSetupCycle);
if (!result)
{
break;
}
}
//
return result;
}