Number of days of candle

 
Hi. I want to get the number of days passed since a specific candle has formed up until the current day. Let us say a candle fromed on the 20 January 2020, then the current day is 23 Jan 2020, then I need an output that produces that the candle on the 20th of Jan formed 2 days ago.
 

There are multiple possibilities
     How To Ask Questions The Smart Way. 2004
          Be precise and informative about your problem

  1. You want calendar days, including hourly fraction : (TimeCurrent() - timeCandle) / PeriodSeconds(PERIOD_D1);
  2. You want calendar days, ignoring fraction: (Date( timeCandle) - Date() ) / PeriodSeconds(PERIOD_D1);
  3. You want trading days including fraction: iBarShift(_Symbol, _Period, timeCandle) * PeriodSeconds() / PeriodSeconds(PERIOD_D1);
  4. You want trading days, ignoring fraction: (Date( iTime( _Symbol, _Period, iBarShift(_Symbol, _Period, timeCandle) ) - Date() ) / PeriodSeconds(PERIOD_D1);
              Find bar of the same time one day ago - MQL4 programming forum 2017.10.06

Hourly fraction: 20 Jan 10:00 - 23 Jan 9:00 is two days but 20 Jan 10:00 - 23 Jan 10:00 is three.