{"action":"created","issue":{"url":"https://api.github.com/repos/ScottLogic/d3fc/issues/920","repository_url":"https://api.github.com/repos/ScottLogic/d3fc","labels_url":"https://api.github.com/repos/ScottLogic/d3fc/issues/920/labels{/name}","comments_url":"https://api.github.com/repos/ScottLogic/d3fc/issues/920/comments","events_url":"https://api.github.com/repos/ScottLogic/d3fc/issues/920/events","html_url":"https://github.com/ScottLogic/d3fc/pull/920","id":137231739,"number":920,"title":"Cleared RSI calculator state after each use. Added test to verify fix.","user":{"login":"jdhodges","id":14218569,"avatar_url":"https://avatars.githubusercontent.com/u/14218569?v=3","gravatar_id":"","url":"https://api.github.com/users/jdhodges","html_url":"https://github.com/jdhodges","followers_url":"https://api.github.com/users/jdhodges/followers","following_url":"https://api.github.com/users/jdhodges/following{/other_user}","gists_url":"https://api.github.com/users/jdhodges/gists{/gist_id}","starred_url":"https://api.github.com/users/jdhodges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdhodges/subscriptions","organizations_url":"https://api.github.com/users/jdhodges/orgs","repos_url":"https://api.github.com/users/jdhodges/repos","events_url":"https://api.github.com/users/jdhodges/events{/privacy}","received_events_url":"https://api.github.com/users/jdhodges/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-29T11:48:54Z","updated_at":"2016-02-29T15:12:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ScottLogic/d3fc/pulls/920","html_url":"https://github.com/ScottLogic/d3fc/pull/920","diff_url":"https://github.com/ScottLogic/d3fc/pull/920.diff","patch_url":"https://github.com/ScottLogic/d3fc/pull/920.patch"},"body":"Fixes #917."},"comment":{"url":"https://api.github.com/repos/ScottLogic/d3fc/issues/comments/190252118","html_url":"https://github.com/ScottLogic/d3fc/pull/920#issuecomment-190252118","issue_url":"https://api.github.com/repos/ScottLogic/d3fc/issues/920","id":190252118,"user":{"login":"ColinEberhardt","id":1098110,"avatar_url":"https://avatars.githubusercontent.com/u/1098110?v=3","gravatar_id":"","url":"https://api.github.com/users/ColinEberhardt","html_url":"https://github.com/ColinEberhardt","followers_url":"https://api.github.com/users/ColinEberhardt/followers","following_url":"https://api.github.com/users/ColinEberhardt/following{/other_user}","gists_url":"https://api.github.com/users/ColinEberhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/ColinEberhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ColinEberhardt/subscriptions","organizations_url":"https://api.github.com/users/ColinEberhardt/orgs","repos_url":"https://api.github.com/users/ColinEberhardt/repos","events_url":"https://api.github.com/users/ColinEberhardt/events{/privacy}","received_events_url":"https://api.github.com/users/ColinEberhardt/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T15:12:37Z","updated_at":"2016-02-29T15:12:37Z","body":"Actually, isn't there a simpler way of removing the retained state - by changing its scope so that it is restricted to the component function itself ...\r\n\r\nRegarding the change you've made in this commit:\r\n\r\nhttps://github.com/jdhodges/d3fc/commit/ad9a2c4c0b79585f68498b8ea78c4c134622ed01\r\n\r\nHow about changing it so that the sliding window component is created within the rsi function scope as follows:\r\n\r\n\r\n```\r\nvar rsi = function(data) {\r\n\r\n  var prevClose, prevDownChangesAvg, prevUpChangesAvg;\r\n\r\n  var slidingWindow = _slidingWindow()\r\n         .windowSize(14)\r\n         .accumulator(function(values) {\r\n             ...\r\n         });\r\n\r\n  return slidingWindow(data);\r\n}\r\n```\r\n\r\n\r\n\r\n"}}