I am sharing a few thoughts on risk management I had while developing trading algorithms for myself and my clients. Keep in mind my focus is mostly on Machine Learning based algorithms but these considerations are general enough apply also to all quants and even discretionary traders.

Most of the quants, or even traders, have the tendency to jump to the “sexy” part of the strategy definition, namely, using exotic datasets, crunching data via traditional analysis or Machine Learning to generate trading signals. Hours and resources are poured into squeezing the next 1% accuracy out of your signal generating model without acknowledging the elephant in the room: What happens when your signal is wrong?
This is not a hypothetical question, your model will be wrong at some point, maybe in a small way every day or in a big way during crashes. Therefore it is critical for you to adjust your trading framework accordingly.

I advocate for flipping the sequence of activities in trading algorithms’ development from:

  1. Analyze data and generate signals ideas
  2. Develop an algorithm to generate trading signals
  3. (Back)Test the trading signal
  4. Add a risk management layer
     

To:

  1. Define what is risk for you and how much you are willing to take
  2. Develop an infrastructure that targets the desired level of risk
  3. (Back)Test the risk infrastructure in the worst possible scenario (I like using a random model)
  4. Add a signal generation layer
     

While the concept of risk is very slippery (and its measurement even more), this change of perspective is certainly useful. You stop thinking that your signals are flawless and you start building contingency for when things will go against you.

To make things more practical you can find below a short algorithm that trades daily the SPY and that implements these concepts:

  • A risk management framework: In this case I have used the Kelly Criterion which, together with the next day’s Up/Down prediction, defines the size of the position for that day.
  • A signal generating model: Since the focus is on testing the risk management, I am using a DummyClassifier generating random 0/1 trading signals. I want to see how the algorithm behaves when a blindfolded monkey is on the steering wheel.
     

As you can see, the performance is by no means exceptional but, even with a totally random trading signal, the risk management still achieves reasonable returns and drawdown while squeezing out even a tiny alfa. 

This is enlightening on the importance of this often overlooked component and my recommendation is to find your preferred risk management mechanism and test it under different conditions (tickers, asset classes, resolutions, …) with very bad or even random signals. In this way you can refine your own risk management layer so you can confidently release your real trading models.

Francesco
www.beawai.com

P.S. The considerations are inspired by several readings across Finance, Math and sometimes even Philosophy. I am sharing a few of these should you want to dig deeper: