How to do correlation

Discussion in 'Automated Trading' started by Rapunzel, May 4, 2022.

  1. Rapunzel

    Rapunzel

    Hi folks, curious to know your approach to using correlations to limit overall risk on trades that are open simultaneously. Say 2 simultaneous trades to begin with.


    First Thoughts

    My first thought is to use the Portfolio Risk Formula. If I know the worst case correlation for the 2 pairs (I trade fx), and the standard deviation of the PnL of the 2 pairs over 1,000 trades. Then I could rearrange the formula to find the total amount of new risk to take on pair 2 considering the risk already exposed to, on an open trade in pair 1. With a view to keep the 'portfolio' standard deviation within a prescribed level.

    Problems

    I wasn't sure about the formula so I decided to try simulations in excel. This presented a problem with how to implement the correlation between pair 1 and 2.

    Do I generate 2 random distributions between 0 and 1 for pair 1 and 2, with a specified correlation between them. And then consider a trade to have won if the random number is below my win rate. e.g. Random Number (RN) = 0.345, Win Rate (WR) = 0.667 would be a win since RN <= WR. My R:R is 2:1.

    The problem with doing it that way is that the distributions of the random numbers in 1 and 2 may have a specified correlation, but the ultimate sequence of wins and losses that result from conditioning them on the win rate are not correlated in the same way.

    I found a way to generate a sequence of wins and losses in pair 1 and 2 that do correlate as required. In this case the overall win rate on the sequence of wins-losses on pair 2 is very skewed, either very high or very low i.e. not realistic. This is probably because it is derived as a distribution on the value of pair 1.

    Point is in either case; the standard deviation of the PnL on the combined profit outcome of the 2 pairs is usually much higher than that predicted by the formula.

    New Direction: Maybe I am overcomplicating the issue, and the formula takes into account how the Win Rate, PnL and StDeviation of the PnLs on 1 and 2 would interact given their correlation, to produce a final result.

    Is there a way I can test which version is more accurate using backtesting?
     
    guest_trader_1 likes this.
  2. You could use Monte-Carlo simulations and run them on both versions to find out which one would be more accurate.

    These simulations would have a much closer look to the data you are after.
     
    Rapunzel likes this.
  3. Rapunzel

    Rapunzel

    Thanks for the post, i'll give it a try.
     
  4. Rapunzel

    Rapunzel

    The correlation model can be quite complex. It seems that you should only enter a new trade in general; if the direction correlates with the open trade in the range 0 < x < -0.4 (No new risk at all with any positive correlation).

    I have been previously using the untested correlation standard of: -0.3 < x < 0.3.

    There is a maximum amount of risk to add in the new trade, so that the total risk is equal to or less than the risk on only pair 1 with 95 confidence. And which maximizes the risk adjusted return (RAT), defined here as: Combined Average Return / Combined Maximum Risk @ 95% Confidence.

    Or which maximizes the improvement in RAT, from having 1 trade to having 2.

    Other important factors so far not accounted for:
    • Model depends on probability of win on trade 1 which is uncertain. (using normal distribution around average WR)
    • Model assumes both trades are open at the same time, which does not reflect reality.
    • Correlation is based on historic PnL differences in Price Action, not future or current correlation after the trades have be opened.
    Interesting subject. Monte-Carlo must be the answer.
     
    Last edited: May 7, 2022
  5. ph1l

    ph1l

    One way is pick assets from a set where each asset is correlated to each other asset less than a threshold as described in this post.