/////////////////////////////////////////////////////// // // 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 // #define ShortName "X121EA" // #include "../Classes/x-saherelm.x121.xea.class.mq5" // // "EURUSDb,USDCHFb,USDJPYb,XAUUSDb" // // Inputs ... long x121EAMagicNumber = 78692110; // Magic Number int x121EASlippage = 10; // Slippgae string x121EASymbols = "EURUSDb"; // Symbols // bool x121EAAllowLong = true; // Allow Long Trades bool x121EAAllowShort = true; // Allow Short Trades int x121EAManageInterval = 5; // Manager Check Intervals Seconds int x121EAMaxAllowedPositions = 0; // Max Allowed Positions double x121EAMaxAllowedSpread = 0; // Max Allowed Spred for Opening Trades double x121EAMinProfitPerTrade = 0; // Min Profit Per Trade based On Volume Factor (Hedge) double x121EAMinProfitPerVolumeFactor = 0; // Min Volume Factor for Calculating Profit (Hedge) double x121EAMaxAllowedDrawdownFactor = 0; // Max Allowed Drawdown Factor // double x121EAVolume = 0.01; // // Vars ... string x121EASymbol; ENUM_TIMEFRAMES x121EAPeriod; // MqlTick x121EATick; // // X121EA ... XSCX121EA *mX121EA; // // Event Handlers ... // // Initialization ... int OnInit() { // if (x121EASymbol == NULL || StringLen(x121EASymbol) <= 0) { x121EASymbol = _Symbol; } // if (x121EAPeriod == NULL) { x121EAPeriod = _Period; } // // Validate Inputs ... if (!X121EAValidateInputs()) { return INIT_PARAMETERS_INCORRECT; } // // Initial EA ... if (!InitialEA()) { return INIT_PARAMETERS_INCORRECT; } // // TesterHideIndicators(true); // // 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 X121EA Providers ... } // // On Tick Handler ... void OnTick() { // // Reading Tick ... if (!SymbolInfoTick(x121EASymbol, x121EATick)) { return; } // mX121EA.OnTick(); } // // Custom Functions ... // // Validate Variables nd Inputs ... bool X121EAValidateInputs() { // bool result = false; // result = // x121EASlippage > 0 && x121EAMagicNumber > 0 // ; // return result; } // // Initialize Specific Providers ... bool InitialEA() { // bool result = false; // // Here We Have to Initial 4 instance of X5Provider ... // - EURUSD/M5; // - USDCHF/M5; // - USDJPY/M5; // - XAUUSD/M5; // result = IsValid(x121EASymbols); if (!result) { return result; } // string symbols[]; int symbolsCount = SplitContent( symbols, x121EASymbols); result = symbolsCount > 0; if (!result) { return result; } // // Define Signallers ... ENUM_X121_SIGNAL_PROVIDERS signallers[]; GetAllX121SignalProviders(signallers); // // Instantiate X121EA Class ... mX121EA = new XSCX121EA( x121EASlippage, // Slippgae x121EAMagicNumber, // Magic Number x121EAManageInterval, // Manager Check Intervals Seconds x121EAMaxAllowedSpread, // Max Allowed Spred for Opening Trades x121EAMaxAllowedPositions, // Max Allowed Positions x121EAMaxAllowedDrawdownFactor, // Max Allowed Drawdown Factor x121EAAllowLong, // Allow Long Trades x121EAAllowShort, // Allow Short Trades x121EAMinProfitPerTrade, // Min Profit Per Trade based On Volume Factor (Hedge) x121EAMinProfitPerVolumeFactor // Min Volume Factor for Calculating Profit (Hedge) ); // // Prepare Providers and Add them into mX121EA class ... for (int i = 0; i < symbolsCount; i++) { // // Requirements ... string iSymbol = symbols[i]; ENUM_TIMEFRAMES iPeriod = PERIOD_M5; // // Define Structure ... X121ProviderDescriptor iDescriptor; // iDescriptor.symbol = iSymbol; iDescriptor.period = iPeriod; iDescriptor.allowLong = x121EAAllowLong; iDescriptor.allowShort = x121EAAllowShort; Copy( signallers, iDescriptor.signallers); // // Set Inputs to Default ... iDescriptor.inputs.Default(); // // Prepare Input Requirements ... // // XMC ... iDescriptor.inputs.mcInputs.showFastMa = true; iDescriptor.inputs.mcInputs.showSlowMa = true; iDescriptor.inputs.mcInputs.showVerifierMa = true; // // XICH ... iDescriptor.inputs.ichInputs.showKumo = false; iDescriptor.inputs.ichInputs.showKijunSen = false; iDescriptor.inputs.ichInputs.showTenkanSen = false; iDescriptor.inputs.ichInputs.showChikouSpan = false; iDescriptor.inputs.ichInputs.showSenkouSpanA = false; iDescriptor.inputs.ichInputs.showSenkouSpanB = false; iDescriptor.inputs.ichInputs.showKijunSenPlus = false; iDescriptor.inputs.ichInputs.showKijunSenNegative = false; // // XCHE ... iDescriptor.inputs.cheInputs.showLongExit1Line = true; iDescriptor.inputs.cheInputs.showShortExit1Line = true; iDescriptor.inputs.cheInputs.showLongExit2Line = true; iDescriptor.inputs.cheInputs.showShortExit2Line = true; // // XPV ... iDescriptor.inputs.pvInputs.showPeaksAndVales = true; iDescriptor.inputs.pvInputs.showLevels = false; iDescriptor.inputs.pvInputs.showConsolidations = false; iDescriptor.inputs.pvInputs.showFibo1Levels = false; iDescriptor.inputs.pvInputs.showFibo2Levels = false; iDescriptor.inputs.pvInputs.showFibo3Levels = true; iDescriptor.inputs.pvInputs.showFibo4Levels = false; iDescriptor.inputs.pvInputs.showFibo5Levels = false; // // XZG ... iDescriptor.inputs.zgInputs.showZigZag = false; iDescriptor.inputs.zgInputs.showPeaksAndVales = true; // // XDON ... iDescriptor.inputs.donInputs.showOpen = false; iDescriptor.inputs.donInputs.showHigh = false; iDescriptor.inputs.donInputs.showClose = false; iDescriptor.inputs.donInputs.showLow = false; // // XSTR ... iDescriptor.inputs.strInputs.showTrends = true; iDescriptor.inputs.strInputs.fillTrends = false; // iDescriptor.inputs.symbol = iSymbol; iDescriptor.inputs.period = iPeriod; // // Short MArket ... iDescriptor.inputs.sMarketPeriod = NULL; iDescriptor.inputs.sMarketMethod = X_PERIOD_AUTO; // // Medium Market ... iDescriptor.inputs.mMarketPeriod = NULL; iDescriptor.inputs.mMarketMethod = X_PERIOD_AUTO; // // Long Market ... iDescriptor.inputs.lMarketPeriod = NULL; iDescriptor.inputs.lMarketMethod = X_PERIOD_AUTO; // int fontSize = 12; double fontAngel = 90; string fontName = "Arial"; ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER; //false // Hind Market ... iDescriptor.inputs.hMarketPeriod = NULL; iDescriptor.inputs.hMarketMethod = X_PERIOD_AUTO; iDescriptor.inputs.hMarketInputs.drawLabels = false; iDescriptor.inputs.hMarketInputs.drawCBar = false; iDescriptor.inputs.hMarketInputs.drawPBar = false; iDescriptor.inputs.hMarketInputs.drawCBarMid = false; iDescriptor.inputs.hMarketInputs.drawPBarMid = false; iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.Default(); iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.Default(); // iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.openStyle.Label( "C Hind Open", iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.openStyle.clr, fontName, fontSize, fontAnchor, fontAngel // ); iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.highStyle.Label( "C Hind High", iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.highStyle.clr, fontName, fontSize, fontAnchor, fontAngel // ); iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.closeStyle.Label( "C Hind Close", iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.closeStyle.clr, fontName, fontSize, fontAnchor, fontAngel // ); iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.lowStyle.Label( "C Hind Low", iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.lowStyle.clr, fontName, fontSize, fontAnchor, fontAngel // ); // iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.openStyle.Label( "P Hind Open", iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.openStyle.clr, fontName, fontSize, fontAnchor, fontAngel // ); iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.highStyle.Label( "P Hind High", iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.highStyle.clr, fontName, fontSize, fontAnchor, fontAngel // ); iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.closeStyle.Label( "P Hind Close", iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.closeStyle.clr, fontName, fontSize, fontAnchor, fontAngel // ); iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.lowStyle.Label( "P Hind Low", iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.lowStyle.clr, fontName, fontSize, fontAnchor, fontAngel // ); iDescriptor.inputs.hMarketInputs.cBarMidDrawSpecs.clr = clrYellow; iDescriptor.inputs.hMarketInputs.cBarMidDrawSpecs.Label( "C Hind Mid", clrYellow, fontName, fontSize, fontAnchor, fontAngel // ); iDescriptor.inputs.hMarketInputs.pBarMidDrawSpecs.clr = clrYellow; iDescriptor.inputs.hMarketInputs.pBarMidDrawSpecs.Label( "P Hind Mid", clrYellow, fontName, fontSize, fontAnchor, fontAngel // ); // // Init Inputs ... result = iDescriptor.inputs.Init(); if (!result) { return result; } // // Validate Inputs ... bool isInputsValid = iDescriptor.inputs.IsValid(); if (!isInputsValid) { continue; } // result = mX121EA.AddProvider(iDescriptor); if (!result) { break; } } // return result; } //