{"id":40890173,"date":"2023-03-25T09:31:41","date_gmt":"2023-03-25T04:01:41","guid":{"rendered":"https:\/\/stockviz.biz\/index.php\/?p=40890173"},"modified":"2023-03-25T09:31:51","modified_gmt":"2023-03-25T04:01:51","slug":"mahalanobis-distance-with-trend","status":"publish","type":"post","link":"https:\/\/stockviz.biz\/index.php\/2023\/03\/25\/mahalanobis-distance-with-trend\/","title":{"rendered":"Mahalanobis Distance with Trend"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a rel=\"noreferrer noopener\" href=\"https:\/\/stockviz.biz\/index.php\/2023\/03\/16\/mahalanobis-distance\/\" target=\"_blank\">Previously<\/a>, we constructed a portfolio that switches between equities and bonds based on the Mahalanobis distance between them. Here, keeping everything else the same, we add a trend filter to the same set of indices. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The composite regime-switching model ends up with superior Sharpe Ratios. However, if you don&#8217;t switch to bonds (and stay in cash, earning zero), then you maybe better off with a simple trend model.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/mahalanobis\/SMA\/ranks.png\" alt=\"\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The alpha seems to be in earning the risk-free rate when things are &#8220;bad&#8221; and getting long equities only when things are &#8220;favorable.&#8221; <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/mahalanobis\/SMA\/NIFTY%2050%20TR.long-only.validate.cumulative.png\" alt=\"\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/mahalanobis\/SMA\/NIFTY%20MIDCAP%20150%20TR.long-only.validate.cumulative.png\" alt=\"\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/mahalanobis\/SMA\/NIFTY%20SMALLCAP%20250%20TR.long-only.validate.cumulative.png\" alt=\"\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/mahalanobis\/SMA\/NIFTY500%20MULTICAP%2050_25_25%20TR.long-only.validate.cumulative.png\" alt=\"\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Code and charts are on <a href=\"https:\/\/github.com\/stockviz\/blog\/tree\/master\/mahalanobis\/SMA\" target=\"_blank\" rel=\"noreferrer noopener\">github<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Previously, we constructed a portfolio that switches between equities and bonds based on the Mahalanobis distance between them. Here, keeping everything else the same, we add a trend filter to the same set of indices. The composite regime-switching model ends up with superior Sharpe Ratios. However, if you don&#8217;t switch to bonds (and stay in &hellip; <\/p>\n","protected":false},"author":2,"featured_media":2106273,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3471],"tags":[2761,3793],"class_list":["post-40890173","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-investing-insight","tag-quant","tag-trend-following","entry"],"_links":{"self":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts\/40890173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/comments?post=40890173"}],"version-history":[{"count":0,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts\/40890173\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/media\/2106273"}],"wp:attachment":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/media?parent=40890173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/categories?post=40890173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/tags?post=40890173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}