/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Class Library // ---------------------------------------------- // Name: XSCSupRes // Description: provides all Support and Resistances 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 "../Classes/x-saherelm.base.class.mq5" #include "../Helpers/x-saherelm.xpv.helper.mq5" #include "../Libraries/x-saherelm.draw.lib.mq5" // // Definitions ... struct XSCSupResInput { // // Props ... // int numberOfSupports; // Number of Required Supports int numberOfResistances; // Number of Required Resistances // int pivotsVerifications; // Pivots Verifications // double distance; // Distance between Pivots // double price; // Price for Support and Resistance Finding // color clrSupport; color clrResistance; // // Constructor ... void XSCSupResInput() { Clean(); } // // Tools ... // // Cleanup ... void Clean() { // numberOfSupports = 0; numberOfResistances = 0; // price = 0; distance = 0; pivotsVerifications = 0; // clrSupport = CLR_NONE; clrResistance = CLR_NONE; } // // Defualt Configs ... void Default() { // numberOfSupports = 5; numberOfResistances = 5; // price = 0; distance = 10; pivotsVerifications = 35; // clrSupport = clrAqua; clrResistance = clrMagenta; } // // Validate ... bool IsValid() { // bool result = false; // result = // price > 0 && distance >= 0 && numberOfSupports > 0 && numberOfResistances > 0 && pivotsVerifications > 2 // ; // return result; } }; // // Class ... // class XSCSupRes : public XSCBase { // // Public ... public: // // Props ... // // Constructor ... void XSCSupRes( string symbol, ENUM_TIMEFRAMES period // ) : XSCBase() { // mSymbol = symbol; mPeriod = period; } // // Deconstructor ... void ~XSCSupRes() {} // // Initializer ... bool Init(XSCSupResInput &inputs) { // bool result = false; // result = inputs.IsValid(); if (!result) { return result; } // mInputs = inputs; // // Find Pivots ... result = FindPivots(); if (!result) { return result; } // return result; } // // Getter(s) / Setter(s) ... // string GetSymbol() { return mSymbol; } // ENUM_TIMEFRAMES GetPeriod() { return mPeriod; } // XSCSupResInput GetInputs() { return mInputs; } // bool SetInputs(XSCSupResInput &inputs) { return Init(inputs); } // // Overrides ... // string GetTag() override { return "XSupRes"; } // // Tools ... // // Validate ... bool IsValid() { // bool result = false; // result = // false // ; // return result; } // // Retrieve Title Prefix ... string GetIdentifier() { // string result = NULL; // if (!IsValid()) { return result; } // result = GetTag() + "_" + mSymbol + "_" + ToString(mPeriod) + "_"; // return result; } // // Protected ... protected: // // Tools ... // // Private ... private: // // Props ... // string mSymbol; // Trading Symbol ... ENUM_TIMEFRAMES mPeriod; // Trading Period ... // XSCSupResInput mInputs; // Configs ... // double mSupports[]; double mResistances[]; // // Tools ... // bool FindPivots(int barIndex = 0) { // bool result = false; // int totalBars = iBars( mSymbol, mPeriod // ); // result = barIndex >= 0 && barIndex < totalBars - mInputs.pivotsVerifications; if (!result) { return result; } // int next = barIndex + 1; bool canNext = next >= 0 && next < totalBars - mInputs.pivotsVerifications; // XSCXPVHelper helper = new XSCXPVHelper(); XPVInputs pvInputs; pvInputs.Default(); result = helper.Init( mSymbol, mPeriod, pvInputs // ); if (!result) { return result; } // // TODO: Complete this ... // // Check States ... // return result; } }; //