restart the terminal for indicator to update

samjesse

Active Trader
Aug 30, 2011
118
0
27
Hi

I am running mt5 v.5 built 507 on window 7.

Often I have to restart the platform for the indicator to update. any idea how this can be fixed?

thx

MQL5:
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
#property indicator_type1   DRAW_LINE
#property indicator_style1  STYLE_SOLID
#property indicator_color1  Red
 
//--- input parameters
 
 
 
// Indicator buffers
double ind_buf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,ind_buf,INDICATOR_DATA);
   ArraySetAsSeries(ind_buf,true);
 
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| 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[])
  {
//---if I change condition to i < 20, I need to restart mt5 for it to show
 
   for(int i=0; i < 10; i++) ind_buf[i]=122;
 
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Last edited by a moderator: