From 9cfd0b7802db81b6cb84a2f62eca582109984a7d Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 30 May 2024 11:58:40 +0330 Subject: [PATCH] last ... --- Classes/Indicators/x-saherelm.mid.class.mq5 | 14 ++---- Classes/x-saherelm.x121.provider.class.mq5 | 51 +++----------------- Classes/x-saherelm.xind.class.mq5 | 52 +++++++-------------- Indicators/x-saherelm.xmidtest.mq5 | 24 +++++----- 4 files changed, 41 insertions(+), 100 deletions(-) diff --git a/Classes/Indicators/x-saherelm.mid.class.mq5 b/Classes/Indicators/x-saherelm.mid.class.mq5 index ea8a5d05..28c98075 100644 --- a/Classes/Indicators/x-saherelm.mid.class.mq5 +++ b/Classes/Indicators/x-saherelm.mid.class.mq5 @@ -192,8 +192,7 @@ public: // Register Required Buffers ... XBuffer main; result = main.Init( - "XSCMid", - false // + "XSCMid" // ); if (!result) { @@ -276,6 +275,7 @@ public: { // int max = mInputs.Max(); + int limit = CountLimit(); int totalBars = CountBars(); int prevCalculated = GetCalculatedBars(); @@ -302,14 +302,6 @@ public: } } } - else - { - return; - } - // else - // { - // start = prevCalculated - 1; - // } // // Loop through Bars ... @@ -327,7 +319,7 @@ public: double iValue = iBar.close; // - Print("BarIndex: " + ToString(i), ", iValue: ", iValue); + // Print("BarIndex: " + ToString(i), ", iValue: ", iValue); // if (i > ArraySize(mBuffers[mainIDX].values) - 1) diff --git a/Classes/x-saherelm.x121.provider.class.mq5 b/Classes/x-saherelm.x121.provider.class.mq5 index 9d10492c..9d853ffd 100644 --- a/Classes/x-saherelm.x121.provider.class.mq5 +++ b/Classes/x-saherelm.x121.provider.class.mq5 @@ -2971,46 +2971,6 @@ public: return result; } - // - // Validate Longs Use Common Conditions ... - - // - // if (hasLong) - // { - // // - // int pusher = 0; - // result = HasBaseLongConditions( - // mConditions, - // pusher // - // ); - - // // - // if (!result) - // { - // return result; - // } - // } - - // // - // if (hasShort) - // { - // // - // int pusher = 0; - // result = HasBaseShortConditions( - // mConditions, - // pusher // - // ); - - // // - // if (!result) - // { - // return result; - // } - // } - - // - // Prepare Signal ... - // if (result) { @@ -3183,10 +3143,13 @@ public: if (isPrepared) { // - AddRef( - sSignal, - mSignal.supports // - ); + mSignal = sSignal; + + // // + // AddRef( + // sSignal, + // mSignal.supports // + // ); } } diff --git a/Classes/x-saherelm.xind.class.mq5 b/Classes/x-saherelm.xind.class.mq5 index 3b359a15..a0d877d6 100644 --- a/Classes/x-saherelm.xind.class.mq5 +++ b/Classes/x-saherelm.xind.class.mq5 @@ -34,7 +34,6 @@ struct XBuffer // string title; // Buffer Title double values[]; // Buffer Values - bool asSeries; // As Series Flag // // Constructor ... @@ -46,8 +45,7 @@ struct XBuffer // // Tools ... bool Init( - string mTitle, // Title - bool mAsSeries = true // As Series Flag + string mTitle // Title ) { // @@ -76,10 +74,6 @@ struct XBuffer // result = IsValid(); - // - asSeries = mAsSeries; - ArraySetAsSeries(values, mAsSeries); - // return result; } @@ -163,9 +157,6 @@ struct XBuffer return result; } - // - ArraySetAsSeries(values, true); - // int count = Count(); ArrayResize( @@ -179,9 +170,6 @@ struct XBuffer // result = Count(); - // - ArraySetAsSeries(values, asSeries); - // return result; } @@ -189,8 +177,7 @@ struct XBuffer // // Get Specified Index Value ... double Get( - int index, // Specified Index - bool reverse = false // Retrieve Reversal Index Value + int index // Specified Index ) { // @@ -202,21 +189,9 @@ struct XBuffer values // ); - // - if (reverse) - { - ArraySetAsSeries(values, !asSeries); - } - // result = values[index]; - // - if (reverse) - { - ArraySetAsSeries(values, asSeries); - } - // return result; } @@ -409,7 +384,7 @@ public: // // Calculate Limit ... // this means Required Bars for Calculation ... - int CalculateLimit() + int CountLimit() { // int result = 0; @@ -588,12 +563,21 @@ public: Calculate(); // - for (int i = start; i < start + count - 1; i++) - { - // - result++; - buffer[i] = mBuffers[bufferIDX].values[i]; - } + result = ArrayCopy( + buffer, + mBuffers[bufferIDX].values, + start, + start, + count // + ); + + // + // for (int i = start; i < start + count - 1; i++) + // { + // // + // result++; + // buffer[i] = mBuffers[bufferIDX].values[i]; + // } // return result; diff --git a/Indicators/x-saherelm.xmidtest.mq5 b/Indicators/x-saherelm.xmidtest.mq5 index 40d701f4..84a1099a 100644 --- a/Indicators/x-saherelm.xmidtest.mq5 +++ b/Indicators/x-saherelm.xmidtest.mq5 @@ -108,7 +108,7 @@ int OnCalculate( // // Check Calculated Bars ... int midCalculatedBars = mMid.GetCalculatedBars(); - if (!IsValidSize(midCalculatedBars)) + if (prev_calculated > 0 && midCalculatedBars != prev_calculated) { return prev_calculated; } @@ -121,17 +121,19 @@ int OnCalculate( // Print("Limit: ", limit); - mMid.Calculate(); + // mMid.Calculate(); - // - // int midMainBufferCopied = mMid.CopyBuffer( - // "XSCMid", - // mainBuffer - // ); - // if (!IsValidSize(midMainBufferCopied)) - // { - // return prev_calculated; - // } + // + int midMainBufferCopied = mMid.CopyBuffer( + "XSCMid", + mainBuffer, + 0, + limit // + ); + if (!IsValidSize(midMainBufferCopied)) + { + return prev_calculated; + } // // ChartRedraw();