Problem with Division in MQL4 - page 2

 
William Roeder:
  1. On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values. To avoid getting zero.
              Download history in MQL4 EA - Forex Calendar - MQL4 programming forum - Page 3 #26.4 2019.05.20

  2. Same index for both symbols. You must check each symbol for its bar count. To avoid getting zero.

  3. Do not assume an index on the current chart is the same as on other charts. Always use iBarShift.

could you please help me on this. I have wrote below to calculate previous candles:

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 Countrd_bars=prev_calculated;
   for (int i=rates_total-Countrd_bars-1;i>=0;i--)
   {


is it correct?