Created
October 11, 2023 17:29
-
-
Save quantra-go-algo/775bbc1b77b140446d688953b6dca72b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the figure size | |
plt.figure(figsize=(15,7)) | |
# Plot both the Buy-and-hold, SMA and HMM-DC-based strategy cumulative returns | |
plt.plot(plot_data.index, plot_data['buy_hold_cum_rets'], label = "Buy and Hold Returns") | |
plt.plot(plot_data.index, plot_data['basic_stra_cum_rets'], label = "SMA Strategy Returns", color='g') | |
plt.plot(plot_data.index, plot_data['hmm_dc_stra_cum_rets'], label = "HMM-DC-based Strategy Returns", color='r') | |
#plt.plot(plot_data.index, plot_data['hmm_stra_cum_rets'], label = "HMM-based Strategy Returns", color='y') | |
# Set the title of the graph | |
plt.title('Buy-and-Hold, SMA and HMM-DC-based Cumulative Returns', fontsize=16) | |
# Set the x- and y- axis labels and ticks sizes | |
plt.xlabel('Year', fontsize=15) | |
plt.ylabel('Cumulative Returns', fontsize=15) | |
plt.tick_params(axis='both', labelsize=15) | |
# Set the plot legend location | |
plt.legend(loc=2, prop={'size': 15}, bbox_to_anchor=(0,1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment