> Following question regarding market order - how exactly I can fill an
> order and assign an exit condition - for example if stock price go
> under X sell the stock automatically.
double price = getMarketBook().getSnapshot().getPrice();
if (price <= 100) {
setPosition(0);
}
That's all there is to it, really. A better version would be to
compare the current price with the last entry price, and exit when the
difference is larger than a certain threshold. I assume you are trying
to implement a stop loss.
--
You received this message because you are subscribed to the Google Groups
"JBookTrader" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jbooktrader?hl=en.