You can calculate the correlation coefficient ... COV=Market indicator, stock priceSDMI=Standard deviation for market indicatorSDSP=Standard deviation for stock price\begin{aligned} ...
Calculate this by dividing the value of each position by the total portfolio value. Let's label these values W1 and W2. The standard deviation of Stock 1 and Stock 2. You can calculate these ...