Modified duration is the approximate percentage change in price for a 100-basis-point change in interest rates, that is, the interest rate sensitivity. In general, the longer the modified duration, the more sensitive (higher fluctuations) the index is to changes in interest rates.
Given the price computed for an asset, modified duration, is calculated as:
\begin{align*}
MD_{t}
& = -\frac{1}{P_{t}} \frac{\delta P_{t}}{\delta r_{f}} \\
& = \frac{1}{P_{t}} \sum\limits_{\tau = t+1}^{T} \frac{(\tau - t) \times CF_{\tau}}{(1 + r_{f,t,\tau} + r_{x,\tau})^{\tau - t+1}} \\
\end{align*}
where,
\delta P_{t} is price change of an asset by an infinitesimal change in risk-free rate}(
\delta r_{f}).
CF_{\tau} is the cash flows at time
\tau.
T represents maturity of an asset.
r_{f,t,\tau} represents the risk-free rate at time t.
r_{x,\tau} represents a random change in the risk-free rate.