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.
Last 30 minutes average of what? Underlying (Spot) or Futures?
If it is underlying (Spot) then VWAP does not work for that calculation.
How to do it??
Use anchored VWAP on Nifty spot from 3pm to 330pm on ChartsIQ and you will get an approximate Nifty closing value for that day.