# Are there a difference between Bars and rates_total? Are there a difference between IndicatorCounted () and prev_calculated?

390

hello,

Are there a difference between Bars and rates_total?

Are there a difference between IndicatorCounted () and prev_calculated?

```//+------------------------------------------------------------------+
//|                                                   Difference.mq4 |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 1
//---- plot Line

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
//---
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[],
{

//----
Print("*********************************************************");
Print("****************  IndicatorCounted() ********************");
Print("*********************************************************");
Print("Symbol() :",Symbol(),"   Period() :",Period());
Print("time[0] = ",TimeToString(time[0],TIME_DATE)," time[rates_total-1] = ",TimeToString(time[rates_total-1],TIME_DATE));
Print("Bars :",Bars,"  rates_total :",rates_total);
Print("IndicatorCounted():",IndicatorCounted(),"  prev_calculated:",prev_calculated);

//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
```

Moderator
7851

As far as I think IndicatorCounted() is only the old version (before b600+) and the the other one the new way.
Moderator
10533

gooly:
As far as I think IndicatorCounted() is only the old version (before b600+) and the the other one the new way.

But don't forget that IndicatorCounted is the actual counted -1 to allow for recounting the last bar. (except when it =0)

Whereas prev_counted is the true amount.