Simple_cum_relative_return_exact = simple_cum_strategy_asset_relative_returns.sum(axis=1)Īx.plot(cum_relative_return_exact.index, 100*cum_relative_return_exact, label='EMA strategy')Īx.plot(simple_cum_relative_return_exact.index, 100*simple_cum_relative_return_exact, label='Buy and hold')Īx.set_ylabel('Total cumulative relative returns (%)')Īx.xaxis. Simple_cum_strategy_asset_relative_returns = np.exp(simple_cum_strategy_asset_log_returns) - 1 # Transform the cumulative log returns to relative returns Simple_cum_strategy_asset_log_returns = simple_strategy_asset_log_returns.cumsum() # Get the cumulative log-returns per asset Simple_strategy_asset_log_returns = simple_weights_matrix * asset_log_returns # Get the buy-and-hold strategy log returns per asset Simple_weights_matrix = pd.DataFrame(1/3, index = data.index, columns=lumns) # Define the weights matrix for the simple buy-and-hold strategy To get all the strategy log-returns for all days, one needs simply to multiply the strategy positions with the asset log-returns. How much is this lag $L$? For a SMA moving average calculated using $M$ days, the lag is roughly $\frac$. However, investors may notice slight variations between the simple moving average and the exponential moving average. However, this comes at a cost: SMA timeseries lag the original price timeseries, which means that changes in the trend are only seen with a delay (lag) of $L$ days. When carefully looking at an exchange-traded fund chart or stock, many investors use the moving average as an effective tool in navigating an investment strategy. It is straightforward to observe that SMA timeseries are much less noisy than the original price timeseries.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |