Stop-loss

The first risk limit we will look at is quite intuitive and is called stop-loss, or max-loss. This limit is the maximum amount of money a strategy is allowed to lose, that is, the minimum PnL allowed. This often has a notion of a time frame for that loss, meaning stop-loss can be for a day, for a week, for a month, or for the entire lifetime of the strategy. A stop-loss with a time frame of a day means that if the strategy loses a stop-loss amount of money in a single day, it is not allowed to trade any more on that day, but can resume the next day. Similarly, for a stop-loss amount in a week, it is not allowed to trade anymore for that week, but can resume next week.

Now, let's compute stop-loss levels on a week and month for the volatility adjusted mean reversion strategy, as shown in the following code:

num_days = len(results.index)

pnl = results['PnL']

weekly_losses = []
monthly_losses = []

for i in range(0, num_days):
if i >= 5 and pnl[i - 5] > pnl[i]:
weekly_losses.append(pnl[i] - pnl[i - 5])

if i >= 20 and pnl[i - 20] > pnl[i]:
monthly_losses.append(pnl[i] - pnl[i - 20])

plt.hist(weekly_losses, 50)
plt.gca().set(title='Weekly Loss Distribution', xlabel='$', ylabel='Frequency')
plt.show()

plt.hist(monthly_losses, 50)
plt.gca().set(title='Monthly Loss Distribution', xlabel='$', ylabel='Frequency')
plt.show()

The code will return the following plots as output. Let's have a look at the weekly loss distribution plot shown here:

Now, let's take a look at the monthly loss distribution plot shown here:

The plots show the distribution of weekly and monthly losses. From these, we can observe the following:

  • A weekly loss of anything more than $4K and a monthly loss of anything more than $6K is highly unexpected.
  • A weekly loss of more than $12K and a monthly loss of $14K have never happened, so it can be considered an unprecedented event, but we will revisit this later.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.119.199