Download MetaTrader 5
To add comments, please log in or register
Do you want to learn MQL5? 300 articles will help you!
claud
14
claud 2014.02.06 07:11 

After the MT4 upgrade, re-compiled the indicator source file, the DRAW_HISTOGRAM don't show again. Why? Thanks a lot.

#property strict
#property indicator_chart_window

#property indicator_buffers 1
#property indicator_color1 Blue
double buf0[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   IndicatorBuffers(1);
   IndicatorDigits(Digits);

   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_DOT);
   SetIndexBuffer(0,buf0);
   SetIndexEmptyValue(0,0.0);

   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[])
{
   for(int i=rates_total-1; i>=0; i--)
   {
      buf0[i]=19;
   }
   return(rates_total);
}

claud
14
claud 2014.02.06 07:26  

looks like the indicator DRAW_HISTOGRAM line have 2 buffer, and both 2 buffer cannot be 0.

#property strict
#property indicator_chart_window

#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
double buf0[];
double buf1[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   IndicatorBuffers(2);
   IndicatorDigits(Digits);

   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_DOT);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_DOT);
   SetIndexBuffer(0,buf0);
   SetIndexBuffer(1,buf1);
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);

   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[])
{
   for(int i=rates_total-1; i>=0; i--)
   {
      buf0[i]=19.5;
      buf1[i]=19;
   }
   return(rates_total);
}

claud
14
claud 2014.02.06 10:02  
if changed from "#property indicator_chart_window" to "#property indicator_separate_window", show in separate window, it's OK. So, i think it's bug in new released MT4 Build600 version.
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.06 10:06  
claud:

After the MT4 upgrade, re-compiled the indicator source file, the DRAW_HISTOGRAM don't show again. Why? Thanks a lot.

<CODE DELETED>
Please use the SRC button when posting code.
claud
14
claud 2014.02.07 10:05  

Now, only can do a workaround solution.

Anyone know how to stop the MT4 auto-update function, and how to install appointed version. It's looks like version controlled by broker, is it?

claud
14
claud 2014.02.10 03:08  
This bug is not fixed in just released new build 604 version.
/
To add comments, please log in or register