Statistics for the strategies

Let's now take a look at the statistics for all three strategies. We'll create a function that can take in each series of returns, and will print out the summary results. We're going to get statistics for each of our winning, losing, and break-even trades, and something called the Sharpe ratio. I said earlier that returns are judged on a risk-adjusted basis; this is exactly what the Sharpe ratio provides us with; it is a method of comparing returns by accounting for the volatility of those returns. Here, we use the Sharpe ratio with an adjustment to annualize the ratio:

def get_stats(s, n=252): 
    s = s.dropna() 
    wins = len(s[s>0]) 
    losses = len(s[s<0]) 
    evens = len(s[s==0]) 
    mean_w = round(s[s>0].mean(), 3) 
    mean_l = round(s[s<0].mean(), 3) 
    win_r = round(wins/losses, 3) 
    mean_trd = round(s.mean(), 3) 
    sd = round(np.std(s), 3) 
    max_l = round(s.min(), 3) 
    max_w = round(s.max(), 3) 
    sharpe_r = round((s.mean()/np.std(s))*np.sqrt(n), 4) 
    cnt = len(s) 
    print('Trades:', cnt, 
          '
Wins:', wins, 
          '
Losses:', losses, 
          '
Breakeven:', evens, 
          '
Win/Loss Ratio', win_r, 
          '
Mean Win:', mean_w, 
          '
Mean Loss:', mean_l, 
          '
Mean', mean_trd, 
          '
Std Dev:', sd, 
          '
Max Loss:', max_l, 
          '
Max Win:', max_w, 
          '
Sharpe Ratio:', sharpe_r) 

Let's now run each strategy to see the stats. We'll start with the buy-and-hold strategy (daily returns) and then move onto the other two, as follows:

get_stats(daily_rtn) 

This generates the following output:

Run the following code for intraday returns:

get_stats(id_rtn) 

This generates the following output:

Run the following code for overnight returns:

get_stats(on_rtn) 

This generates the following output:

As you can see, the buy-and-hold strategy has the highest mean return, as well as the highest standard deviation, of the three. It also has the largest daily drawdown (loss). You will also notice that, even though the overnight-only strategy has a higher mean return than the intraday strategy, it also has substantially less volatility. This, in turn, gives it a Sharpe ratio that is higher than the intraday strategy.

At this point, we have a solid baseline for comparing our future strategies. Now, I am going to tell you about a strategy that blows all three of these strategies out of the water.

..................Content has been hidden....................

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