Hi, you can use the IOrder.getOpenPrice() and IOrder.getStopLossPrice() to get the order open price and the order stop loss price. Please consider the following code:
for (IOrder curOrder: engine.getOrders()) { console.getOut().println("Order open price: " + curOrder.getOpenPrice()); console.getOut().println("Order SL: " + curOrder.getStopLossPrice()); }
[liyinan]
Post subject: Re: how to get SL and openprice of one filled order
Hi, you can use the IOrder.getOpenPrice() and IOrder.getStopLossPrice() to get the order open price and the order stop loss price. Please consider the following code:
for (IOrder curOrder: engine.getOrders()) { console.getOut().println("Order open price: " + curOrder.getOpenPrice()); console.getOut().println("Order SL: " + curOrder.getStopLossPrice()); }
and if i have a group of orders ,can i compare the open price of an order and its SL, one by one?
API Support
Post subject: Re: how to get SL and openprice of one filled order
and if i have a group of orders ,can i compare the open price of an order and its SL, one by one?
If you have created the order with a SL and a TP, you can get the order and check if it has the SL and the TP. The IEngine.getOrders() method iterate orders with a different position Id.