NIFTY closing number is based on 30 minute average of NIFTY before closing. i.e. from 3:00 PM to 3:30 PM. I have tried Weighted Moving Average with different lengths. If I choose a length that gives closes match for a particular day’s closing, that same length does not work on other days.

So my question is: What is the most definitive way to obtain the NIFTY average value using the same formula that is used by NSE?

PS: I have already seen NSE documents. They simply say it is a weighted average of last 30 minutes. But I think there are still many undefined variables like what granularity do they use to the calculate avg of minute candle, 5 min candle, per second average, per trade average? What is the exact formula? Is there any NSE/third party published real time indicator that tracks this?

I need it for algo trading during last few minutes of market.