Help Please - My indicator HULL MOving Average does not refresh correctly

 
Hello fellow MQL4 programmers,

I need your help please. The indicator stated below seems to work fine on first hand but I do have an issue - it doesn't refresh the last bar value - it simply ends and there delivers no signals
My indicator (HMATriple)  is based on another MTF indicator (MTF-HMAPrice) . very grateful for your time. <Deleted>
#property copyright "Created with EABuilder.com"
#property link      "https://www.eabuilder.com"
#property version   "1.00"

#include <stdlib.mqh>
#include <stderror.mqh>

//--- indicator settings
#property indicator_separate_window
#property indicator_buffers 2

#property indicator_type1 DRAW_HISTOGRAM
#property indicator_style1 STYLE_SOLID
#property indicator_width1 5
#property indicator_color1 Blue
#property indicator_label1 "Buy"

#property indicator_type2 DRAW_HISTOGRAM
#property indicator_style2 STYLE_SOLID
#property indicator_width2 5
#property indicator_color2 Red
#property indicator_label2 "Sell"

//--- indicator buffers
double Buffer1[];
double Buffer2[];

double myPoint; //initialized in OnInit

void myAlert(string type, string message)
  {
   if(type == "print")
      Print(message);
   else if(type == "error")
     {
      Print(type+" | 2021-EABHMA.PRICE2-3v2 @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
     }
   else if(type == "order")
     {
     }
   else if(type == "modify")
     {
     }
  }

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {   
   IndicatorBuffers(2);
   SetIndexBuffer(0, Buffer1);
   SetIndexEmptyValue(0, EMPTY_VALUE);
   SetIndexBuffer(1, Buffer2);
   SetIndexEmptyValue(1, EMPTY_VALUE);
   //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 3)
     {
      myPoint *= 10;
     }
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
  {
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries(Buffer1, true);
   ArraySetAsSeries(Buffer2, true);
   //--- initial zero
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, EMPTY_VALUE);
      ArrayInitialize(Buffer2, EMPTY_VALUE);
     }
   else
      limit++;
   
   //--- main loop
   for(int i = limit-1; i >= 0; i--)
     {
      if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   
      
      //Indicator Buffer 1
      if(
      
     
         (iCustom(NULL, PERIOD_CURRENT, "MTF-HMAPrice", 240, 3, 22, 5, 1.8, 9, clrLimeGreen, clrRed, false, false, false, false, false, false, false, false, "hma Lines", clrDeepSkyBlue, clrPaleVioletRed, STYLE_DOT, 0, 0, i) != EMPTY_VALUE
      
      &&  iCustom(NULL, PERIOD_CURRENT, "MTF-HMAPrice", 60 , 3, 22, 5, 1.8, 9, clrLimeGreen, clrRed, false, false, false, false, false, false, false, false, "hma Lines", clrDeepSkyBlue, clrPaleVioletRed, STYLE_DOT, 0, 0, i) != EMPTY_VALUE)
      )
        {
         Buffer1[i] = Low[i]; //Set indicator value at Candlestick Low
        }
      else
        {
         Buffer1[i] = EMPTY_VALUE;
        }
      //Indicator Buffer 2
      if(
      
      (iCustom(NULL, PERIOD_CURRENT, "MTF-HMAPrice", 240, 3, 22, 5, 1.8, 9, clrLimeGreen, clrRed, false, false, false, false, false, false, false, false, "hma Lines", clrDeepSkyBlue, clrPaleVioletRed, STYLE_DOT, 0, 1, i) != EMPTY_VALUE 
      && iCustom(NULL, PERIOD_CURRENT, "MTF-HMAPrice", 60, 3, 22, 5, 1.8, 9, clrLimeGreen, clrRed, false, false, false, false, false, false, false, false, "hma Lines", clrDeepSkyBlue, clrPaleVioletRed, STYLE_DOT, 0, 1, i) != EMPTY_VALUE)
      
      )
        {
         Buffer2[i] = High[i]; //Set indicator value at Candlestick High
        }
      else
        {
         Buffer2[i] = EMPTY_VALUE;
        }
     }
   return(rates_total);
  }
//+------------------------------------------------------------------+
How to Order a Trading Robot in MQL5 and MQL4
How to Order a Trading Robot in MQL5 and MQL4
  • www.mql5.com
"Freelance" is the largest freelance service for ordering MQL4/MQL5 trading robots and technical indicators. Hundreds of professional developers are ready to develop a custom trading application for the MetaTrader 4/5 terminal.
Files:
 
juanforex21:
Hello fellow MQL4 programmers,

I need your help please. The indicator stated below seems to work fine on first hand but I do have an issue - it doesn't refresh the last bar value - it simply ends and there delivers no signals
My indicator (HMATriple)  is based on another MTF indicator (MTF-HMAPrice) . very grateful for your time. I'll Pay 5$ Paypal :( 

What you want to achieve or how do you want it to display

PS : "MTF HMAPrice" indicator is of Mladen's indicator,extended by Mrtools - somebody renamed it even removed "property copyright" and "property link" from

---------------------------------------------------

I dont think any expert/coder will be touch and waste time on softwares generated codes

#property copyright "Created with EABuilder.com"

#property link         "https://www.eabuilder.com"