Download MetaTrader 5

Histogram line style not displaying properly on Strategy Tester

To add comments, please log in or register
Publish your application in the Market - 7 million potential clients will see it
Pasi Hakamaki
4736
Pasi Hakamaki 2013.11.29 20:40 

Dear,

//+------------------------------------------------------------------+
//|                                                    Hist_test.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
#property indicator_type1 DRAW_COLOR_HISTOGRAM
#property indicator_plots 1
#property indicator_buffers 2
#property indicator_style1 STYLE_DASH
#property indicator_color1 clrRed
#property indicator_width1 0
double buff_hist[];
double buff_clr[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,buff_hist,INDICATOR_DATA);
   SetIndexBuffer(1,buff_clr,INDICATOR_COLOR_INDEX);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//---
   int limit;
   if(prev_calculated==0)
     {
      limit=0;
     }
   else
     {
      limit=prev_calculated-1;
     }
   for(int i=0;i<rates_total;i++)
     {
      buff_hist[i]=price[i];
      buff_clr[i]=0;
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

The above code works fine when attached to the chart. Lines are dash as should be, but when testing historical data with Strategy Tester lines are always solid. Please, can you test this and confirm that this is a bug.

Br,

Candles

Alain Verleyen
Moderator
30755
Alain Verleyen 2013.11.29 21:28  
Yes, I confirm.
Pasi Hakamaki
4736
Pasi Hakamaki 2013.11.29 21:35  
angevoyageur:
Yes, I confirm.
Ok. Thank you, I report Service Desk.
Hao Li
595
Hao Li 2013.12.09 20:09  
Candles:

Dear,

The above code works fine when attached to the chart. Lines are dash as should be, but when testing historical data with Strategy Tester lines are always solid. Please, can you test this and confirm that this is a bug.

Br,

Candles

thank you
Pasi Hakamaki
4736
Pasi Hakamaki 2013.12.09 20:32  
ysu1987:
thank you
Most welcome.
Alain Verleyen
Moderator
30755
Alain Verleyen 2013.12.09 21:01  
Candles:
Most welcome.

See here

Pasi Hakamaki
4736
Pasi Hakamaki 2013.12.09 22:00  
Ah, I see :)
To add comments, please log in or register