Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable catastrophic stop loss #1

Open
GoogleCodeExporter opened this issue Feb 14, 2016 · 3 comments
Open

Enable catastrophic stop loss #1

GoogleCodeExporter opened this issue Feb 14, 2016 · 3 comments

Comments

@GoogleCodeExporter
Copy link

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.

Original issue reported on code.google.com by [email protected] on 23 Feb 2008 at 5:31

@GoogleCodeExporter
Copy link
Author

What's about something like :

int currentPosition = getPositionManager().getPosition();
double lastEntry = getPositionManager().getAvgFillPrice();

if(currentPosition <= 0 && ...) {
  cancelAllStops();
  setPosition(1);
  setStopSell(lastEntry - 5);
}
if(currentPosition >= 0 && ...) {
  cancelAllStops();
  setPosition(-1);
  setStopBuy(lastEntry + 5);
}

Original comment by [email protected] on 25 May 2008 at 11:58

@GoogleCodeExporter
Copy link
Author

Yes, something like that, although it's probably better to handle it with the 
"One
cancels others" type of order:
http://individuals.interactivebrokers.com/en/trading/orders/oca.php


Original comment by [email protected] on 25 May 2008 at 9:38

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 29 Aug 2008 at 2:41

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant