From 555244a84475bcc837f79d7d7d89819dd01402d8 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Fri, 6 Jun 2025 05:42:15 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.x-alert.class.mq5 | 2 +- Classes/x-saherelm.x-data.collector.class.mq5 | 15 +- .../BKP/tmp.conditionalling.signalling.mq5 | 24 + .../XCATBEAInputs/inputs.config.filepath.txt | 1 + ...relm.xcatb.ea.base.optimization.inputs.set | Bin 9542 -> 9618 bytes .../x-saherelm.common.extensions.lib.mq5 | 67 +- XCATBEA/Classes/xcatbea.expert.class.mq5 | 1306 ++++++++++++++++- .../Classes/xcatbea.x-trade.manager.class.mq5 | 69 +- 8 files changed, 1388 insertions(+), 96 deletions(-) create mode 100644 Documents/XCATBEAInputs/inputs.config.filepath.txt diff --git a/Classes/x-saherelm.x-alert.class.mq5 b/Classes/x-saherelm.x-alert.class.mq5 index 467348fc..914d8bf1 100644 --- a/Classes/x-saherelm.x-alert.class.mq5 +++ b/Classes/x-saherelm.x-alert.class.mq5 @@ -294,7 +294,7 @@ class XCAlert : public XCBase } // - Print(GetPrefix(), " > ", message); + Print(message); } void Log(string tag, string message) { diff --git a/Classes/x-saherelm.x-data.collector.class.mq5 b/Classes/x-saherelm.x-data.collector.class.mq5 index c9027d28..fb45c04c 100644 --- a/Classes/x-saherelm.x-data.collector.class.mq5 +++ b/Classes/x-saherelm.x-data.collector.class.mq5 @@ -59,16 +59,7 @@ class XCDataCollector : public XCBase // void Path(string value) { - // - // Normalizing Collector Path ... - if (IsValid(value)) - { - mPath = value; - } - else - { - mPath = "XDataCollector"; - } + mPath = value; } // @@ -83,7 +74,7 @@ class XCDataCollector : public XCBase // result = // - mPath + "\\" + fileName + ".x121.log" + (IsValid(mPath) ? mPath + "\\" : "") + fileName + ".x121.log" // ; @@ -128,7 +119,7 @@ class XCDataCollector : public XCBase // result = FileOpen( filePath, - FILE_READ | FILE_TXT // + FILE_READ | FILE_TXT | FILE_ANSI // ); // diff --git a/Documents/BKP/tmp.conditionalling.signalling.mq5 b/Documents/BKP/tmp.conditionalling.signalling.mq5 index 1fda2a9b..41babe83 100644 --- a/Documents/BKP/tmp.conditionalling.signalling.mq5 +++ b/Documents/BKP/tmp.conditionalling.signalling.mq5 @@ -1407,3 +1407,27 @@ /////////////////////////////////////////////////////////////////// +template +bool IsBoolean(T value) +{ + // + bool result = false; + + // + string normalizedValue = ToString(value); + StringToLower(normalizedValue); + normalizedValue = Trim(normalizedValue); + + // + result = + !IsValid(normalizedValue) + ? false + : (normalizedValue == "true" || + normalizedValue == "false"); + + // + return result; +} + +/////////////////////////////////////////////////////////////////// + diff --git a/Documents/XCATBEAInputs/inputs.config.filepath.txt b/Documents/XCATBEAInputs/inputs.config.filepath.txt new file mode 100644 index 00000000..34f0b61b --- /dev/null +++ b/Documents/XCATBEAInputs/inputs.config.filepath.txt @@ -0,0 +1 @@ +X121XCATBEA\X121XCATBEA_XAUUSDb_M5.x121.log diff --git a/Documents/XCATBEAInputs/x-saherelm.xcatb.ea.base.optimization.inputs.set b/Documents/XCATBEAInputs/x-saherelm.xcatb.ea.base.optimization.inputs.set index 666d2441fe119d1eb5e78c842e29dba8622abab9..fff3ec2bac42c39232cf78b288a3a2a8f832a919 100644 GIT binary patch delta 52 zcmX@+HOYH|marLv0)qjA5rY+jA%g{&wA^SLFFe^zG;H$+;Rx=@0xBGvS>*ZHCV!JR F0su!C4GI7N delta 48 zcmbQ_eavfumaqwf0)r8Q0fQBT34<|^G-WW^Xd5p)`I@xT<_E%A+?%J#pJJUXBWwZy DB|8lx diff --git a/Libraries/x-saherelm.common.extensions.lib.mq5 b/Libraries/x-saherelm.common.extensions.lib.mq5 index 1fa8f880..50719e6e 100644 --- a/Libraries/x-saherelm.common.extensions.lib.mq5 +++ b/Libraries/x-saherelm.common.extensions.lib.mq5 @@ -1857,28 +1857,6 @@ string Trim(string value) return result; } -template -bool IsBoolean(T value) -{ - // - bool result = false; - - // - string normalizedValue = ToString(value); - StringToLower(normalizedValue); - normalizedValue = Trim(normalizedValue); - - // - result = - !IsValid(normalizedValue) - ? false - : (normalizedValue == "true" || - normalizedValue == "false"); - - // - return result; -} - // // Used In Report or Summary Generators ... string ToString( @@ -1894,7 +1872,7 @@ string ToString( // bool canSet = - IsBoolean(value) + IsBoolean(ToString(value)) ? (bool)value || !ignoreFalseConditions : true; @@ -2023,6 +2001,35 @@ string ToString( return result; } +/** + * Check a String Value is Boolean or Not ... + * + * @param value: string representation of value ... + * + * @return ( bool ) + */ +bool IsBoolean(string value) +{ + // + bool result = false; + + // + string istring = value; + string normalizedValue = ToString(istring); + StringToLower(normalizedValue); + normalizedValue = Trim(normalizedValue); + + // + result = + !IsValid(normalizedValue) + ? false + : (normalizedValue == "true" || + normalizedValue == "false"); + + // + return result; +} + /** * Converts String to boolean ... * @@ -2036,14 +2043,24 @@ bool ToBoolean(string value) bool result = false; // - if (StringLen(value) <= 0) + if (!IsBoolean(value) || + StringLen(value) <= 0) { return result; } // + value = Trim(value); StringToLower(value); - result = value == "true"; + + // + bool isTrue = value == "true"; + bool isFalse = value == "false"; + + // + result = isTrue + ? true + : false; // return result; diff --git a/XCATBEA/Classes/xcatbea.expert.class.mq5 b/XCATBEA/Classes/xcatbea.expert.class.mq5 index 9677582c..ac4e0f7c 100644 --- a/XCATBEA/Classes/xcatbea.expert.class.mq5 +++ b/XCATBEA/Classes/xcatbea.expert.class.mq5 @@ -30,9 +30,1238 @@ // // Definitions ... +#define XCATBEA_INPUTS_PREFIX "X121XCATBEA" // // Implementation ... + +// +class XCXCATBEASignallerInputParser : public XCBase +{ + // + // Public ... + public: + // + + // + // Constructor(s) ... + XCXCATBEASignallerInputParser( + XCAlert *_alert // + ) + { + // + alert = _alert; + + // + // Instantiate Data Collector ... + collector = new XCDataCollector(); + + // + // Generate Path and Attached to Data Collector ... + // string mPath = alert.GetPrefix(); + collector.Path(""); + } + + // + // Deconstructor ... + ~XCXCATBEASignallerInputParser() + { + // + delete collector; + ZeroMemory(collector); + } + + // + // Tools and Actions ... + + /** + * Retrieve Specified Symbol / Period Signaller Inputs ... + * + * @param symbol: string, Specified Signaller Symbol ... + * @param period: ENUM_TIMEFRAMES member, Specified Signaller Period ... + * + * @return ( bool ) + */ + string GetFileName( + string symbol, + ENUM_TIMEFRAMES period // + ) + { + // + string result = NULL; + + // + // Validate Args ... + if (!IsValid(symbol) || + !IsValid(period)) + { + return result; + } + + // + result = XCATBEA_INPUTS_PREFIX + "_" + symbol + "_" + ToString(period); + result = collector.GetFilePath(result); + + // + return result; + } + + /** + * Check Specified Symbol / Period Signaller Inputs File Exists ... + * + * @param symbol: string, Specified Signaller Symbol ... + * @param period: ENUM_TIMEFRAMES member, Specified Signaller Period ... + * + * @return ( bool ) + */ + bool IsSignallerInputsFileExists( + string symbol, + ENUM_TIMEFRAMES period // + ) + { + // + bool result = false; + + // + string fileName = GetFileName( + symbol, + period // + ); + result = IsValid(fileName); + if (!result) + { + return result; + } + + // + result = collector.IsExists(fileName); + if (!result) + { + return result; + } + + // + return result; + } + + /** + * Parse Specified Symbol / Period Signaller Inputs file ... + * + * @param inputs: XCATBEASignallerInputs instance reference, To Fill Loaded Configs ... + * @param symbol: string, Specified Signaller Symbol ... + * @param period: ENUM_TIMEFRAMES member, Specified Signaller Period ... + * + * @return ( bool ) + */ + bool ParseSignallerInputs( + XCATBEASignallerInputs &inputs, + string symbol, + ENUM_TIMEFRAMES period // + ) + { + // + bool result = false; + + // + // Validate Args ... + result = + IsValid(symbol) && + IsValid(period); + if (!result) + { + return result; + } + + // + inputs.symbol = symbol; + inputs.period = period; + + // + // Prepare File Name and Check File Exists ... + string fileName = GetFileName(symbol, period); + result = collector.IsExists(fileName); + if (!result) + { + return result; + } + + // + // Read Content ... + string content[]; + result = collector.Read(fileName, content); + if (!result) + { + return result; + } + + // + // Try to Parse Content ... + result = HasChild(content); + if (result) + { + // + int count = ArraySize(content); + for (int i = 0; i < count; i++) + { + // + string iLine = content[i]; + + // + Parse(iLine, inputs); + } + } + + // + return result; + } + + // + // Protected ... + protected: + // + + // + // Private ... + private: + // + // Props ... + XCAlert *alert; + XCDataCollector *collector; + + /** + * Parse Condition and Attached to related Properties if Exists ... + */ + void Parse( + string line, + XCATBEASignallerInputs &inputs // + ) + { + // + string parts[]; + bool has = false; + int partsCount = 0; + + // + // Validations ... + + // + // eaForceHasSwing ... + has = Contains( + "eaForceHasSwing", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.validations.forceHasSwing = has; + } + } + } + + // + // eaForceOBBarType ... + has = Contains( + "eaForceOBBarType", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.validations.forceOBBarType = has; + } + } + } + + // + // eaForceFVGBarType ... + has = Contains( + "eaForceFVGBarType", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.validations.forceFVGBarType = has; + } + } + } + + // + // eaForceHasFLiquidity ... + has = Contains( + "eaForceHasFLiquidity", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.validations.forceHasFLiquidity = has; + } + } + } + + // + // eaForceHasRLiquidity ... + has = Contains( + "eaForceHasRLiquidity", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.validations.forceHasRLiquidity = has; + } + } + } + + // + // eaValidateGapSequence ... + has = Contains( + "eaValidateGapSequence", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.validations.validateGapSequence = has; + } + } + } + + // + // eaValidateBlockEdgeBreakout ... + has = Contains( + "eaValidateBlockEdgeBreakout", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.validations.validateBlockEdgeBreakout = has; + } + } + } + + // + // Filters ... + + // + // eaFilterBasedOnKI ... + has = Contains( + "eaFilterBasedOnKI", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnKI = has; + } + } + } + + // + // eaFilterBasedOnPV ... + has = Contains( + "eaFilterBasedOnPV", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnPV = has; + } + } + } + + // + // eaFilterBasedOnSar ... + has = Contains( + "eaFilterBasedOnSar", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnSar = has; + } + } + } + + // + // eaForceSarSwitched ... + has = Contains( + "eaForceSarSwitched", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceSarSwitched = has; + } + } + } + + // + // eaForceSarOnBothSide ... + has = Contains( + "eaForceSarOnBothSide", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceSarOnBothSide = has; + } + } + } + + // + // eaForceSarHasBreakout ... + has = Contains( + "eaForceSarHasBreakout", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceSarHasBreakout = has; + } + } + } + + // + // eaForceSarHasReversalSide ... + has = Contains( + "eaForceSarHasReversalSide", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceSarHasReversalSide = has; + } + } + } + + // + // eaFilterBasedOnRSI ... + has = Contains( + "eaFilterBasedOnRSI", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnRSI = has; + } + } + } + + // + // eaForceHasRSITrending ... + has = Contains( + "eaForceHasRSITrending", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasRSITrending = has; + } + } + } + + // + // eaForceHasRSIVPattern ... + has = Contains( + "eaForceHasRSIVPattern", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasRSIVPattern = has; + } + } + } + + // + // eaForceHasRSICrossing ... + has = Contains( + "eaForceHasRSICrossing", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasRSICrossing = has; + } + } + } + + // + // eaFilterBasedOnADX ... + has = Contains( + "eaFilterBasedOnADX", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnADX = has; + } + } + } + + // + // eaForceHasADXTrending ... + has = Contains( + "eaForceHasADXTrending", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasADXTrending = has; + } + } + } + + // + // eaForceHasADXCrossing ... + has = Contains( + "eaForceHasADXCrossing", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasADXCrossing = has; + } + } + } + + // + // eaFilterBasedOnATR ... + has = Contains( + "eaFilterBasedOnATR", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnATR = has; + } + } + } + + // + // eaForceHasATRTrending ... + has = Contains( + "eaForceHasATRTrending", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasATRTrending = has; + } + } + } + + // + // eaForceHasATRBreakout ... + has = Contains( + "eaForceHasATRBreakout", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasATRBreakout = has; + } + } + } + + // + // eaFilterBasedOnTrend ... + has = Contains( + "eaFilterBasedOnTrend", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnTrend = has; + } + } + } + + // + // eaForceHasTrendDir ... + has = Contains( + "eaForceHasTrendDir", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasTrendDir = has; + } + } + } + + // + // eaForceHasTrendPlace ... + has = Contains( + "eaForceHasTrendPlace", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasTrendPlace = has; + } + } + } + + // + // eaForceHasTrendChange ... + has = Contains( + "eaForceHasTrendChange", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasTrendChange = has; + } + } + } + + // + // eaForceHasTrendTrending ... + has = Contains( + "eaForceHasTrendTrending", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasTrendTrending = has; + } + } + } + + // + // eaForceHasTrendRejection ... + has = Contains( + "eaForceHasTrendRejection", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasTrendRejection = has; + } + } + } + + // + // eaForceHasTrendLineInside ... + has = Contains( + "eaForceHasTrendLineInside", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasTrendLineInside = has; + } + } + } + + // + // eaForceHasTrendDirOnBothSide ... + has = Contains( + "eaForceHasTrendDirOnBothSide", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.forceHasTrendDirOnBothSide = has; + } + } + } + + // + // eaFilterBasedOnDelta ... + has = Contains( + "eaFilterBasedOnDelta", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnDelta = has; + } + } + } + + // + // eaFilterBasedOnVolume ... + has = Contains( + "eaFilterBasedOnVolume", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnVolume = has; + } + } + } + + // + // eaFilterBasedOnSignalBar ... + has = Contains( + "eaFilterBasedOnSignalBar", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnSignalBar = has; + } + } + } + + // + // eaFilterBasedOnHKSignalBar ... + has = Contains( + "eaFilterBasedOnHKSignalBar", + line, + false // + ); + if (has) + { + // + // Split Content ... + partsCount = SplitContent( + parts, + line, + ":" // + ); + has = partsCount == 2; + if (has) + { + // + has = ToBoolean(parts[1]); + if (has) + { + inputs.filters.filterBasedOnHKSignalBar = has; + } + } + } + + // + } + + // +}; + +// class XCXCATBEAExpert : public XCBase { // @@ -174,14 +1403,15 @@ class XCXCATBEAExpert : public XCBase // Requirements ... // - XCAlert *eaAlert; // EA Scope Alert Handler ... - XCTrade *eaTrade; // EA Scope Trade Handler ... - XCGuard *eaGuard; // EA Scope Guard Handler ... - XCVolume *eaVolume; // EA Scope Voluem Handler ... - XTimeTracker eaTimeTracker; // EA Scope Time Tracker ... - XCDataCollector *eaCollector; // EA Scope Data Collector ... - XCXCATBEASignaller *eaSignallers[]; // EA Signallers Collection ... - XCXCATBEATradeManager *eaTradeManager; // EA Scope Trade Manager ... + XCAlert *eaAlert; // EA Scope Alert Handler ... + XCTrade *eaTrade; // EA Scope Trade Handler ... + XCGuard *eaGuard; // EA Scope Guard Handler ... + XCVolume *eaVolume; // EA Scope Voluem Handler ... + XTimeTracker eaTimeTracker; // EA Scope Time Tracker ... + XCDataCollector *eaCollector; // EA Scope Data Collector ... + XCXCATBEASignaller *eaSignallers[]; // EA Signallers Collection ... + XCXCATBEATradeManager *eaTradeManager; // EA Scope Trade Manager ... + XCXCATBEASignallerInputParser *eaSignallerInputParser; // EA Scope Signaller Input Parser ... // // Tools / Actions / Handlers ... @@ -558,6 +1788,10 @@ class XCXCATBEAExpert : public XCBase string mPath = eaAlert.GetPrefix() + "\\" + "Configs"; eaCollector.Path(mPath); + // + // Instantiating Signaller Input Parser ... + eaSignallerInputParser = new XCXCATBEASignallerInputParser(eaAlert); + // // Initialize Trae Manager ... eaTradeManager = new XCXCATBEATradeManager( @@ -828,7 +2062,16 @@ class XCXCATBEAExpert : public XCBase for (int i = 0; i < symbolsCount; i++) { // + // Attach Symbol ... iSignallerInputs.symbol = symbols[i]; + + // + // Check if Provided Inputs File Exists ... + // if Exists, Load and Parse it ... + LoadConfig(iSignallerInputs); + + // + // Check Inputs Validation ... if (iSignallerInputs.IsValid()) { // @@ -909,6 +2152,10 @@ class XCXCATBEAExpert : public XCBase delete eaCollector; ZeroMemory(eaCollector); + // + delete eaSignallerInputParser; + ZeroMemory(eaSignallerInputParser); + // string message = "DeInitialized Successfully ..."; eaAlert.SendAlert(message); @@ -1660,6 +2907,49 @@ class XCXCATBEAExpert : public XCBase ); } + // + bool LoadConfig(XCATBEASignallerInputs &inputs) + { + // + bool result = false; + + // + // Validate Args ... + result = + IsValid(inputs.period) && + IsValid(inputs.symbol); + if (!result) + { + return result; + } + + // + // Check the Provided File Exists or not ... + result = + eaSignallerInputParser + .IsSignallerInputsFileExists( + inputs.symbol, + inputs.period // + ); + if (!result) + { + return result; + } + + // + // Parse File Content ... + result = + eaSignallerInputParser + .ParseSignallerInputs( + inputs, + inputs.symbol, + inputs.period // + ); + + // + return result; + } + // }; diff --git a/XCATBEA/Classes/xcatbea.x-trade.manager.class.mq5 b/XCATBEA/Classes/xcatbea.x-trade.manager.class.mq5 index 2d25d136..49ceef83 100644 --- a/XCATBEA/Classes/xcatbea.x-trade.manager.class.mq5 +++ b/XCATBEA/Classes/xcatbea.x-trade.manager.class.mq5 @@ -1647,10 +1647,13 @@ class XCXCATBEATradeManager : public XCBase // collector = new XCDataCollector(); - + // // Setting Collector Path ... - string mPath = alert.GetPrefix() + "\\" + trader.mAccount.GetCompany(); + string mPath = (IsValid(alert.GetPrefix()) + ? alert.GetPrefix() + "\\" + : "") + + trader.mAccount.GetCompany(); collector.Path(mPath); } @@ -3066,14 +3069,8 @@ class XCXCATBEATradeManager : public XCBase string result = NULL; // - string mPath = collector.Path(); - - // - result = - // - mPath + "\\" + "Trades" + "\\" + fileName + ".x121.log" - // - ; + result = collector + .GetFilePath("Trades" + "\\" + fileName); // return result; @@ -3086,14 +3083,8 @@ class XCXCATBEATradeManager : public XCBase string result = NULL; // - string mPath = collector.Path(); - - // - result = - // - mPath + "\\" + "Signals" + "\\" + fileName + ".x121.log" - // - ; + result = collector + .GetFilePath("Signals" + "\\" + fileName); // return result; @@ -3106,17 +3097,10 @@ class XCXCATBEATradeManager : public XCBase string result = NULL; // - string mPath = collector.Path(); - - // - result = - // - mPath + "\\" + - "Conditions" + "\\" + - trade.signal.symbol + "\\" + - ToString(trade.signal.period) + "_wins.x121.log" - // - ; + result = collector + .GetFilePath("Conditions" + "\\" + + trade.signal.symbol + "\\" + + ToString(trade.signal.period) + "_wins"); // return result; @@ -3129,17 +3113,10 @@ class XCXCATBEATradeManager : public XCBase string result = NULL; // - string mPath = collector.Path(); - - // - result = - // - mPath + "\\" + - "Conditions" + "\\" + - trade.signal.symbol + "\\" + - ToString(trade.signal.period) + "_losts.x121.log" - // - ; + result = collector + .GetFilePath("Conditions" + "\\" + + trade.signal.symbol + "\\" + + ToString(trade.signal.period) + "_losts"); // return result; @@ -3158,16 +3135,8 @@ class XCXCATBEATradeManager : public XCBase } // - string mPath = collector.Path(); - - // - result = - // - mPath + "\\" + - "Restrictions" + "\\" + - symbol + ".x121.log" - // - ; + result = collector + .GetFilePath("Restrictions" + "\\" + symbol); // return result;