How to calculate implied correlation via observed market price (Margrabe option)

I can't seem to figure out how to do the following: compute the implied correlation $$ρ_{imp}$$ by using the observed market price $$M_{quote}$$ of a Margrabe option, and solving the non-linear equation shown below:

$$M_{quote} = e^{−q_0T}\times S_0(0)\times N(d_+)−e^{−q_1T}\times S_1(0)\times N(d_−)$$

where:

\begin{align} & d_\pm = \frac{\log\frac{S_0(0)}{S_1(0)}+(q_1 − q_0 ±σ^2/2)T}{\sigma\sqrt{T}} \\[4pt] & \sigma = \sqrt{\sigma^2_0 + \sigma^2_1 − 2\rho_{imp}\sigma_0 \sigma_1} \end{align}

Note that $$d_− = d_+ − σ\sqrt{T}$$.

• Bear in mind that what you're calculating is the margrabe option implied correlation, it's not necessarily the correct correlation to use for pricing other options, it's important to be aware of that. – will Apr 8 at 19:48

Let $$\rho\triangleq\rho_{imp}$$. Note that: $$\frac{\partial \sigma}{\partial \rho}(\rho)=-\frac{\sigma_0\sigma_1}{\sigma(\rho)}<0$$ Therefore $$\sigma$$ is monotonic in implied correlation. In addition, the Margrabe pricing function $$M(\cdot)$$ is also monotonic in volatility $$\sigma$$ thus you can find an unique solution to the equation: $$\tag{1}M_{\text{quote}}=M(\rho)$$ where: $$M(\rho)=e^{−q_0T}S_0(0)N(d_+)−e^{−q_1T}S_1(0)N(d_−)$$ and $$d_\pm$$ as defined in your question, with $$M_{\text{quote}}$$ the observed market price. In practice, this can be restated as: \begin{align} &\min_\rho\left(M(\rho)-M_{\text{quote}}\right)^2\tag{2} \\ &\ \text{s.t. } \rho \in [-1,1] \end{align} because $$(M(\rho)-M_{\text{quote}})^2\geq0$$. This is an optimization problem which can be solved through traditional techniques:
• If you want arbitrary precision, you can use a simple Newton algorithm on either $$(1)$$ or $$(2)$$ with root value $$\rho=0$$, this is quick to program in Excel VBA, or you can maybe even find an online tool that does it. This PDF explains the method for a vanilla call in a Black-Scholes framework to find the implied volatility, but the set-up is very similar. Another alternative is gradient descent but this would probably take longer to program and you have to do it on $$(2)$$;
• You can also use Excel's Solver to find a solution to $$(1)$$ directly. I have tried with $$S_0(0)=\101$$, $$S_1(0)=\113.5$$, $$\sigma_0=45\%$$, $$\sigma_1=37\%$$, $$T=1\text{ year}$$ and $$q_0=q_1=0$$ and it has worked just fine.
We know that $$-1\le\rho_{imp}\le 1$$ so perhaps the simplest approach is to try the possible values $$\rho_{imp}=\{-1,-0.9,-0.8,\cdots,0.8,0.9,+1\}$$, to calculate resulting $$\sigma$$ values, d± values, and $$M_{quote}$$ values, then see which of these is closest to the observed market price. If desired you can then search a finer grid between two adjacent assumed correlations to pin it down more precisely. It is a manual but relatively simple method.