From 065700550dfd67fb84216adb4a239e92b4d6811e Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 30 May 2024 13:28:34 +0330 Subject: [PATCH] last uncompleted works on xind class ... --- Classes/Indicators/x-saherelm.mid.class.mq5 | 50 ++------------------ Classes/x-saherelm.xind.class.mq5 | 51 --------------------- Indicators/x-saherelm.xmidtest.mq5 | 18 ++++---- 3 files changed, 15 insertions(+), 104 deletions(-) diff --git a/Classes/Indicators/x-saherelm.mid.class.mq5 b/Classes/Indicators/x-saherelm.mid.class.mq5 index 5a32bc2a..0d94a91f 100644 --- a/Classes/Indicators/x-saherelm.mid.class.mq5 +++ b/Classes/Indicators/x-saherelm.mid.class.mq5 @@ -284,28 +284,14 @@ public: int mainIDX = GetBufferIndex("XSCMid"); // - int start = 0; - - // // - // if (prevCalculated == 0) - // { - // // - // if (max > 0) - // { - // for (int i = 0; i < max; i++) - // { - // // - // for (int j = 0; j < CountBuffers(); j++) - // { - // mBuffers[j].Add(0); - // } - // } - // } - // } + int start = prevCalculated; + if (start == totalBars) { + start-=1; + } // // Loop through Bars ... - for (int i = start; i < limit && !IsStopped(); i++) + for (int i = start; i < totalBars - 1 && !IsStopped(); i++) { // // XOHCL iBar; @@ -331,32 +317,6 @@ public: } } - // for (int i = totalBars - 1; i >= start && !IsStopped(); i--) - // { - // // - // XOHCL iBar; - // iBar.Init( - // mSymbol, - // mPeriod, - // i // - // ); - - // // - // double iValue = iBar.close; - - // // - // // Print("BarIndex: " + ToString(i), ", iValue: ", iValue); - - // // - // if (i > ArraySize(mBuffers[mainIDX].values) - 1) - // { - // ArrayResize(mBuffers[mainIDX].values, i + 1); - // } - - // // - // mBuffers[mainIDX].values[i] = iValue; - // } - // // Prevent Double Calculation Same Bars ... mCalculatedBars = totalBars; diff --git a/Classes/x-saherelm.xind.class.mq5 b/Classes/x-saherelm.xind.class.mq5 index 44f98e4c..6bfe4adb 100644 --- a/Classes/x-saherelm.xind.class.mq5 +++ b/Classes/x-saherelm.xind.class.mq5 @@ -578,57 +578,6 @@ public: return result; } - // - // int CopyBuffer( - // string mTitle, // Required Buffer Title - // double &buffer[], // Buffer Dest - // int start = 0, // Start - // int count = 0 // Count, if 0 Whole - // ) - // { - // // - // int result = 0; - - // // - // // Validate State ... - // if (!IsValid()) - // { - // return result; - // } - - // // - // // Clean(buffer); - - // // - // int bufferIDX = GetBufferIndex(mTitle); - // if (bufferIDX < 0) - // { - // return result; - // } - - // // - // Calculate(); - - // // - // bool asSeries = ArrayGetAsSeries(buffer); - // ArraySetAsSeries(buffer, false); - - // // - // result = ArrayCopy( - // buffer, - // mBuffers[bufferIDX].values, - // start, - // start, - // count // - // ); - - // // - // ArraySetAsSeries(buffer, asSeries); - - // // - // return result; - // } - // // Protected ... protected: diff --git a/Indicators/x-saherelm.xmidtest.mq5 b/Indicators/x-saherelm.xmidtest.mq5 index b8ecca76..1f563527 100644 --- a/Indicators/x-saherelm.xmidtest.mq5 +++ b/Indicators/x-saherelm.xmidtest.mq5 @@ -114,7 +114,7 @@ int OnCalculate( // int midCalculatedBars = mMid.GetCalculatedBars(); - if (midCalculatedBars < maxLength) + if (midCalculatedBars < 0) { return prev_calculated; } @@ -225,16 +225,18 @@ void SetIndicatorName() void CalculateBuffers(int barIndex) { // - // double iValue = mMid.GetBufferValue( - // "XSCMid", + double iValue = mMid.GetBufferValue( + "XSCMid", + barIndex // + ); + + // + // double iValue = iClose( + // _Symbol, + // _Period, // barIndex // // ); // - double iValue = iClose( - _Symbol, - _Period, - barIndex // - ); mainBuffer[barIndex] = iValue; } \ No newline at end of file