{"id":2095283,"date":"2018-12-24T13:02:15","date_gmt":"2018-12-24T07:32:15","guid":{"rendered":"http:\/\/stockviz.biz\/index.php\/?p=2095283"},"modified":"2018-12-25T16:56:08","modified_gmt":"2018-12-25T11:26:08","slug":"sma-distance-part-i","status":"publish","type":"post","link":"https:\/\/stockviz.biz\/index.php\/2018\/12\/24\/sma-distance-part-i\/","title":{"rendered":"SMA Distance, Part I"},"content":{"rendered":"<p>Simple Moving Averages (SMA) have been used since time immemorial to trigger trading and risk-management decisions. They are also used to divide a time-series into different regimes to study derivative properties (volatility, for example.) One way to go about it is to simple split it based on whether the index is trading above an SMA or below it. But the binary split maybe too crude to model. Another way to go about it is to measure the percentage distance between the SMA and the index.<\/p>\n<h3>The distance<\/h3>\n<p>The formula is pretty simple: <code>distance = SMA(n)\/index -1<\/code> where n is the look-back period (50, 100, etc&#8230;)<\/p>\n<p>If you vary <em>n<\/em> and plot the distance over time for the S&amp;P 500, you get:<br \/>\n<a href=\"https:\/\/github.com\/stockviz\/blog\/raw\/master\/technical\/sma\/SP500.sma.distance.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/github.com\/stockviz\/blog\/raw\/master\/technical\/sma\/SP500.sma.distance.png\" width=\"3600\" height=\"1800\" alt=\"SP500.sma.distance\" class=\"alignnone size-full\" \/><\/a><br \/>\nAnd the same thing for the NIFTY 50:<br \/>\n<a href=\"https:\/\/github.com\/stockviz\/blog\/raw\/master\/technical\/sma\/NIFTY50.sma.distance.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/github.com\/stockviz\/blog\/raw\/master\/technical\/sma\/NIFTY50.sma.distance.png\" width=\"3600\" height=\"1800\" alt=\"NIFTY50.sma.distance\" class=\"alignnone size-full\" \/><\/a><br \/>\n<small>-ve distance =&gt; Index &gt; SMA (index is trending higher)<\/small><\/p>\n<p>On the face of it, it looks like there is some pattern to it. The next post in this series will dive deeper into it. See <a href=\"https:\/\/stockviz.biz\/2018\/12\/25\/sma-distance-part-ii\/\">Part II<\/a>.<\/p>\n<p>Code and charts are on <a href=\"https:\/\/github.com\/stockviz\/blog\/tree\/master\/technical\/sma\" rel=\"noopener\" target=\"_blank\">github<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Simple Moving Averages (SMA) have been used since time immemorial to trigger trading and risk-management decisions. They are also used to divide a time-series into different regimes to study derivative properties (volatility, for example.) One way to go about it is to simple split it based on whether the index is trading above an SMA &hellip; <\/p>\n","protected":false},"author":2,"featured_media":2089693,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3471],"tags":[3963],"class_list":["post-2095283","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-investing-insight","tag-sma","entry"],"_links":{"self":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts\/2095283","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=2095283"}],"version-history":[{"count":0,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts\/2095283\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/media\/2089693"}],"wp:attachment":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/media?parent=2095283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/categories?post=2095283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/tags?post=2095283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}