title: How to get the number of bars in a day in pine script in tradingview?
body: <p>I'm trying to plot the 9/50/180 day SMA regardless of the timeframe period.</p>
  
  <p>If you're looking at the candles in 1D, 4h, 3h, 15m, .. I just want to see the 9/50/.. day SMA.</p>
  
  <p>If I could calculate the number of bars in a day, I could take the SMA over a 9 * #numberOfCandlesInDay length.</p>
  
  <p>I could define a numberOfMinutes per syminfo.prefix (lots of work) and then calculate the number of bars based on timeframe.multiplier, but that is a hassle and prone to error.</p>
  
  <p>Any tips?</p>