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.
The most definitive way to get the VWAP for the last 30 minutes will be if you calculate this using tick by tick(TBT) provided by the exchange on a colocation server. More details about TBT data here.
If you see, TBT data comes at a huge infra cost, unless you have a HFT trading platform that requires this, the most cost-effective way to estimate the VWAP for the last 30 minutes is capturing all ticks you receive on Kite Connect APIs(1 or 2 ticks a second, while there could be thousands of trades) and calculating the VWAP which would be a close estimate of the closing price.
If you are asking for INDEX. Index underlying stocks closing price will be considered as per their weightage in index. For stocks closing price their volume and price of last 30 mins in cash market will be considered not futures.