{"action":"created","issue":{"url":"https://api.github.com/repos/mkoistinen/JBookTrader/issues/3","labels_url":"https://api.github.com/repos/mkoistinen/JBookTrader/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/mkoistinen/JBookTrader/issues/3/comments","events_url":"https://api.github.com/repos/mkoistinen/JBookTrader/issues/3/events","html_url":"https://github.com/mkoistinen/JBookTrader/issues/3","id":118175089,"number":3,"title":"Enhancement: Enable catastrophic stop loss","user":{"login":"mkoistinen","id":615759,"avatar_url":"https://avatars.githubusercontent.com/u/615759?v=3","gravatar_id":"","url":"https://api.github.com/users/mkoistinen","html_url":"https://github.com/mkoistinen","followers_url":"https://api.github.com/users/mkoistinen/followers","following_url":"https://api.github.com/users/mkoistinen/following{/other_user}","gists_url":"https://api.github.com/users/mkoistinen/gists{/gist_id}","starred_url":"https://api.github.com/users/mkoistinen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkoistinen/subscriptions","organizations_url":"https://api.github.com/users/mkoistinen/orgs","repos_url":"https://api.github.com/users/mkoistinen/repos","events_url":"https://api.github.com/users/mkoistinen/events{/privacy}","received_events_url":"https://api.github.com/users/mkoistinen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-21T06:42:06Z","updated_at":"2015-11-21T06:42:47Z","closed_at":null,"body":"There should be a way to set a stop loss order every time the position changes. It would serve as a protection against events such as loss of power, ISP failures, etc."},"comment":{"url":"https://api.github.com/repos/mkoistinen/JBookTrader/issues/comments/158595497","html_url":"https://github.com/mkoistinen/JBookTrader/issues/3#issuecomment-158595497","issue_url":"https://api.github.com/repos/mkoistinen/JBookTrader/issues/3","id":158595497,"user":{"login":"mkoistinen","id":615759,"avatar_url":"https://avatars.githubusercontent.com/u/615759?v=3","gravatar_id":"","url":"https://api.github.com/users/mkoistinen","html_url":"https://github.com/mkoistinen","followers_url":"https://api.github.com/users/mkoistinen/followers","following_url":"https://api.github.com/users/mkoistinen/following{/other_user}","gists_url":"https://api.github.com/users/mkoistinen/gists{/gist_id}","starred_url":"https://api.github.com/users/mkoistinen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkoistinen/subscriptions","organizations_url":"https://api.github.com/users/mkoistinen/orgs","repos_url":"https://api.github.com/users/mkoistinen/repos","events_url":"https://api.github.com/users/mkoistinen/events{/privacy}","received_events_url":"https://api.github.com/users/mkoistinen/received_events","type":"User","site_admin":false},"created_at":"2015-11-21T06:42:47Z","updated_at":"2015-11-21T06:42:47Z","body":"(Original comment by RobertdeChartelier)\r\nWhat's about something like :\r\n````\r\nint currentPosition = getPositionManager().getPosition();\r\ndouble lastEntry = getPositionManager().getAvgFillPrice();\r\n\r\nif(currentPosition <= 0 && ...) {\r\n  cancelAllStops();\r\n  setPosition(1);\r\n  setStopSell(lastEntry - 5);\r\n}\r\nif(currentPosition >= 0 && ...) {\r\n  cancelAllStops();\r\n  setPosition(-1);\r\n  setStopBuy(lastEntry + 5);\r\n}\r\n````"}}