Closing price of stocks

avinashsringeri
avinashsringeri edited February 2018 in Java client
Hi Folks,

As we all know the last price and closing price of the NSE stocks are not same. In some sites its mentioned its calculated based on price changes in last 30 mins i.e., 3:00 - 3:30.

Can someone provide me a solution to calculate closing price of a stock @3:29 PM? I am ready to pay for this solution.
  • nithin
    @avinashsringeri the adjusted closing price for the day is the weighted average price of the last 30 mins. This will always vary to the last traded price.

    You can use the below to calculate:

    1. After 3:00 P.M

    Predictive Close Price =

    summation of (Last Trade Price * Last Trade Qty)/ summation of qty
    for all ticks after 3 P.M.

    2. After 3:00 P.M.
    for the first tick
    calculate TTV0 = Total Turnover Value = Avg Price * Total Volume
    also V0 = Volume ;

    at any new tick
    TTV1 = avg Price * total Volume(V1)
    V1 = Volume

    Predictive Close Price = (TTV1- TTV0)/(V1- V0)

    Even with this calculation, it may not match the exact closing price because you would be calculating this based on the ticks that you receive on your front end /platform which will be a fraction of the price ticks that happens on the exchange. Check my answer here on more about ticks.
  • avinashsringeri
    Awesome. Thanks for sharing a very detailed explanation on how its calculated. Thanks Nitin. In general if I use Zerodha ticks or second by second price how close can we get to real projected price? I understand there is no definite answer. The price till the last tick along with volume will be accounted for closing price.
  • nithin
    Yeah, you will have to account till the last tick to be as close to this weighted average as possible. How close can you be to the actual closing price - no definite answer. On days when markets are volatile, it could be further away from closing than days when it is flat.
Sign In or Register to comment.