# Where am I going wrong with the calculation of conitnuous PnL from delta hedging?

I am trying to work out the PnL of continuous delta hedging. I saw This link to an answer here, however, I obtained a different answer without resorting to Black Scholes, which I will outline below.

Lets assume a constant $$\Gamma$$. We take the time interval $$[0,1]$$, and divide it into the discrete points $$i/n$$ for $$i=0,\ldots, n$$. We enter a position in some option at time $$0$$, and initially hedge by shorting $$\Delta_0$$ of the underlying, where $$\Delta_0$$ is the delta of the option at time $$0$$. Denote by $$P$$ the spot price of the underlying. At time $$1/n$$, the delta of the option moves to $$\Delta_0 + \Gamma (P_{1/n} - P_0)$$, so we short an additional $$\Gamma (P_{1/n} - P_0)$$ of the underlying, this time at price $$P_{1/n}$$, so we spend $$\Gamma P_{1/n} (P_{1/n} - P_0)$$. We continue this process until time $$1$$, at which time we leave the position by shorting $$-\Delta_1$$ of the underlying. Our total spending amounts to

$$\Delta_0 P_0 + \sum_{i=1}^{n-1} \Gamma P_{i/n} ( P_{i/n} - P_{(i-1)/n}) - \Delta_1P_1.$$

Now, $$\Delta_1 = \Delta_0 + \Gamma (P_1-P_0)$$ so that \begin{align} \Delta_0 P_0 - \Delta_1P_1 &= \Delta_0P_0 - (\Delta_0 +\Gamma (P_1- P_0))(P_0 + (P_1-P_0))\\ &= - \Delta_0 (P_1-P_0) -P_0\Gamma(P_1 - P_0) - \Gamma (P_1-P_0)^2\\ &= -\Gamma (P_1-P_0)^2 -(\Delta_0 + P_0 \Gamma)(P_1-P_0) \end{align}

Letting $$n$$ become large in our expression, and multiplying by $$-1$$ to obtain PnL we have

$$PnL = \Gamma (P_1-P_0)^2 + (\Delta_0 + P_0 \Gamma)(P_1-P_0) + \int_0^1 \Gamma P (t) \mathrm{d} P(t).$$

So is this something that you have seen before? Or did I make some mistakes along the way? And does this somehow lead to what is in the link? As it stands I see no obvious connection to any implied or realized volatility? Thanks

Edit: I think maybe the quantity being evaluated in the link I added measures something else. I am specifically trying to evaluate the additional PnL obtained when hedging to stay delta neutral during the holding time of an option.