/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Helper Class Library // ---------------------------------------------- // Name: XCXSTRCCIHelper // Description: provides all Indicator // Helper requirements ... // // // Maintainer: // ------------ // Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) // ////////////////////////////////////////////////////// // // Global Properties ... #property library #property copyright "Copyright 2023, SaherElm IT Center" #property link "https://www.saherelm.ir" #property version "1.00" #property strict // // Imports ... #include "../../Helpers/x-saherelm.x121.xoscs.helper.mq5" #include "../../Helpers/x-saherelm.x121.xstr.helper.mq5" // // Input Structure ... struct XSTRCCIInputs { // bool showAC; bool showAD; bool showADX; bool showATR; bool showCCI; bool showRSI; bool showMFI; bool showRVI; bool showMACD; bool showMomentum; bool showStochastic; // X121XSTRInputs strInputs; X121XOCSInputs oscsInputs; // // Constructor ... XSTRCCIInputs() { Clean(); } // // Tools ... /** * Cleaning Up ... */ void Clean() { // showAC = false; showAD = false; showADX = false; showATR = false; showCCI = false; showRSI = false; showMFI = false; showRVI = false; showMACD = false; showMomentum = false; showStochastic = false; // strInputs.Clean(); oscsInputs.Clean(); // ZeroMemory(this); } /** * Set Default Values ... */ void Default() { // strInputs.Default(); oscsInputs.Default(); } /** * Validate ... * * @return ( bool ) */ bool IsValid() { // bool result = false; // result = // strInputs.IsValid() && oscsInputs.IsValid(); // return result; } /** * Extract Max Input Length ... * * @return ( int ) */ int Max() { // int result = 0; // int strMax = strInputs.Max(); int ocsMax = oscsInputs.Max(); // result = MathMax(strMax, ocsMax); // return result; } }; // // Conditions Structure ... struct XSTRCCIConditions { // // Common ... string symbol; ENUM_TIMEFRAMES period; datetime time; // // XSTR ... double strBuffer[]; double atrBuffer[]; double vidyaBuffer[]; double strUpBuffer[]; double strMidBuffer[]; double strDownBuffer[]; double strPriceBuffer[]; double strStateBuffer[]; double strSMLowBuffer[]; double strSMHighBuffer[]; double strMidStateBuffer[]; // bool isStrBullish; bool isStrBearish; // bool isStrSwitchedToBullish; bool isStrSwitchedToBearish; // // XOCS ... // // Constructor ... XSTRCCIConditions() { Clean(); } // // Tools ... /** * Cleaning Up ... */ void Clean() { // // Commons ... symbol = NULL; period = NULL; time = NULL; // // XSTR ... // Clean(strBuffer); Clean(atrBuffer); Clean(vidyaBuffer); Clean(strUpBuffer); Clean(strMidBuffer); Clean(strDownBuffer); Clean(strPriceBuffer); Clean(strStateBuffer); Clean(strSMLowBuffer); Clean(strSMHighBuffer); Clean(strMidStateBuffer); // ArraySetAsSeries(strBuffer, true); ArraySetAsSeries(atrBuffer, true); ArraySetAsSeries(vidyaBuffer, true); ArraySetAsSeries(strUpBuffer, true); ArraySetAsSeries(strMidBuffer, true); ArraySetAsSeries(strDownBuffer, true); ArraySetAsSeries(strPriceBuffer, true); ArraySetAsSeries(strStateBuffer, true); ArraySetAsSeries(strSMLowBuffer, true); ArraySetAsSeries(strSMHighBuffer, true); ArraySetAsSeries(strMidStateBuffer, true); // // Conditions ... // isStrBullish = false; isStrBearish = false; // isStrSwitchedToBullish = false; isStrSwitchedToBearish = false; // ZeroMemory(this); } /** * Generate Conditions Scores ... * * @param bullishScore: Double, Directional Scores Reference ... * @param bearishScore: Double, Directional Scores Reference ... */ void GenerateScore( double &bullishScore, double &bearishScore // ) { // bullishScore = 0; bearishScore = 0; // double score = 1; double minScore = 0.5; double highScore = 1.5; // // XSTR ... // if (isStrBullish) { bullishScore += minScore; } if (isStrSwitchedToBullish) { bullishScore += score; } // if (isStrBearish) { bearishScore += minScore; } if (isStrSwitchedToBearish) { bearishScore += score; } // // XOCS ... } /** * Generate Summary String for Represent Conditions State ... * * @param onlyCommons: Boolean, Just Generate Only Commons Conditions ... * @param onlyConditions: Boolean, Just Generate Only Conditions ... * @param includeScores: Boolean, Attach Scores Representations on Result ... * @param ignoreFalseConditions: Boolean, Ignore False Conditions on Result ... * @param separator: String, Separate Lines ... * * @return ( string ) */ string GenerateSummary( bool onlyCommons = false, bool onlyConditions = false, bool includeScores = true, bool ignoreFalseConditions = true, string separator = "\n" // ) { // string result = NULL; // double bullishScore = 0; double bearishScore = 0; GenerateScore( bullishScore, bearishScore // ); // string scoresStr = // "Scores: " + separator + "---------------" + separator + "Bullish: " + ToString(bullishScore) + separator + "Bearish: " + ToString(bearishScore) + separator + "" // ; // string commonStr = GenerateSpecifiedCommonSummary( this, separator, includeScores // ); // string conditionsStr = // "-----------------------" + separator + "XSTR: " + separator + "-----------------------" + separator + ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) + ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) + ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) + "-----------------------" + separator + "XOCS: " + separator + "-----------------------" + separator + // "" // ; // result = // "[" + GetTag() + "]" + separator + (onlyConditions ? "" : commonStr) + (!includeScores ? "" : scoresStr) + " " + separator + (onlyCommons ? "" : conditionsStr) + "" // ; // return result; } /** * Retrieve nique Tag Identifier ... * * @return ( string ) */ string GetTag() { return GetTypeName(this); } }; // // Helper Class Implementation ... class XCXSTRCCIHelper : XCBase { // // Public ... public: // // Props ... XCX121XSTRHelper *strHelper; XCX121XOCSHelper *ocsHelper; // // Constructor ... XCXSTRCCIHelper() { } // // Deconstructor ... ~XCXSTRCCIHelper() { } // // Protected ... protected: // // Private ... private: // // Props ... // string mSymbol; // Trading Symbol ENUM_TIMEFRAMES mPeriod; // Trading Period // // Inputs ... XSTRCCIInputs mInputs; // // Handlers ... int acHandler; int adHandler; int adxHandler; int atrHandler; int cciHandler; int rsiHandler; int mfiHandler; int rviHandler; int macdHandler; int momentumHandler; int stochasticHandler; }; //