ddf index name 'holding periodddf columns name 'lookback periodto visualize the results and get an idea of what' going onhere is function that uses matplotlib to produce heatmap with some adornmentsimport matplotlib pyplot as plt def heatmap(dfcmap=plt cm gray_r)fig plt figure(ax fig add_subplot( axim ax imshow(df valuescmap=cmapinterpolation='nearest'ax set_xlabel(df columns nameax set_xticks(np arange(len(df columns))ax set_xticklabels(list(df columns)ax set_ylabel(df index nameax set_yticks(np arange(len(df index))ax set_yticklabels(list(df index)plt colorbar(aximcalling this function on the backtest resultswe get figure - in [ ]heatmap(ddffigure - heatmap of momentum strategy sharpe ratio (higher is betterover various lookbacks and holding periods future contract rolling future is an ubiquitous form of derivative contractit is an agreement to take delivery of certain asset (such as oilgoldor shares of the ftse indexon particular date in practicemodeling and trading futures contracts on equitiescurrenciesmore example applications www it-ebooks info